Skip to content

Commit

Permalink
Merge branch 'master' into to
Browse files Browse the repository at this point in the history
  • Loading branch information
keewis committed Jul 8, 2020
2 parents e3d3e72 + 3066aa4 commit a12acd3
Show file tree
Hide file tree
Showing 9 changed files with 168 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ instance/

# Sphinx documentation
docs/_build/
docs/generated/

# PyBuilder
target/
Expand Down
37 changes: 37 additions & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
.. currentmodule:: xarray

API reference
=============
This page contains a auto-generated summary of ``pint-xarray``'s API.


Dataset
-------
.. autosummary::
:toctree: generated/
:template: autosummary/accessor_method.rst

Dataset.pint.quantify
Dataset.pint.dequantify
Dataset.pint.to_base_units
Dataset.pint.to_system

DataArray
---------
.. autosummary::
:toctree: generated/
:template: autosummary/accessor_property.rst

DataArray.pint.magnitude
DataArray.pint.units
DataArray.pint.dimensionality
DataArray.pint.registry

.. autosummary::
:toctree: generated/
:template: autosummary/accessor_method.rst

DataArray.pint.quantify
DataArray.pint.dequantify
DataArray.pint.to
DataArray.pint.to_base_units
80 changes: 80 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Path setup --------------------------------------------------------------

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))

# -- Imports -----------------------------------------------------------------

import datetime as dt

import sphinx_autosummary_accessors

# need to import so accessors get registered
import pintxarray # noqa: F401

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

year = dt.datetime.now().year
project = "pint-xarray"
author = f"{project} developers"
copyright = f"{year}, {author}"


# -- General configuration ---------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
"sphinx.ext.intersphinx",
"sphinx.ext.autosummary",
"sphinx.ext.autodoc",
"sphinx.ext.napoleon",
"sphinx_autosummary_accessors",
]

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

# 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"]


# -- 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_rtd_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"]


# -- Extension configuration -------------------------------------------------

autosummary_generate = True
autodoc_typehints = "none"

napoleon_use_param = True
napoleon_use_rtype = True

# -- Options for intersphinx extension ---------------------------------------

# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {"https://docs.python.org/3/": None}
13 changes: 13 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.. accessors documentation master file, created by
sphinx-quickstart on Thu Jul 2 01:49:50 2020.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to accessors's documentation!
=====================================

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

api
6 changes: 6 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pint>=0.13
xarray>=0.15.1
sphinx>=3.0
sphinx_rtd_theme
nbsphinx
git+https://github.com/keewis/sphinx-autosummary-accessors
12 changes: 12 additions & 0 deletions pintxarray/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,13 @@
try:
from importlib.metadata import version
except ImportError:
from importlib_metadata import version

from .accessors import PintDataArrayAccessor, PintDatasetAccessor # noqa

try:
__version__ = version("pint-xarray")
except Exception:
# Local copy or not installed with setuptools.
# Disable minimum version checks on downstream libraries.
__version__ = "999"
6 changes: 4 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[build-system]
requires = ["setuptools >= 41", "wheel"]
build-backend = "setuptools.build_meta"
requires = ["setuptools >= 42", "wheel", "setuptools_scm[toml] >= 3.4"]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]
10 changes: 10 additions & 0 deletions readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2

build:
image: latest

python:
install:
- requirements: docs/requirements.txt
- method: pip
path: .
7 changes: 5 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
[metadata]
name = pint-xarray
version = 0.0.1
author = Tom Nicholas
author_email = tomnicholas1@googlemail.com
description = Physical units interface to xarray using Pint
Expand All @@ -9,7 +8,11 @@ url = https://github.com/TomNicholas/pint-xarray
[options]
packages = find:
python_requires = >=3.6
install_requires = numpy>=1.17.1; xarray>=0.15.1; pint>=0.13
install_requires =
numpy >= 1.17.1
xarray >= 0.15.1
pint >= 0.13
importlib-metadata; python_version < "3.8"

[flake8]
ignore =
Expand Down

0 comments on commit a12acd3

Please sign in to comment.