diff --git a/doc/Makefile b/doc/Makefile index c32f09b9..69fe55ec 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -4,7 +4,6 @@ # You can set these variables from the command line. SPHINXOPTS = SPHINXBUILD = sphinx-build -SPHINXPROJ = Trollflow2 SOURCEDIR = source BUILDDIR = build diff --git a/doc/make.bat b/doc/make.bat index 48ded36b..543c6b13 100644 --- a/doc/make.bat +++ b/doc/make.bat @@ -9,7 +9,6 @@ if "%SPHINXBUILD%" == "" ( ) set SOURCEDIR=source set BUILDDIR=build -set SPHINXPROJ=Trollflow2 if "%1" == "" goto help diff --git a/doc/source/conf.py b/doc/source/conf.py index 80432f5b..abc3fbbc 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -1,16 +1,12 @@ # -*- coding: utf-8 -*- # -# Trollflow2 documentation build configuration file, created by -# sphinx-quickstart on Thu Sep 19 23:01:42 2019. +# Configuration file for the Sphinx documentation builder. # -# This file is execfile()d with the current directory set to its -# containing dir. -# -# Note that not all possible configuration values are present in this -# autogenerated file. -# -# All configuration values have a default; values that are commented out -# serve to show the default. +# 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 + +# -- 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 @@ -19,27 +15,87 @@ # import os # import sys # sys.path.insert(0, os.path.abspath('.')) +import pyspectral.version as current_version +import sys +import os +# PYTHONPATH = docs/source +DOC_SOURCES_DIR = os.path.dirname(os.path.abspath(__file__)) +PROJECT_ROOT_DIR = os.path.dirname(DOC_SOURCES_DIR) +sys.path.insert(0, DOC_SOURCES_DIR) -# -- General configuration ------------------------------------------------ +# If runs on ReadTheDocs environment +on_rtd = os.environ.get('READTHEDOCS', None) == 'True' -project = 'Trollflow2' -copyright = '2019, Panu Lahtinen, Martin Raspaud' -author = 'Panu Lahtinen, Martin Raspaud' -# The full version, including alpha/beta/rc tags -release = '0.5.0' +# -- Project information ----------------------------------------------------- + +project = u'Trollflow2' +copyright = u'2019, Pytroll' +author = u'Pytroll' + + +sys.path.insert(0, os.path.abspath('../')) +sys.path.insert(0, os.path.abspath('../trollflow2')) + + +class Mock(object): + + """Mock class for doc/unit testing (on Travis)""" + + __all__ = [] + + def __init__(self, *args, **kwargs): + pass + + def __call__(self, *args, **kwargs): + return Mock() + + @classmethod + def __getattr__(cls, name): + if name in ('__file__', '__path__'): + return '/dev/null' + elif name[0] == name[0].upper(): + mockType = type(name, (), {}) + mockType.__module__ = __name__ + return mockType + elif name == "inf": + return 0 + else: + return Mock() + + +MOCK_MODULES = ['numpy', 'numpy.core', + 'numpy.distutils.core', 'numpy.core.multiarray', + 'dask', 'dask.array', + 'satpy', 'satpy.dataset', 'satpy.resample', 'satpy.writers', + 'posttroll', 'posttroll.message', 'posttroll.publisher', + 'rasterio', 'rasterio.enums', 'gdal', + 'pyresample', 'pyresample.boundary', + 'trollsift', 'trollsift.parser', + 'h5py', 'tqdm'] + +for mod_name in MOCK_MODULES: + sys.modules[mod_name] = Mock() -# Master file -master_doc = 'index' # -- 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.todo'] +extensions = [ + 'sphinx.ext.autodoc', + 'sphinx.ext.doctest', + 'sphinx.ext.intersphinx', + 'sphinx.ext.todo', + 'sphinx.ext.coverage', + 'sphinx.ext.imgmath', +] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] @@ -53,19 +109,12 @@ # The master toctree document. master_doc = 'index' -# General information about the project. -project = u'Trollflow2' -copyright = u'2019, Pytroll' -author = u'Pytroll' -# 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 = u'0' # The full version, including alpha/beta/rc tags. -release = u'1' +release = current_version.get_versions()['version'] +# The short X.Y version. +version = ".".join(release.split(".")[: 2]) + # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. @@ -76,22 +125,19 @@ # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. -# This patterns also effect to html_static_path and html_extra_path -exclude_patterns = [] +# This pattern also affects html_static_path and html_extra_path. +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 - -# -- 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' +html_theme = 'default' # 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 @@ -104,14 +150,24 @@ # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ['_static'] +# 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 = {} + -# -- Options for HTMLHelp output ------------------------------------------ +# -- Options for HTMLHelp output --------------------------------------------- # Output file base name for HTML help builder. htmlhelp_basename = 'Trollflow2doc' -# -- Options for LaTeX output --------------------------------------------- +# -- Options for LaTeX output ------------------------------------------------ latex_elements = { # The paper size ('letterpaper' or 'a4paper'). @@ -140,7 +196,7 @@ ] -# -- Options for manual page output --------------------------------------- +# -- Options for manual page output ------------------------------------------ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). @@ -150,7 +206,7 @@ ] -# -- Options for Texinfo output ------------------------------------------- +# -- Options for Texinfo output ---------------------------------------------- # Grouping the document tree into Texinfo files. List of tuples # (source start file, target name, title, author, @@ -160,3 +216,34 @@ author, 'Trollflow2', 'One line description of project.', 'Miscellaneous'), ] + + +# -- Options for Epub output ------------------------------------------------- + +# Bibliographic Dublin Core info. +epub_title = project + +# The unique identifier of the text. This can be a ISBN number +# or the project homepage. +# +# epub_identifier = '' + +# A unique identification for the text. +# +# epub_uid = '' + +# A list of files that should not be packed into the epub file. +epub_exclude_files = ['search.html'] + + +# -- 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 diff --git a/doc/source/index.rst b/doc/source/index.rst index 4b75b747..1629bb54 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -1,5 +1,5 @@ .. Trollflow2 documentation master file, created by - sphinx-quickstart on Thu Sep 19 23:01:42 2019. + sphinx-quickstart on Wed Oct 2 23:07:10 2019. You can adapt this file completely to your liking, but it should at least contain the root `toctree` directive.