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

Resolve Brightway Package Docstring Cross-Referencing Issues #112

Open
michaelweinold opened this issue Jul 29, 2023 · 1 comment
Open

Comments

@michaelweinold
Copy link
Contributor

During investigation of #111 I found that Sphinx currently throws a number of warnings related to the use of the :ref: role in the Python function docstrings. Some examples:

api/bw2data/backends/single_file/proxies/index.rst:73: WARNING: undefined label: 'activity'
api/bw2data/data_store/index.rst:27: WARNING: undefined label: 'serialized-dict'
api/bw2data/data_store/index.rst:134: WARNING: undefined label: 'mapping'
api/bw2data/data_store/index.rst:134: WARNING: undefined label: 'geomapping'
api/bw2data/data_store/index.rst:140: WARNING: undefined label: 'processing-data'

I investigated two cases:

  1. geomapping

The :ref: that throws the error is used in

class ProcessedDataStore in bw2data/data_store.py:

This method takes the entire dataset, and loads objects to :ref:`mapping` or :ref:`geomapping` as needed.

aliased at

bw2data/meta.py:

geomapping = GeoMapping()

and originally defined as class GeoMapping() in bw2data/meta.py.

In this case: We should investigate if/how Sphinx can work with aliases of this nature (this is actually related to the larger discussion here: #83 (comment)).

  1. serialized-dict

The :ref: that throws the error is used in

class DataStore in bw2data/data_store.py:

* **metadata**: A :ref:`serialized-dict` instance, e.g. ``databases`` or ``methods``.

and originally defined as class SerializedDict() in bw2data/serialization.py.

In this case: Since serialized-dict is used only once in bw2data and only in a docstring, it seems that it was never aliased to SerializedDict.

We should clear this up because:

  1. I didn't find a way to suppress the Sphinx warnings related to broken :ref: use.
  2. I don't want to find a way to suppress the Sphinx warnings related to broken :ref: use, since this would likely disallow for the planned use of the linkcheck builder: Check for Dead Links #95
  3. The number of bad uses of :ref: is limited in scope.
@michaelweinold
Copy link
Contributor Author

...@cmutel, this could be a job for @Cerebrovinny later this year - let's discuss this at/around Brightcon.

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

No branches or pull requests

2 participants