Skip to content

Commit b221cb0

Browse files
authored
initial documentation (#13)
* properly configure isort * initial documentation setup * remove the not-yet-implemented Dataset.pint.to * add RTD configuration * comment out the html_static_path setting * move the extension settings to the proper section
1 parent 7d9fe9d commit b221cb0

File tree

7 files changed

+157
-1
lines changed

7 files changed

+157
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ instance/
7070

7171
# Sphinx documentation
7272
docs/_build/
73+
docs/generated/
7374

7475
# PyBuilder
7576
target/

docs/api.rst

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
.. currentmodule:: xarray
2+
3+
API reference
4+
=============
5+
This page contains a auto-generated summary of ``pint-xarray``'s API.
6+
7+
8+
Dataset
9+
-------
10+
.. autosummary::
11+
:toctree: generated/
12+
:template: autosummary/accessor_method.rst
13+
14+
Dataset.pint.quantify
15+
Dataset.pint.dequantify
16+
Dataset.pint.to_base_units
17+
Dataset.pint.to_system
18+
19+
DataArray
20+
---------
21+
.. autosummary::
22+
:toctree: generated/
23+
:template: autosummary/accessor_property.rst
24+
25+
DataArray.pint.magnitude
26+
DataArray.pint.units
27+
DataArray.pint.dimensionality
28+
DataArray.pint.registry
29+
30+
.. autosummary::
31+
:toctree: generated/
32+
:template: autosummary/accessor_method.rst
33+
34+
DataArray.pint.quantify
35+
DataArray.pint.dequantify
36+
DataArray.pint.to
37+
DataArray.pint.to_base_units

docs/conf.py

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
#
3+
# This file only contains a selection of the most common options. For a full
4+
# list see the documentation:
5+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
6+
7+
# -- Path setup --------------------------------------------------------------
8+
9+
# If extensions (or modules to document with autodoc) are in another directory,
10+
# add these directories to sys.path here. If the directory is relative to the
11+
# documentation root, use os.path.abspath to make it absolute, like shown here.
12+
#
13+
# import os
14+
# import sys
15+
# sys.path.insert(0, os.path.abspath('.'))
16+
17+
# -- Imports -----------------------------------------------------------------
18+
19+
import datetime as dt
20+
21+
import sphinx_autosummary_accessors
22+
23+
# need to import so accessors get registered
24+
import pintxarray # noqa: F401
25+
26+
# -- Project information -----------------------------------------------------
27+
28+
year = dt.datetime.now().year
29+
project = "pint-xarray"
30+
author = f"{project} developers"
31+
copyright = f"{year}, {author}"
32+
33+
34+
# -- General configuration ---------------------------------------------------
35+
36+
# Add any Sphinx extension module names here, as strings. They can be
37+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
38+
# ones.
39+
extensions = [
40+
"sphinx.ext.intersphinx",
41+
"sphinx.ext.autosummary",
42+
"sphinx.ext.autodoc",
43+
"sphinx.ext.napoleon",
44+
"sphinx_autosummary_accessors",
45+
]
46+
47+
# Add any paths that contain templates here, relative to this directory.
48+
templates_path = ["_templates", sphinx_autosummary_accessors.templates_path]
49+
50+
# List of patterns, relative to source directory, that match files and
51+
# directories to ignore when looking for source files.
52+
# This pattern also affects html_static_path and html_extra_path.
53+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
54+
55+
56+
# -- Options for HTML output -------------------------------------------------
57+
58+
# The theme to use for HTML and HTML Help pages. See the documentation for
59+
# a list of builtin themes.
60+
#
61+
html_theme = "sphinx_rtd_theme"
62+
63+
# Add any paths that contain custom static files (such as style sheets) here,
64+
# relative to this directory. They are copied after the builtin static files,
65+
# so a file named "default.css" will overwrite the builtin "default.css".
66+
# html_static_path = ["_static"]
67+
68+
69+
# -- Extension configuration -------------------------------------------------
70+
71+
autosummary_generate = True
72+
autodoc_typehints = "none"
73+
74+
napoleon_use_param = True
75+
napoleon_use_rtype = True
76+
77+
# -- Options for intersphinx extension ---------------------------------------
78+
79+
# Example configuration for intersphinx: refer to the Python standard library.
80+
intersphinx_mapping = {"https://docs.python.org/3/": None}

docs/index.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
.. accessors documentation master file, created by
2+
sphinx-quickstart on Thu Jul 2 01:49:50 2020.
3+
You can adapt this file completely to your liking, but it should at least
4+
contain the root `toctree` directive.
5+
6+
Welcome to accessors's documentation!
7+
=====================================
8+
9+
.. toctree::
10+
:maxdepth: 2
11+
:caption: Contents:
12+
13+
api

docs/requirements.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pint>=0.13
2+
xarray>=0.15.1
3+
sphinx>=3.0
4+
sphinx_rtd_theme
5+
nbsphinx
6+
git+https://github.com/keewis/sphinx-autosummary-accessors

readthedocs.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: 2
2+
3+
build:
4+
image: latest
5+
6+
python:
7+
install:
8+
- requirements: docs/requirements.txt
9+
- method: pip
10+
path: .

setup.cfg

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,13 @@ ignore =
2323
# line break before binary operator
2424
W503
2525
exclude=
26-
.eggs
26+
.eggs
27+
28+
[isort]
29+
default_section = THIRDPARTY
30+
known_first_party = pintxarray
31+
multi_line_output = 3
32+
include_trailing_comma = True
33+
force_grid_wrap = 0
34+
use_parentheses = True
35+
line_length = 88

0 commit comments

Comments
 (0)