Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ord_schema API docs #642

Merged
merged 5 commits into from
Jul 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,16 @@ version: 2
# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/conf.py
fail_on_warning: true
fail_on_warning: false

build:
os: ubuntu-20.04
tools:
python: "3.9"

# Optionally set the version of Python and requirements required to build your docs
python:
version: 3.7
install:
- requirements: docs/requirements.txt
- method: pip
path: .
extra_requirements:
- docs
2 changes: 1 addition & 1 deletion docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?= -W
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = _build
Expand Down
1 change: 1 addition & 0 deletions docs/_templates/README
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Copied from /home/skearnes/miniconda3/lib/python3.9/site-packages/sphinx/templates/apidoc
55 changes: 55 additions & 0 deletions docs/_templates/package.rst_t
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{%- macro automodule(modname, options) -%}
.. automodule:: {{ modname }}
{%- for option in options %}
:{{ option }}:
{%- endfor %}
{%- endmacro %}

{%- macro toctree(docnames) -%}
.. toctree::
:maxdepth: {{ maxdepth }}
{% for docname in docnames %}
{{ docname }}
{%- endfor %}
{%- endmacro %}

{%- if is_namespace %}
{{- [pkgname, "namespace"] | join(" ") | e | heading }}
{% else %}
{{- [pkgname] | join(" ") | e | heading }}
{% endif %}

{%- if is_namespace %}
.. py:module:: {{ pkgname }}
{% endif %}

{%- if modulefirst and not is_namespace %}
{{ automodule(pkgname, automodule_options) }}
{% endif %}

{%- if subpackages %}
Subpackages
-----------

{{ toctree(subpackages) }}
{% endif %}

{%- if submodules %}
{% if separatemodules %}
{{ toctree(submodules) }}
{% else %}
{%- for submodule in submodules %}
{% if show_headings %}
{{- [submodule] | join(" ") | e | heading(2) }}
{% endif %}
{{ automodule(submodule, automodule_options) }}
{% endfor %}
{%- endif %}
{%- endif %}

{%- if not modulefirst and not is_namespace %}
Module contents
---------------

{{ automodule(pkgname, automodule_options) }}
{% endif %}
8 changes: 7 additions & 1 deletion docs/build_docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ set -ex
# --doc_out=. \
# ord-schema/proto/reaction.proto ord-schema/proto/dataset.proto

# Generate RST for ord-schema.
sphinx-apidoc -fTM -o ord_schema -t _templates ../ord_schema \
"../ord_schema/*_test.py" \
"../ord_schema/*/*_test.py" \
"../ord_schema/proto/" \
"../ord_schema/scripts/"

# Run sphinx.
pip install -Ur requirements.txt
make clean html
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))
from recommonmark import transform

# -- Project information -----------------------------------------------------

project = "Open Reaction Database"
copyright = "2020 Open Reaction Database Project Authors"
copyright = "2020–2022 Open Reaction Database Project Authors"
author = "Open Reaction Database Project Authors"

# -- General configuration ---------------------------------------------------
Expand All @@ -27,6 +26,7 @@
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
"sphinx.ext.napoleon",
"sphinx_tabs.tabs",
]

Expand Down
82 changes: 0 additions & 82 deletions docs/developer/editor.rst

This file was deleted.

6 changes: 3 additions & 3 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ underrepresented areas).

.. toctree::
:hidden:
:maxdepth: 2
:caption: Developers
:caption: API Documentation

ord_schema/ord_schema

developer/editor
24 changes: 24 additions & 0 deletions docs/ord_schema/ord_schema.macros.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
ord\_schema.macros
==================

.. automodule:: ord_schema.macros
:members:
:undoc-members:
:show-inheritance:


ord\_schema.macros.solutions
----------------------------

.. automodule:: ord_schema.macros.solutions
:members:
:undoc-members:
:show-inheritance:

ord\_schema.macros.workups
--------------------------

.. automodule:: ord_schema.macros.workups
:members:
:undoc-members:
:show-inheritance:
72 changes: 72 additions & 0 deletions docs/ord_schema/ord_schema.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
ord\_schema
===========

.. automodule:: ord_schema
:members:
:undoc-members:
:show-inheritance:

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

.. toctree::
:maxdepth: 4

ord_schema.macros


ord\_schema.frozen\_message
---------------------------

.. automodule:: ord_schema.frozen_message
:members:
:undoc-members:
:show-inheritance:

ord\_schema.message\_helpers
----------------------------

.. automodule:: ord_schema.message_helpers
:members:
:undoc-members:
:show-inheritance:

ord\_schema.resolvers
---------------------

.. automodule:: ord_schema.resolvers
:members:
:undoc-members:
:show-inheritance:

ord\_schema.templating
----------------------

.. automodule:: ord_schema.templating
:members:
:undoc-members:
:show-inheritance:

ord\_schema.units
-----------------

.. automodule:: ord_schema.units
:members:
:undoc-members:
:show-inheritance:

ord\_schema.updates
-------------------

.. automodule:: ord_schema.updates
:members:
:undoc-members:
:show-inheritance:

ord\_schema.validations
-----------------------

.. automodule:: ord_schema.validations
:members:
:undoc-members:
:show-inheritance:
6 changes: 0 additions & 6 deletions docs/requirements.txt

This file was deleted.

7 changes: 7 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@
"xlwt>=1.3.0",
],
extras_require={
"docs": [
"ipython>=7.18.1",
"Pygments>=2.7.2",
"sphinx>=3.3.1",
"sphinx-rtd-theme>=0.5.0",
"sphinx-tabs>=1.3.0",
],
"examples": [
"glob2>=0.7",
"matplotlib>=3.3.4",
Expand Down