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

improve the documentation on accessors #4657

Merged
merged 6 commits into from
Dec 13, 2020
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
10 changes: 7 additions & 3 deletions doc/internals.rst
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ xarray:

.. literalinclude:: examples/_code/accessor_example.py

In general, the only restriction on the accessor class is that the ``__init__`` method
must have a single parameter: the ``Dataset`` or ``DataArray`` object it is supposed
to work on.

This achieves the same result as if the ``Dataset`` class had a cached property
defined that returns an instance of your class:

Expand Down Expand Up @@ -173,9 +177,9 @@ for an open source library. In the future, we will maintain a list of accessors
and the libraries that implement them on this page.

To make documenting accessors with ``sphinx`` and ``sphinx.ext.autosummary``
easier, you can use `sphinx-ext-autosummary`_.
easier, you can use `sphinx-autosummary-accessors`_.

.. _sphinx-ext-autosummary: https://sphinx-autosummary-accessors.readthedocs.io/
.. _sphinx-autosummary-accessors: https://sphinx-autosummary-accessors.readthedocs.io/

.. _zarr_encoding:

Expand Down Expand Up @@ -226,4 +230,4 @@ re-open it directly with Zarr:

zgroup = zarr.open("rasm.zarr")
print(zgroup.tree())
dict(zgroup["Tair"].attrs)
dict(zgroup["Tair"].attrs)
2 changes: 2 additions & 0 deletions doc/whats-new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ Bug fixes

Documentation
~~~~~~~~~~~~~
- add information about requirements for accessor classes (:issue:`2788`, :pull:`4657`).
By `Justus Magin <https://github.com/keewis>`_.
- start a list of external I/O integrating with ``xarray`` (:issue:`683`, :pull:`4566`).
By `Justus Magin <https://github.com/keewis>`_.

Expand Down