Adjust the regex to accept source of a node without a path #24
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi, I appreciate the work done in this extension, I recently integrated it in NVIDIA DALI docs.
In DALI, we generated our main API submodule tree in runtime. We have a
nvidia/dali/fn/__init__.py
which is the entry point fornvidia.dali.fn
API, but submodules likenvidia.dali.fn.decoders
don't have corresponding files and are created in runtime (when library is loaded we query the C++ backend for that structure).When I logged the
source
member of the sphinx node corresponding to the functions in those modules, for the top level API I get:but for the submodule I see just:
Missing the
/path/to/file.py:
part (note the:
is missing)I guess it's similar to:
The regex in this line for the
missing-reference
resolver assumes that the:
is there: https://github.com/sqlalchemyorg/sphinx-paramlinks/blob/main/sphinx_paramlinks/sphinx_paramlinks.py#L305I was able to work around this by creating a
missing-reference
resolver with higher priority to inject:
into thesource
member before calling the sphinx_paramlinks back: NVIDIA/DALI#5723 - but in the end I realized it's easier toinject the full absolute reference to the parameter while processing the docstring in
autodoc-process-docstring
hook: NVIDIA/DALI#5725(Our
autodoc-process-docstring
hook detects parameters surrounded by single backticks, checks if they appear in the current object's signature, and if so appends the:paramref:
directive ahead of them, allowing more concise Python docstring and clickable links for parameter references in Sphinx).Although I worked around the problem I still think someone else might hit it, so I propose to relax the regex.