-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #159 from cta-observatory/automatic_docs
Add deployment of docs in CI
- Loading branch information
Showing
12 changed files
with
313 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# Makefile with some convenient quick ways to do common things | ||
|
||
PROJECT=magic-cta-pipe | ||
PYTHON=python | ||
|
||
help: | ||
@echo '' | ||
@echo '$(PROJECT) available make targets:' | ||
@echo '' | ||
@echo ' help Print this help message (the default)' | ||
@echo ' env Create a conda environment for magic-cta-pipe development' | ||
@echo ' develop make symlinks to this package in python install dir' | ||
@echo ' clean Remove temp files' | ||
@echo ' test Run tests' | ||
@echo ' doc Generate Sphinx docs' | ||
@echo ' analyze Do a static code check and report errors' | ||
@echo '' | ||
@echo 'Advanced targets (for experts)' | ||
@echo ' conda Build a conda package for distribution' | ||
@echo ' doc-publish Upload docs to static GitHub page' | ||
@echo '' | ||
|
||
init: | ||
@echo "'make init' is no longer needed" | ||
|
||
clean: | ||
$(RM) -rf build docs/_build docs/api htmlcov magic_cta_pipe.egg-info dist | ||
find . -name "*.pyc" -exec rm {} \; | ||
find . -name "*.so" -exec rm {} \; | ||
find . -name __pycache__ | xargs rm -fr | ||
|
||
test: | ||
pytest | ||
|
||
doc: | ||
cd docs && $(MAKE) html SPHINXOPTS="-W --keep-going -n --color -j auto" | ||
@echo "------------------------------------------------" | ||
@echo "Documentation is in: docs/_build/html/index.html" | ||
|
||
doc-publish: | ||
ghp-import -n -p -m 'Update gh-pages docs' docs/_build/html | ||
|
||
analyze: | ||
@pylint magicctapipe --ignored-classes=astropy.units | ||
|
||
lint: | ||
@flake8 magicctapipe | ||
|
||
env: | ||
conda env create -n cta-dev -f environment.yml | ||
source activate cta-dev | ||
|
||
develop: | ||
pip install -e . | ||
|
||
wheel: | ||
python -m build --wheel | ||
|
||
sdist: | ||
python -m build --sdist | ||
|
||
trailing-spaces: | ||
find $(PROJECT) examples docs -name "*.py" -exec perl -pi -e 's/[ \t]*$$//' {} \; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
[ | ||
{ | ||
"name": "dev", | ||
"version": "latest", | ||
"url": "https://magic-cta-pipe.readthedocs.io/en/latest/" | ||
}, | ||
{ | ||
"name": "stable", | ||
"version": "stable", | ||
"url": "https://magic-cta-pipe.readthedocs.io/en/stable/" | ||
}, | ||
{ | ||
"name": "v0.3.1", | ||
"version": "v0.3.1", | ||
"url": "https://magic-cta-pipe.readthedocs.io/en/v0.3.1/" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
# Configuration file for the Sphinx documentation builder. | ||
|
||
import datetime | ||
import os | ||
|
||
import magicctapipe | ||
|
||
# Get configuration information from setup.cfg | ||
from configparser import ConfigParser | ||
|
||
setup_cfg = ConfigParser() | ||
setup_cfg.read([os.path.join(os.path.dirname(__file__), "..", "setup.cfg")]) | ||
setup_metadata = dict(setup_cfg.items("metadata")) | ||
setup_options = dict(setup_cfg.items("options")) | ||
|
||
# -- Project information | ||
|
||
project = setup_metadata["name"] | ||
author = setup_metadata["author"] | ||
copyright = "{}. Last updated {}".format( | ||
setup_metadata["author"], datetime.datetime.now().strftime("%d %b %Y %H:%M") | ||
) | ||
python_requires = setup_options["python_requires"] | ||
|
||
# make some variables available to each page | ||
rst_epilog = f""" | ||
.. |python_requires| replace:: {python_requires} | ||
""" | ||
|
||
# The version info for the project you're documenting, acts as replacement for | ||
# |version| and |release|, also used in various other places throughout the | ||
# built documents. | ||
|
||
version = magicctapipe.__version__ | ||
# The full version, including alpha/beta/rc tags. | ||
release = version | ||
|
||
# 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 = "en" | ||
|
||
# The name of the Pygments (syntax highlighting) style to use. | ||
pygments_style = "sphinx" | ||
|
||
# Define the json_url for our version switcher. | ||
json_url = "https://magic-cta-pipe.readthedocs.io/en/latest/_static/switcher.json" | ||
|
||
# Define the version we use for matching in the version switcher., | ||
version_match = os.getenv("READTHEDOCS_VERSION") | ||
# If READTHEDOCS_VERSION doesn't exist, we're not on RTD | ||
# If it is an integer, we're in a PR build and the version isn't correct. | ||
if not version_match or version_match.isdigit(): | ||
# For local development, infer the version to match from the package. | ||
if "dev" in release or "rc" in release: | ||
version_match = "latest" | ||
else: | ||
version_match = release | ||
|
||
# We want to keep the relative reference when on a pull request or locally | ||
json_url = "_static/switcher.json" | ||
|
||
# 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 = { | ||
"github_url": "https://github.com/cta-observatory/magic-cta-pipe", | ||
"header_links_before_dropdown": 6, | ||
"navbar_start": ["navbar-logo", "version-switcher"], | ||
"switcher": { | ||
"version_match": version_match, | ||
"json_url": json_url, | ||
}, | ||
"use_edit_page_button": True, | ||
"icon_links_label": "Quick Links", | ||
"icon_links": [ | ||
{ | ||
"name": "CTA Observatory", | ||
"url": "https://www.cta-observatory.org/", | ||
"type": "url", | ||
"icon": "https://www.cta-observatory.org/wp-content/themes/ctao/favicon.ico", | ||
}, | ||
], | ||
"announcement": """ | ||
<p>magic-cta-pipe is under active development. Expect large and rapid changes in functionality.</p> | ||
""", | ||
} | ||
|
||
# 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"] | ||
html_context = { | ||
"default_mode": "light", | ||
"github_user": "cta-observatory", | ||
"github_repo": "magic-cta-pipe", | ||
"github_version": "master", | ||
"doc_path": "docs", | ||
} | ||
|
||
|
||
# -- General configuration | ||
|
||
extensions = [ | ||
'sphinx.ext.duration', | ||
'sphinx.ext.doctest', | ||
'sphinx.ext.autodoc', | ||
'sphinx.ext.autosummary', | ||
'sphinx.ext.intersphinx', | ||
] | ||
|
||
intersphinx_mapping = { | ||
'python': ('https://docs.python.org/3/', None), | ||
'sphinx': ('https://www.sphinx-doc.org/en/master/', None), | ||
} | ||
intersphinx_disabled_domains = ['std'] | ||
|
||
templates_path = ['_templates'] | ||
|
||
# -- Options for HTML output | ||
|
||
html_theme = 'pydata_sphinx_theme' | ||
|
||
# The name for this set of Sphinx documents. If None, it defaults to | ||
# "<project> v<release> documentation". | ||
html_title = f"{project} v{release}" | ||
|
||
# -- Options for EPUB output | ||
epub_show_urls = 'footnote' |
Oops, something went wrong.