Skip to content

Commit

Permalink
WIP: Automatically generate API docs
Browse files Browse the repository at this point in the history
  • Loading branch information
eigenbeam committed Dec 24, 2024
1 parent e6e99d2 commit 1041199
Show file tree
Hide file tree
Showing 14 changed files with 409 additions and 42 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ example/test.ini
metgenc.log
output
tmp
docs/build
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ python:
- requirements: docs/requirements.txt

sphinx:
configuration: docs/source/conf.py
configuration: docs/conf.py
4 changes: 2 additions & 2 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
BUILDDIR = build
SOURCEDIR = .
BUILDDIR = _build

# Put it first so that "make" without argument is like "make help".
help:
Expand Down
35 changes: 35 additions & 0 deletions docs/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=.
set BUILDDIR=_build

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)

if "%1" == "" goto help

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
1 change: 1 addition & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
myst-parser
sphinx==7.1.2
sphinx-rtd-theme==1.3.0rc1
7 changes: 7 additions & 0 deletions docs/source/api.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
API
===

.. autosummary::
:toctree: generated

nsidc
55 changes: 33 additions & 22 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -1,35 +1,46 @@
# Configuration file for the Sphinx documentation builder.
import sys
from pathlib import Path

# -- Project information
sys.path.insert(0, str(Path('..', '..', 'src').resolve()))

project = 'MetGenC'
copyright = '2024, NSIDC'
author = 'National Snow and Ice Data Center'
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

release = '0.6'
version = '0.6.0'
# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

# -- General configuration
project = 'MetGenC'
copyright = '2024, NSIDC'
author = 'NSIDC'
release = 'v0.6'

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
extensions = [
'sphinx.ext.duration',
'sphinx.ext.doctest',
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',
'sphinx.ext.intersphinx',
"sphinx.ext.autodoc",
"sphinx.ext.autosummary",
"sphinx.ext.napoleon",
]

intersphinx_mapping = {
'python': ('https://docs.python.org/3/', None),
'sphinx': ('https://www.sphinx-doc.org/en/master/', None),
}
intersphinx_disabled_domains = ['std']
exclude_patterns = [
"_build",
"**.ipynb_checkpoints",
"Thumbs.db",
".DS_Store",
".env",
".venv",
]

templates_path = ['_templates']

# -- Options for HTML output
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']

always_document_param_types = True


# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = 'sphinx_rtd_theme'
html_theme = 'classic'

# -- Options for EPUB output
epub_show_urls = 'footnote'
html_static_path = ['_static']
6 changes: 6 additions & 0 deletions docs/source/generated/nsidc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
nsidc
=====

.. automodule:: nsidc


13 changes: 0 additions & 13 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -1,19 +1,6 @@
Welcome to MetGenC's documentation!
===================================

**MetGenC** solves all your problems.

Check out the :doc:`usage` section for further information, including
how to :ref:`installation` the project.

.. note::

This project is under active development.

Contents
--------

.. toctree::

usage
api
7 changes: 7 additions & 0 deletions docs/source/modules.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
src
===

.. toctree::
:maxdepth: 4

nsidc
61 changes: 61 additions & 0 deletions docs/source/nsidc.metgen.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
nsidc.metgen package
====================

Submodules
----------

nsidc.metgen.aws module
-----------------------

.. automodule:: nsidc.metgen.aws
:members:
:undoc-members:
:show-inheritance:

nsidc.metgen.cli module
-----------------------

.. automodule:: nsidc.metgen.cli
:members:
:undoc-members:
:show-inheritance:

nsidc.metgen.config module
--------------------------

.. automodule:: nsidc.metgen.config
:members:
:undoc-members:
:show-inheritance:

nsidc.metgen.constants module
-----------------------------

.. automodule:: nsidc.metgen.constants
:members:
:undoc-members:
:show-inheritance:

nsidc.metgen.metgen module
--------------------------

.. automodule:: nsidc.metgen.metgen
:members:
:undoc-members:
:show-inheritance:

nsidc.metgen.netcdf\_reader module
----------------------------------

.. automodule:: nsidc.metgen.netcdf_reader
:members:
:undoc-members:
:show-inheritance:

Module contents
---------------

.. automodule:: nsidc.metgen
:members:
:undoc-members:
:show-inheritance:
18 changes: 18 additions & 0 deletions docs/source/nsidc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
nsidc package
=============

Subpackages
-----------

.. toctree::
:maxdepth: 4

nsidc.metgen

Module contents
---------------

.. automodule:: nsidc
:members:
:undoc-members:
:show-inheritance:
Loading

0 comments on commit 1041199

Please sign in to comment.