Skip to content

Commit

Permalink
Merge pull request #1638 from hgrecco/develop
Browse files Browse the repository at this point in the history
 Improved the API documentation to avoid breaking intersphinx
  • Loading branch information
hgrecco authored Oct 27, 2022
2 parents cf1a802 + 52b616e commit 7e82013
Show file tree
Hide file tree
Showing 31 changed files with 463 additions and 200 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ jobs:
fail-fast: false
matrix:
python-version: [3.8, 3.9, "3.10", "3.11"]
numpy: [ "numpy>=1.19,<2.0.0" ]
numpy: [null, "numpy>=1.19,<2.0.0" ]
runs-on: macos-latest

env:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
17 changes: 17 additions & 0 deletions docs/advanced/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Advanced Guides
===============

Pint contains some useful and fun feature. You will find them here.

.. toctree::
:maxdepth: 2
:hidden:

performance
serialization
defining
wrapping
measurement
pitheorem
currencies
custom-registry-class
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
.. _serialization:


Serialization
=============
Expand Down
File renamed without changes.
15 changes: 0 additions & 15 deletions docs/advanced_guides.rst

This file was deleted.

71 changes: 0 additions & 71 deletions docs/api.rst

This file was deleted.

70 changes: 70 additions & 0 deletions docs/api/base.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@

Base API
========

.. currentmodule:: pint


These are the classes, exceptions and functions that you will most likely use.


Most important classes
----------------------

.. autoclass:: UnitRegistry
:members:
:exclude-members: Quantity, Unit, Measurement, Group, Context, System

.. autoclass:: Quantity
:members:
:inherited-members:

.. autoclass:: Unit
:members:
:inherited-members:

.. autoclass:: Measurement
:members:
:inherited-members:

Exceptions and warnings
-----------------------

.. autoexception:: PintError
:members:

.. autoexception:: DefinitionSyntaxError
:members:

.. autoexception:: LogarithmicUnitCalculusError
:members:

.. autoexception:: DimensionalityError
:members:

.. autoexception:: OffsetUnitCalculusError
:members:

.. autoexception:: RedefinitionError
:members:

.. autoexception:: UndefinedUnitError
:members:

.. autoexception:: UnitStrippedWarning
:members:


Sharing registry among packages
-------------------------------

.. autofunction:: get_application_registry
.. autofunction:: set_application_registry

Other functions
---------------

.. autofunction:: formatter
.. autofunction:: register_unit_format
.. autofunction:: pi_theorem
.. autoclass:: Context
45 changes: 45 additions & 0 deletions docs/api/facets.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
API facets reference
====================

Registry functionality is divided into facet. Each provides classes and functions
specific to a particular purpose. They expose at least a Registry, and in certain
cases also a Quantity, Unit and other objects.

The default UnitRegistry inherits from all of them.


.. automodule:: pint.facets.plain
:members:
:exclude-members: Quantity, Unit, Measurement, Group, Context, System

.. automodule:: pint.facets.nonmultiplicative
:members:
:exclude-members: Quantity, Unit, Measurement, Group, Context, System

.. automodule:: pint.facets.formatting
:members:
:exclude-members: Quantity, Unit, Measurement, Group, Context, System

.. automodule:: pint.facets.numpy
:members:
:exclude-members: Quantity, Unit, Measurement, Group, Context, System

.. automodule:: pint.facets.dask
:members:
:exclude-members: Quantity, Unit, Measurement, Group, Context, System

.. automodule:: pint.facets.measurement
:members:
:exclude-members: Quantity, Unit, Measurement, Group, Context, System

.. automodule:: pint.facets.group
:members:
:exclude-members: Quantity, Unit, Measurement, Group, Context, System

.. automodule:: pint.facets.system
:members:
:exclude-members: Quantity, Unit, Measurement, Group, Context, System

.. automodule:: pint.facets.context
:members:
:exclude-members: Quantity, Unit, Measurement, Group, Context, System
10 changes: 10 additions & 0 deletions docs/api/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
API reference
==============

.. toctree::
:maxdepth: 1
:hidden:

base
specific
facets
44 changes: 44 additions & 0 deletions docs/api/specific.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
Specific API
============

These are the classes, exceptions and functions that you will use if you need
to dig deeper into Pint or develop Pint.


.. automodule:: pint.babel_names
:members:

.. automodule:: pint.compat
:members:

.. automodule:: pint.converters
:members:

.. automodule:: pint.definitions
:members:

.. automodule:: pint.errors
:members:

.. automodule:: pint.formatting
:members:

.. automodule:: pint.matplotlib
:members:

.. automodule:: pint.pint_eval
:members:

.. automodule:: pint.registry
:members:
:exclude-members: Quantity, Unit, Measurement, Group, Context, System, UnitRegistry

.. automodule:: pint.registry_helpers
:members:

.. automodule:: pint.testing
:members:

.. automodule:: pint.util
:members:
:exclude-members: Unit
12 changes: 7 additions & 5 deletions docs/dev/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,16 @@ Extension Packages
------------------

Pint naturally integrates with other libraries in the scientific Python ecosystem, and
a small number of
`extension/compatibility packages<numpy.html#Compatibility-Packages>`_ have arisen to
aid in compatibility between certain packages. Pint's rule of thumb for integration
a small _`ecosystem` have arisen to aid in compatibility between certain packages
allowing to build an

Pint's rule of thumb for integration
features that work best as an extension package versus direct inclusion in Pint is:

* Extension (separate packages)

* Duck array types that wrap Pint (come above Pint in
`the type casting hierarchy<numpy.html#Technical-Commentary>`_)
* Duck array types that wrap Pint (come above Pint
in :ref:`the type casting hierarchy <_numpy#technical-commentary>`

* Uses features independent/on top of the libraries

Expand Down Expand Up @@ -143,3 +144,4 @@ features that work best as an extension package versus direct inclusion in Pint
.. _flake8: https://flake8.pycqa.org/en/latest/
.. _pytest: https://docs.pytest.org/en/stable/
.. _sphinx: https://www.sphinx-doc.org/en/master/
.. _`extension/compatibility packages`:
File renamed without changes.
File renamed without changes.
7 changes: 4 additions & 3 deletions docs/getting_started.rst → docs/getting/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ That's all! You can check that Pint is correctly installed by starting up python
:maxdepth: 2
:hidden:

user/overview
user/tutorial
user/faq
overview
tutorial
pint-in-your-projects
faq
File renamed without changes.
Loading

0 comments on commit 7e82013

Please sign in to comment.