Skip to content

Conversation

@reint-fischer
Copy link
Contributor

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

This PR adds API reference links throughout the documentation, which resolves a TODO note.

Since we use sphinx autoapi (#2395) to build the API reference, and MyST to parse markdown (#1342), we should use the {py:obj} role to refer to parcels objects (see executablebooks/discussions/q-a#1169)

e.g.:

{py:obj}`parcels.FieldSet`

Unfortunately, I am only able to refer to classes, and not their methods, i.e. the following doesn’t create the link to the method:

{py:meth}`parcels.ParticleSet.execute()`

See also: https://www.sphinx-doc.org/en/master/usage/domains/python.html#role-py-meth

Work done (contributing to #2449) :

@VeckoTheGecko
Copy link
Contributor

VeckoTheGecko commented Jan 5, 2026

Unfortunately, I am only able to refer to classes, and not their methods, i.e. the following doesn’t create the link to the method:

I dug a bit deeper into this, I also couldn't get it to link to methods either with the current setup - though I think that's due to our current config.

I tested the following

## works
{py:obj}`parcels.ParticleSet` 
{py:class}`parcels.ParticleSet`

## broken
{py:meth}`parcels.ParticleSet.execute` 
{py:meth}`parcels._core.particleset.ParticleSet.execute` 
{py:obj}`download_example_dataset`

On the https://myst-parser.readthedocs.io/en/latest/syntax/code_and_apis.html#sphinx-autodoc2 page it has the following example

- {py:obj}`myst_parser.sphinx_ext.main.setup_sphinx`
- [](#myst_parser.sphinx_ext.main.setup_sphinx)

which properly links to a function. I think the solution might be in the fact that they're using autodoc2 instead of autodoc (maybe the way that generates references is different to what we have).

Should I make this into a separate issue to be pursued later @erikvansebille ? I think cross linking with the classes is suitable for now/a bit lower on the chopping block

@VeckoTheGecko

This comment was marked as outdated.

@erikvansebille
Copy link
Member

Should I make this into a separate issue to be pursued later @erikvansebille ? I think cross linking with the classes is suitable for now/a bit lower on the chopping block

Yep, I don't think this is a priority now

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.

4 participants