Skip to content

Commit

Permalink
Primera versión de la documentación
Browse files Browse the repository at this point in the history
  • Loading branch information
dprada committed Oct 12, 2023
1 parent 8ddfc31 commit cb5beeb
Show file tree
Hide file tree
Showing 12 changed files with 524 additions and 0 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/sphinx_docs_to_gh_pages.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Sphinx docs to gh-pages

on:
release:
types: ['released']

workflow_dispatch:

env:
SPHINXWORKING: True

jobs:
sphinx_docs_to_gh-pages:
runs-on: ubuntu-latest
name: Sphinx docs to gh-pages
steps:

- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Additional info about the build
shell: bash
run: |
uname -a
- name: Setup conda env
uses: mamba-org/setup-micromamba@v1
with:
environment-file: devtools/docs_env.yaml
environment-name: docs
condarc: |
channels:
- uibcdf
- conda-forge
- defaults
channel_priority: strict
create-args: >-
python=3.10
- name: Install package
shell: bash -l {0}
run: |
python -m pip install . --no-deps
- name: Info conda
shell: bash -l {0}
run: |
micromamba info
micromamba list
- name: Running the Sphinx to gh-pages Action
uses: uibcdf/action-sphinx-docs-to-gh-pages@v2.0.0
14 changes: 14 additions & 0 deletions cosmicmuffin/suma.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
def suma(var1, var2):
""" Parses a string and returns a pint quantity.
Parameters
----------
var1 : int
First integer number taking part in the sum
var2 : int
Second integer number taking part in the sum
Returns
-------
int
Sum of var1 and var2.
"""

return var1+var2
21 changes: 21 additions & 0 deletions devtools/docs_env.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
channels:
- uibcdf
- conda-forge
- defaults
dependencies:
- python
- pip
- setuptools >=61.0
- versioningit~=2.0
- jupyterlab
- sphinx
- pydata-sphinx-theme
- sphinxcontrib-bibtex
- sphinx-remove-toctrees
- sphinx-copybutton
- sphinx-design
- sphinx-favicon
- sphinx-tabs
- myst-nb
- nbsphinx
- sphinx_rtd_theme
20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = _build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
8 changes: 8 additions & 0 deletions docs/api_user.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Users
=====

.. autosummary::
:toctree: autosummary

cosmicmuffin.hola
cosmicmuffin.suma
6 changes: 6 additions & 0 deletions docs/autosummary/cosmicmuffin.hola.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
cosmicmuffin.hola
=================

.. currentmodule:: cosmicmuffin

.. autofunction:: hola
6 changes: 6 additions & 0 deletions docs/autosummary/cosmicmuffin.suma.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
cosmicmuffin.suma
=================

.. currentmodule:: cosmicmuffin

.. autofunction:: suma
245 changes: 245 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,245 @@
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config

import os
import sys

# -- Path setup --------------------------------------------------------------

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.

import cosmicmuffin

# -- Project information -----------------------------------------------------

project = "CosmicMuffin"
copyright = ("2023, UIBCDF. "
"This project is licensed under the terms of the MIT license. "
"See further details in the source code repository.")
author = ("uibcdf")

# The short X.Y version
version = '0.0.1'
# The full version, including alpha/beta/rc tags
release = '0.0.1'


# -- General configuration ---------------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = '1.0'

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.

extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',
'sphinx.ext.intersphinx',
'sphinx.ext.mathjax',
'sphinx.ext.todo',
'sphinx.ext.ifconfig',
'sphinx.ext.viewcode',
'sphinx.ext.napoleon',
'sphinx.ext.githubpages',
'sphinx.ext.extlinks',
'sphinx_remove_toctrees',
'sphinx_copybutton',
'myst_nb'
]

# Myst extensions and options

myst_enable_extensions = [
'dollarmath',
'amsmath'
]

myst_heading_anchors = 3

# Autosummary options

autosummary_generate = True

# Napoleon settings
napoleon_numpy_docstring = True
napoleon_google_docstring = False
napoleon_include_init_with_doc = False
napoleon_include_private_with_doc = False
napoleon_include_special_with_doc = True
napoleon_use_admonition_for_examples = False
napoleon_use_admonition_for_notes = True
napoleon_use_admonition_for_references = False
napoleon_use_ivar = False
napoleon_use_param = True
napoleon_use_rtype = True
napoleon_preprocess_types = False
napoleon_type_aliases = None
napoleon_attr_annotations = True

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:

source_parsers={
}

source_suffix = ['.rst', '.md', '.ipynb']

# The master toctree document.
master_doc = 'index'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
# language was edited to use sphinx-intl
language = 'en'

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path .
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', '**.ipynb_checkpoints']

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'default'

# Remove from toctrees
remove_from_toctrees = []
for directory in os.walk('api'):
if directory[0].endswith('/autosummary'):
remove_from_toctrees.append(directory[0]+'/*')

# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'sphinx_rtd_theme'

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#
# html_theme_options = {}

html_theme_options = {
'canonical_url': '',
'analytics_id': '',
'logo_only': False,
'display_version': True,
'prev_next_buttons_location': 'bottom',
'style_external_links': False,
# Toc options
'collapse_navigation': False,
'sticky_navigation': True,
'navigation_depth': 3,
'includehidden': True,
'titles_only': False
}

# Add any paths that contain custom themes here, relative to this directory.
#html_theme_path = []

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']

# Custom css

html_css_files = [
'custom.css',
]

# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
#
# The default sidebars (for documents that don't match any pattern) are
# defined by theme itself. Builtin themes are using these templates by
# default: ``['localtoc.html', 'relations.html', 'sourcelink.html',
# 'searchbox.html']``.
#
# html_sidebars = {}

html_show_sourcelink = False

# -- Options for HTMLHelp output ---------------------------------------------

# Output file base name for HTML help builder.
htmlhelp_basename = 'cosmicmuffin_doc'


# -- Options for LaTeX output ------------------------------------------------

latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',

# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',

# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',

# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
}

# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
]


# -- Options for manual page output ------------------------------------------

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
]


# -- 1 for Texinfo output ----------------------------------------------

# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
]


# -- Extension configuration -------------------------------------------------

# -- Options for intersphinx extension ---------------------------------------

# Example configuration for intersphinx: refer to the Python standard library.
#intersphinx_mapping = {'https://docs.python.org/': None}

# -- Options for todo extension ----------------------------------------------

# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = True

9 changes: 9 additions & 0 deletions docs/contents/introduction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Introducción

Para instalar la librería debes ejecutar:

```bash
conda install -c uibcdf cosmicmuffin
```

Y listo Cosmic Muffin!
Loading

0 comments on commit cb5beeb

Please sign in to comment.