Skip to content

Conversation

@reint-fischer
Copy link
Contributor

@reint-fischer reint-fischer commented Nov 19, 2025

Fixes #2269

I have implemented sphinx-autoapi to generate the reference API based on the names made public by __all__ in init.py. This means that curating which classes and methods are included happens fully in this list, and no custom list is necessary (as was necessary in reference.rst, see #2269).

This also means however, that we have less control over the order and presentation done by autoapi. The classes, exceptions, and attributes are all documented on one page now, and their order is determined by the order in which they are imported, which is fixed by alphabetically by isort. It is also not possible to control the order of the autosummary at the top of the page, which is sorted by group. From what I can see, autoapi is still quite a small project, and most other projects have autodoc style API references like we had before.

I think these complications are challenging enough to suggest returning to our manually curated API by reverting #2270 . @VeckoTheGecko, and @erikvansebille , would you take a look at the docs build and tell me what you think?

Copy link
Member

@erikvansebille erikvansebille left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that the alphabetic order of items in the API list now feels a bit haphazard, so not ideal.

Comment on lines +128 to +137
# [tool.ruff.lint.per-file-ignores]
# # Ignore docstring rules everywhere except for the stable files (particleset.py, interpolators.py).
# "!src/parcels/{_core/particleset,interpolators}.py" = [
# # Missing docstring in public class
# "D101",
# # Missing docstring in public method
# "D102",
# # Missing docstring in public function
# "D103",
# ]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be removed completely?

@VeckoTheGecko
Copy link
Contributor

and their order is determined by the order in which they are imported, which is fixed by alphabetically by isort

Aha! Just found out isort can be turned off for a file (docs)

-
+# isort: skip_file
from importlib.metadata import version as _version

try:
    __version__ = _version("parcels")
except Exception:
    # Local copy or not installed with setuptools.
    __version__ = "unknown"

from parcels._core.basegrid import BaseGrid
from parcels._core.converters import (
    Geographic,
    GeographicPolar,
    GeographicPolarSquare,
    GeographicSquare,
    Unity,
)

I think with being able to manually sort this via re-ordering the import blocks, using autoapi becomes much more attractive

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

Set up API Reference for version 4

4 participants