Skip to content

Commit

Permalink
Merge pull request #33 from PlasmaFAIR/docs
Browse files Browse the repository at this point in the history
Add sphinx docs
  • Loading branch information
ZedThree authored Nov 18, 2024
2 parents 8c5db79 + c8b51bf commit 9c537ae
Show file tree
Hide file tree
Showing 22 changed files with 860 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Set the version of Python and other tools you might need
build:
os: ubuntu-20.04
tools:
python: "3.12"

# You can also specify other tool versions:
# nodejs: "16"
# rust: "1.55"
# golang: "1.17"

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/conf.py

# Optionally build your docs in additional formats such as PDF
# formats:
# - pdf

# Optionally declare the Python requirements required to build your docs
python:
install:
- method: pip
path: .
extra_requirements:
- docs
32 changes: 32 additions & 0 deletions docs/_templates/custom-class-template.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{{ fullname | escape | underline}}

.. currentmodule:: {{ module }}

.. autoclass:: {{ objname }}
:members:
:undoc-members:
:show-inheritance:

{% block methods %}
.. automethod:: __init__

{% if methods %}
.. rubric:: {{ _('Methods') }}

.. autosummary::
{% for item in methods %}
~{{ name }}.{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

{% block attributes %}
{% if attributes %}
.. rubric:: {{ _('Attributes') }}

.. autosummary::
{% for item in attributes %}
~{{ name }}.{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
66 changes: 66 additions & 0 deletions docs/_templates/custom-module-template.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{{ fullname | escape | underline}}

.. automodule:: {{ fullname }}

{% block attributes %}
{% if attributes %}
.. rubric:: {{ _('Module Attributes') }}

.. autosummary::
:toctree:
{% for item in attributes %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

{% block functions %}
{% if functions %}
.. rubric:: {{ _('Functions') }}

.. autosummary::
:toctree:
{% for item in functions %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

{% block classes %}
{% if classes %}
.. rubric:: {{ _('Classes') }}

.. autosummary::
:toctree:
:template: custom-class-template.rst
{% for item in classes %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

{% block exceptions %}
{% if exceptions %}
.. rubric:: {{ _('Exceptions') }}

.. autosummary::
:toctree:
{% for item in exceptions %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

{% block modules %}
{% if modules %}
.. rubric:: Modules

.. autosummary::
:toctree:
:template: custom-module-template.rst
:recursive:
{% for item in modules %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
10 changes: 10 additions & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
===============
API Reference
===============

.. autosummary::
:toctree: generated
:template: custom-module-template.rst
:recursive:

sdf_xarray
108 changes: 108 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# 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

from importlib.metadata import version as get_version

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

project = 'sdf-xarray'
copyright = '2024, Peter Hill, Joel Adams'
author = 'Peter Hill, Joel Adams'

# The full version, including alpha/beta/rc tags
release = get_version("sdf_xarray")
# Major.minor version
version = ".".join(release.split(".")[:2])

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

extensions = [
"sphinx.ext.napoleon",
"sphinx.ext.autodoc",
"sphinx.ext.autosummary",
"sphinx.ext.viewcode",
"sphinx.ext.coverage",
"sphinx.ext.intersphinx",
"sphinx.ext.todo",
"sphinx_autodoc_typehints",
]

autosummary_generate = True

# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]

# Numpy-doc config
napoleon_google_docstring = False
napoleon_numpy_docstring = True
napoleon_attr_annotations = True
napoleon_preprocess_types = True

# Enable numbered references
numfig = True

autodoc_type_aliases = {
"ArrayLike": "numpy.typing.ArrayLike",
}

autodoc_default_options = {
'ignore-module-all': True
}
autodoc_typehints = "description"
autodoc_class_signature = "mixed"

# The default role for text marked up `like this`
default_role = "any"

# Tell sphinx what the primary language being documented is.
primary_domain = "py"

# Tell sphinx what the pygments highlight language should be.
highlight_language = "python"

# Include "todo" directives in output
todo_include_todos = True

# -- 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 = "sphinx_book_theme"

# 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"]
html_static_path = []

html_theme_options = {
"repository_url": "https://github.com/PlasmaFAIR/sdf-xarray",
"repository_branch": "main",
"path_to_docs": "docs",
"use_edit_page_button": True,
"use_repository_button": True,
"use_issues_button": True,
"home_page_in_toc": False,
}

pygments_style = "sphinx"

# -- Options for intersphinx extension ---------------------------------------
# https://www.sphinx-doc.org/en/master/usage/extensions/intersphinx.html#configuration

intersphinx_mapping = {
"python": ("https://docs.python.org/3", None),
"numpy": ("https://numpy.org/doc/stable", None),
"scipy": ("https://docs.scipy.org/doc/scipy", None),
"xarray": ("https://docs.xarray.dev/en/latest", None),
}
38 changes: 38 additions & 0 deletions docs/generated/sdf_xarray.SDFBackendArray.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
sdf\_xarray.SDFBackendArray
===========================

.. currentmodule:: sdf_xarray

.. autoclass:: SDFBackendArray
:members:
:undoc-members:
:show-inheritance:


.. automethod:: __init__


.. rubric:: Methods

.. autosummary::

~SDFBackendArray.__init__
~SDFBackendArray.get_array
~SDFBackendArray.get_duck_array





.. rubric:: Attributes

.. autosummary::

~SDFBackendArray.datastore
~SDFBackendArray.dtype
~SDFBackendArray.shape
~SDFBackendArray.variable_name
~SDFBackendArray.ndim
~SDFBackendArray.size


42 changes: 42 additions & 0 deletions docs/generated/sdf_xarray.SDFDataStore.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
sdf\_xarray.SDFDataStore
========================

.. currentmodule:: sdf_xarray

.. autoclass:: SDFDataStore
:members:
:undoc-members:
:show-inheritance:


.. automethod:: __init__


.. rubric:: Methods

.. autosummary::

~SDFDataStore.__init__
~SDFDataStore.acquire_context
~SDFDataStore.close
~SDFDataStore.get_attrs
~SDFDataStore.get_dimensions
~SDFDataStore.get_encoding
~SDFDataStore.get_variables
~SDFDataStore.load
~SDFDataStore.open





.. rubric:: Attributes

.. autosummary::

~SDFDataStore.lock
~SDFDataStore.drop_variables
~SDFDataStore.keep_particles
~SDFDataStore.ds


37 changes: 37 additions & 0 deletions docs/generated/sdf_xarray.SDFEntrypoint.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
sdf\_xarray.SDFEntrypoint
=========================

.. currentmodule:: sdf_xarray

.. autoclass:: SDFEntrypoint
:members:
:undoc-members:
:show-inheritance:


.. automethod:: __init__


.. rubric:: Methods

.. autosummary::

~SDFEntrypoint.__init__
~SDFEntrypoint.guess_can_open
~SDFEntrypoint.open_dataset
~SDFEntrypoint.open_datatree
~SDFEntrypoint.open_groups_as_dict





.. rubric:: Attributes

.. autosummary::

~SDFEntrypoint.description
~SDFEntrypoint.open_dataset_parameters
~SDFEntrypoint.url


Loading

0 comments on commit 9c537ae

Please sign in to comment.