Skip to content

Commit

Permalink
Automatically generate API reference docs (#1918)
Browse files Browse the repository at this point in the history
* Automatically generate API reference

* Remove old automodapi refs

* Fix some doc warnings

* Skip private modules

* Skip all private objects

* Add API ref page for zarr namespace

* Fix import errors with zarr.v2

* Remove old numpydoc validation

* Use groupwise member order

---------

Co-authored-by: Davis Bennett <davis.v.bennett@gmail.com>
  • Loading branch information
dstansby and d-v-b authored Jun 24, 2024
1 parent ea6b441 commit 11a959a
Show file tree
Hide file tree
Showing 20 changed files with 48 additions and 229 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ coverage.xml

# Sphinx documentation
docs/_build/
docs/_autoapi/

# PyBuilder
target/
Expand Down
22 changes: 0 additions & 22 deletions docs/api.rst

This file was deleted.

16 changes: 0 additions & 16 deletions docs/api/attrs.rst

This file was deleted.

23 changes: 0 additions & 23 deletions docs/api/codecs.rst

This file was deleted.

14 changes: 0 additions & 14 deletions docs/api/convenience.rst

This file was deleted.

5 changes: 0 additions & 5 deletions docs/api/core.rst

This file was deleted.

15 changes: 0 additions & 15 deletions docs/api/creation.rst

This file was deleted.

41 changes: 0 additions & 41 deletions docs/api/hierarchy.rst

This file was deleted.

7 changes: 7 additions & 0 deletions docs/api/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
API Reference
=============

.. toctree::
:maxdepth: 1

zarr
5 changes: 0 additions & 5 deletions docs/api/n5.rst

This file was deleted.

50 changes: 0 additions & 50 deletions docs/api/storage.rst

This file was deleted.

6 changes: 0 additions & 6 deletions docs/api/sync.rst

This file was deleted.

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

.. autoapimodule:: zarr
:members:
19 changes: 12 additions & 7 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,17 @@

import os
import sys
from typing import Any

import sphinx.application

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
import zarr
import sphinx

# 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
Expand All @@ -42,19 +46,21 @@
"sphinx.ext.autosummary",
"sphinx.ext.viewcode",
"sphinx.ext.intersphinx",
"sphinx_automodapi.automodapi",
'autoapi.extension',
"numpydoc",
"sphinx_issues",
"sphinx_copybutton",
"sphinx_design",
]

numpydoc_show_class_members = False
numpydoc_class_members_toctree = False
issues_github_path = "zarr-developers/zarr-python"

automodapi_inheritance_diagram = False
automodapi_toctreedirnm = "_autoapi"
autoapi_dirs = ['../src/zarr']
autoapi_add_toctree_entry = False
autoapi_generate_api_docs = False
autoapi_member_order = "groupwise"
autoapi_root = "api"


# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]
Expand Down Expand Up @@ -166,8 +172,7 @@
html_logo = "_static/logo1.png"


# Add custom css
def setup(app):
def setup(app: sphinx.application.Sphinx) -> None:
app.add_css_file("custom.css")


Expand Down
4 changes: 2 additions & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Zarr-Python

getting_started
tutorial
api
api/index
spec
release
license
Expand Down Expand Up @@ -80,7 +80,7 @@ Zarr is a file storage format for chunked, compressed, N-dimensional arrays base

+++

.. button-ref:: api
.. button-ref:: api/index
:expand:
:color: dark
:click-parent:
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jupyter = [
docs = [
'sphinx',
'sphinx-autobuild>=2021.3.14',
'sphinx-automodapi',
'sphinx-autoapi',
'sphinx_design',
'sphinx-issues',
'sphinx-copybutton',
Expand Down Expand Up @@ -146,7 +146,7 @@ features = ['docs']

[tool.hatch.envs.docs.scripts]
build = "cd docs && make html"
serve = "sphinx-autobuild docs docs/_build --ignore 'docs/_autoapi/**/*' --host 0.0.0.0"
serve = "sphinx-autobuild docs docs/_build --host 0.0.0.0"

[tool.ruff]
line-length = 100
Expand Down
Loading

0 comments on commit 11a959a

Please sign in to comment.