Add helper function to re-route missing references - #1
Conversation
| if module: | ||
| node.attributes["py:module"] = module | ||
|
|
||
| # FIXME: this is probably very brittle. do we need more info to rename? | ||
| target = target.split(".")[-1] | ||
| if "." not in module: | ||
| target = f"{module}.{target}" | ||
|
|
||
| node.attributes["reftarget"] = target |
There was a problem hiding this comment.
I don't have much faith in this module renaming here. It seemed to work in modepy, but I'll try to do another lib (pymbolic?) to see what else would be needed.
There was a problem hiding this comment.
Reworked this to be less weird, so hopefully it's fine now. I'll still try doing pymbolic as well.
| .. code:: python | ||
|
|
||
| autodoc_missing_reference_aliases = { | ||
| "numpy.float64": ("numpy", "numpy", "attr"), |
There was a problem hiding this comment.
I don't know if it's worth making this smarter?
We could probably get away with setting it to something like py:attr:numpy.float64 and start checking if it's in an intersphinx inventory, parsing the module name, etc.
There was a problem hiding this comment.
I'm OK leaving it to be as smart as it is now.
There was a problem hiding this comment.
I went ahead and made this a string to parse.. mostly because autodoc_type_aliases seems to work like that.
| .. code:: python | ||
|
|
||
| autodoc_missing_reference_aliases = { | ||
| "numpy.float64": ("numpy", "numpy", "attr"), |
There was a problem hiding this comment.
I'm OK leaving it to be as smart as it is now.
4e10e38 to
c53265d
Compare
|
I have a lovely use case for this FWIW: https://github.com/inducer/pytential/actions/runs/16602951915/job/46967330727?pr=267 😁 |
Switched the modepy PR inducer/modepy#130 to this and it seems to be working nicely! 🎉 |
c53265d to
a9a127d
Compare
a9a127d to
705effd
Compare
|
Heh. I just hit the bug you just fixed in pytential! 👍 This works nicely for me, I'd say it's ready to roll. |
Seems good to me too! |
|
Thanks for making this happen! |
xref: inducer/modepy#130
This also:
linkcode_resolvealso.rufffor linting and cleans up some small random things.