Skip to content

Commit

Permalink
add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
aerorahul committed Jul 6, 2023
1 parent 5d60cb8 commit 01cb76d
Show file tree
Hide file tree
Showing 12 changed files with 208 additions and 3 deletions.
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,6 @@ dmypy.json
# Pyre type checker
.pyre/

# Sphinx documentation
docs/_build/

# Editor backup files (Emacs, vim)
*~
*.sw[a-p]
Expand Down
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)
12 changes: 12 additions & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
API
===

.. toctree::
:maxdepth: 2

yaml_file
timetools
jinja
logger


34 changes: 34 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

import os
import sys
sys.path.insert(0, os.path.abspath('.'))

project = 'wxflow'
copyright = '2023, NOAA/NWS/NCEP/EMC'
author = 'NOAA/NWS/NCEP/EMC'

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = [
"sphinx.ext.autodoc",
]

templates_path = ['_templates']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']



# -- 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_path = ["_themes", ]
html_static_path = ['_static']
58 changes: 58 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
.. wxflow documentation master file, created by
sphinx-quickstart on Thu Jul 6 11:20:05 2023.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
wxflow
======

.. image:: https://img.shields.io/pypi/wxflow
:target: https://pypi.org/project/wxflow/
:alt: PyPI
.. image:: https://github.com/NOAA-EMC/wxflow/workflows/pynorms/badge.svg
:target: https://github.com/NOAA-EMC/wxflow/actions/workflows/pynorms.yaml
:alt: pynorms
.. image:: https://github.com/NOAA-EMC/wxflow/workflows/pytests/badge.svg
:target: https://github.com/NOAA-EMC/wxflow/actions/workflows/pytests.yaml
:alt: pytests

A Python library of common tools used in weather workflows.

Installation
------------

.. code-block:: bash
pip install wxflow
Description
-----------

wxflow is a Python library of common tools used in weather workflows. It is
designed to be used in NWP applications such as GFS, GEFS, and RRFS workflows. Some of the tools
included in wxflow are:

- **logger**: A generic program-wide logging tool.
- **yamltools**: A YAML parser that allows loading of nested yaml files and resolves environment variables.
- **timetools**: A collection of datetime tools that allows for easy transformation between the various formats of datetime used in the applications.
- **executable**: A tool that allows for running command line programs within the python environment.
executables.
- **jinja**: A jinja tool that allows for the use of Jinja2 templates with filters.
- **task**: A task tool that allows for the use of a YAML file to configure
tasks.


.. toctree::
:maxdepth: 2
:caption: Contents:

API Reference <api>



Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
6 changes: 6 additions & 0 deletions docs/jinja.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.. currentmodule:: wxflow

.. autoclass:: Jinja
:members:
:show-inheritance:
:inherited-members:
11 changes: 11 additions & 0 deletions docs/logger.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.. currentmodule:: wxflow

.. autoclass:: Logger
:members:
:show-inheritance:
:inherited-members:
.. autoclass:: ColoredFormatter
:members:
:show-inheritance:
:inherited-members:
.. autofunction:: logit
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
2 changes: 2 additions & 0 deletions docs/requirements_docs.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
sphinx
sphinx-autobuild
18 changes: 18 additions & 0 deletions docs/timetools.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.. currentmodule:: wxflow

.. autofunction:: to_datetime
.. autofunction:: to_timedelta
.. autofunction:: datetime_to_YMDH
.. autofunction:: datetime_to_YMD
.. autofunction:: datetime_to_JDAY
.. autofunction:: timedelta_to_HMS
.. autofunction:: strftime
.. autofunction:: strptime
.. autofunction:: to_YMDH
.. autofunction:: to_YMD
.. autofunction:: to_JDAY
.. autofunction:: to_julian
.. autofunction:: to_isotime
.. autofunction:: to_fv3time
.. autofunction:: add_to_datetime
.. autofunction:: add_to_timedelta
11 changes: 11 additions & 0 deletions docs/yaml_file.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.. currentmodule:: wxflow

.. autoclass:: YAMLFile
:members: save, dump, as_dict
:show-inheritance:
.. autofunction:: parse_yaml
.. autofunction:: parse_yamltmpl
.. autofunction:: parse_j2yaml
.. autofunction:: save_as_yaml
.. autofunction:: dump_as_yaml
.. autofunction:: vanilla_yaml
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ where=src

[options.extras_require]
dev = pytest>=7; pytest-cov>=3
docs = sphinx>=4 sphinx_rtd_theme>=0.5

[green]
file-pattern = test_*.py
Expand Down

0 comments on commit 01cb76d

Please sign in to comment.