-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
redirect to psyplot.github.io/psy-simple
- Loading branch information
Showing
10 changed files
with
45 additions
and
457 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{% extends "!layout.html" %} | ||
|
||
{% block extrahead %} | ||
<meta http-equiv="refresh" content="0; URL=https://psyplot.github.io/psy-simple/" /> | ||
{% endblock %} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,287 +1,57 @@ | ||
# -*- coding: utf-8 -*- | ||
# Configuration file for the Sphinx documentation builder. | ||
# | ||
# psy-simple documentation build configuration file | ||
# This file only contains a selection of the most common options. For a full | ||
# list see the documentation: | ||
# https://www.sphinx-doc.org/en/master/usage/configuration.html | ||
|
||
# Disclaimer | ||
# ---------- | ||
# | ||
# Copyright (C) 2021 Helmholtz-Zentrum Hereon | ||
# Copyright (C) 2020-2021 Helmholtz-Zentrum Geesthacht | ||
# Copyright (C) 2016-2021 University of Lausanne | ||
# | ||
# This file is part of psy-simple and is released under the GNU LGPL-3.O license. | ||
# See COPYING and COPYING.LESSER in the root of the repository for full | ||
# licensing details. | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU Lesser General Public License version 3.0 as | ||
# published by the Free Software Foundation. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU LGPL-3.0 license for more details. | ||
# -- 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. | ||
# | ||
# You should have received a copy of the GNU LGPL-3.0 license | ||
# along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
# import os | ||
# import sys | ||
# sys.path.insert(0, os.path.abspath('.')) | ||
|
||
|
||
import sphinx | ||
import inspect | ||
import os | ||
import os.path as osp | ||
import sys | ||
import re | ||
import six | ||
import subprocess as spr | ||
from itertools import chain | ||
from collections import defaultdict | ||
import warnings | ||
import psyplot | ||
from psyplot.plotter import Formatoption, Plotter | ||
import psy_simple | ||
from autodocsumm import AutoSummClassDocumenter | ||
# -- Project information ----------------------------------------------------- | ||
|
||
project = 'psy-simple' | ||
copyright = '2021, Philipp S. Sommer' | ||
author = 'Philipp S. Sommer' | ||
|
||
# automatically import all plotter classes | ||
psyplot.rcParams['project.auto_import'] = True | ||
# include links to the formatoptions in the documentation of the | ||
# :attr:`psyplot.project.ProjectPlotter` methods | ||
Plotter.include_links(True) | ||
# The full version, including alpha/beta/rc tags | ||
release = '1.3.1' | ||
|
||
warnings.filterwarnings('ignore', message="axes.color_cycle is deprecated") | ||
warnings.filterwarnings( | ||
'ignore', message=("This has been deprecated in mpl 1.5,")) | ||
warnings.filterwarnings('ignore', message="invalid value encountered in ") | ||
warnings.filterwarnings('ignore', message=r"\s*examples.directory") | ||
warnings.filterwarnings('ignore', message='numpy.dtype size changed') | ||
|
||
# -- General configuration ------------------------------------------------ | ||
# -- General configuration --------------------------------------------------- | ||
|
||
# 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.doctest', | ||
'sphinx.ext.intersphinx', | ||
'sphinx.ext.autosummary', | ||
'sphinx.ext.todo', | ||
'sphinx.ext.viewcode', | ||
'matplotlib.sphinxext.plot_directive', | ||
'IPython.sphinxext.ipython_console_highlighting', | ||
'IPython.sphinxext.ipython_directive', | ||
'psyplot.sphinxext.extended_napoleon', | ||
'autodocsumm', | ||
'sphinx_nbexamples', | ||
] | ||
|
||
# Add any paths that contain templates here, relative to this directory. | ||
templates_path = ['_templates'] | ||
|
||
# on_rtd is whether we are on readthedocs.org, this line of code grabbed from | ||
# docs.readthedocs.org | ||
on_rtd = os.environ.get('READTHEDOCS', None) == 'True' | ||
|
||
# process the examples if they don't exist already | ||
process_examples = ( | ||
not osp.exists(osp.join(osp.dirname(__file__), 'examples'))) | ||
|
||
if on_rtd: | ||
spr.call([sys.executable] + | ||
('-m ipykernel install --user --name python3 ' | ||
'--display-name python3').split()) | ||
|
||
if not osp.exists(osp.join(osp.dirname(__file__), 'api')): | ||
spr.check_call(['bash', 'apigen.bash']) | ||
|
||
# HACK: Create an empty file called '<string>' to prevent | ||
# https://github.com/sphinx-doc/sphinx/issues/5614 | ||
if not osp.exists('<string>'): | ||
with open('<string>', 'w') as f: | ||
pass | ||
|
||
# The cdo example would require the installation of climate data operators | ||
# which is a bit of an overkill | ||
example_gallery_config = dict( | ||
urls='https://github.com/psyplot/psy-simple/blob/master/examples', | ||
) | ||
|
||
napoleon_use_admonition_for_examples = True | ||
|
||
# The suffix(es) of source filenames. | ||
# You can specify multiple suffix as a list of string: | ||
source_suffix = '.rst' | ||
|
||
# The master toctree document. | ||
master_doc = 'index' | ||
|
||
autodoc_default_options = { | ||
'show_inheritance': True, | ||
'autosummary': True, | ||
} | ||
|
||
autoclass_content = 'both' | ||
|
||
not_document_data = ['psy_simple.plugin.defaultParams', | ||
'psy_simple.plugin.rcParams'] | ||
|
||
ipython_savefig_dir = os.path.join(os.path.dirname(__file__), '_static') | ||
|
||
# General information about the project. | ||
project = 'psy-simple' | ||
copyright = ", ".join( | ||
psy_simple.__copyright__.strip().replace("Copyright (C) ", "").splitlines() | ||
) | ||
author = psy_simple.__author__ | ||
|
||
# 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. | ||
# | ||
# The short X.Y version. | ||
version = re.match(r'\d+\.\d+\.\d+', psy_simple.__version__).group() | ||
# The full version, including alpha/beta/rc tags. | ||
release = psy_simple.__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 = None | ||
|
||
# List of patterns, relative to source directory, that match files and | ||
# directories to ignore when looking for source files. | ||
exclude_patterns = ['_build'] | ||
|
||
# The name of the Pygments (syntax highlighting) style to use. | ||
pygments_style = 'sphinx' | ||
|
||
# If true, `todo` and `todoList` produce output, else they produce nothing. | ||
todo_include_todos = True | ||
# This pattern also affects html_static_path and html_extra_path. | ||
exclude_patterns = [] | ||
|
||
# The master toctree document. | ||
master_doc = 'index' | ||
|
||
# -- Options for HTML output ---------------------------------------------- | ||
# -- 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 = 'alabaster' | ||
|
||
if not on_rtd: # only import and set the theme if we're building docs locally | ||
import sphinx_rtd_theme | ||
html_theme = 'sphinx_rtd_theme' | ||
html_theme_path = [sphinx_rtd_theme.get_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'] | ||
|
||
# otherwise, readthedocs.org uses their theme by default, so no need to specify | ||
|
||
# Output file base name for HTML help builder. | ||
htmlhelp_basename = 'psy-simpledoc' | ||
|
||
# -- Options for LaTeX output --------------------------------------------- | ||
|
||
latex_elements = { | ||
# Additional stuff for the LaTeX preamble. | ||
'preamble': r'\setcounter{tocdepth}{10}' | ||
} | ||
|
||
# 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 = [ | ||
(master_doc, 'psy-simple.tex', u'psy-simple Documentation', | ||
author, 'manual'), | ||
] | ||
|
||
|
||
# -- Options for manual page output --------------------------------------- | ||
|
||
# One entry per manual page. List of tuples | ||
# (source start file, name, description, authors, manual section). | ||
man_pages = [ | ||
(master_doc, 'psy-simple', u'psy-simple Documentation', | ||
[author], 1) | ||
] | ||
|
||
|
||
# -- Options 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 = [ | ||
(master_doc, 'psy-simple', u'psy-simple Documentation', | ||
author, 'psy-simple', 'The psyplot plugin for simple visualizations', | ||
'Miscellaneous'), | ||
] | ||
|
||
|
||
# -- Options for Epub output ---------------------------------------------- | ||
|
||
# Bibliographic Dublin Core info. | ||
epub_title = project | ||
epub_author = author | ||
epub_publisher = author | ||
epub_copyright = copyright | ||
|
||
# A list of files that should not be packed into the epub file. | ||
epub_exclude_files = ['search.html'] | ||
|
||
# Example configuration for intersphinx: refer to the Python standard library. | ||
intersphinx_mapping = { | ||
'pandas': ('https://pandas.pydata.org/pandas-docs/stable/', None), | ||
'numpy': ('https://docs.scipy.org/doc/numpy/', None), | ||
'matplotlib': ('http://matplotlib.org/stable/', None), | ||
'sphinx': ('https://www.sphinx-doc.org/en/stable/', None), | ||
'xarray': ('https://xarray.pydata.org/en/stable/', None), | ||
'cartopy': ('https://scitools.org.uk/cartopy/docs/latest/', None), | ||
'mpl_toolkits': ('https://matplotlib.org/basemap/', None), | ||
'psyplot': ('https://psyplot.github.io/psyplot/', None), | ||
'psy_maps': ( | ||
'https://psyplot.readthedocs.io/projects/psy-maps/en/latest/', None), | ||
'psy_reg': ('https://psyplot.readthedocs.io/projects/psy-reg/en/latest/', | ||
None), | ||
'python': ('https://docs.python.org/3/', None), | ||
} | ||
|
||
|
||
def group_formatoptions(app, what, name, obj, section, parent): | ||
if inspect.isclass(obj) and issubclass(obj, Formatoption): | ||
return 'Formatoption classes' | ||
elif inspect.isclass(obj) and issubclass(obj, Plotter): | ||
return 'Plotter classes' | ||
elif (inspect.isclass(parent) and issubclass(parent, Plotter) and | ||
isinstance(obj, Formatoption)): | ||
return obj.groupname | ||
|
||
|
||
class PlotterAutoClassDocumenter(AutoSummClassDocumenter): | ||
"""A ClassDocumenter that includes all the formatoption of a plotter""" | ||
|
||
priority = AutoSummClassDocumenter.priority + 0.1 | ||
|
||
def filter_members(self, *args, **kwargs): | ||
ret = super(AutoSummClassDocumenter, self).filter_members( | ||
*args, **kwargs) | ||
if issubclass(self.object, Plotter): | ||
fmt_members = defaultdict(set) | ||
all_fmt = set(self.object._get_formatoptions()) | ||
for i, (mname, member, isattr) in enumerate(ret): | ||
if isinstance(member, Formatoption): | ||
fmt_members[member.group].add((mname, member, isattr)) | ||
all_fmt.remove(mname) | ||
for fmt in all_fmt: | ||
fmto = getattr(self.object, fmt) | ||
fmt_members[fmto.group].add((fmt, fmto, True)) | ||
ret.extend( | ||
(tup for tup in chain(*map(sorted, fmt_members.values())) | ||
if tup not in ret)) | ||
return ret | ||
|
||
|
||
def setup(app): | ||
app.add_autodocumenter(PlotterAutoClassDocumenter) | ||
app.connect('autodocsumm-grouper', group_formatoptions) | ||
return {'version': sphinx.__display_version__, 'parallel_read_safe': True} | ||
# 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'] |
This file was deleted.
Oops, something went wrong.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.