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

Apply qualname_overrides in more circumstances #191

Merged
merged 6 commits into from
Jan 16, 2025

Conversation

flying-sheep
Copy link
Collaborator

Fixes doc problems in scverse/anndata#1726

Copy link

codecov bot commented Jan 14, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (684834c) to head (9800e53).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #191   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           15        15           
  Lines          456       465    +9     
=========================================
+ Hits           456       465    +9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@flying-sheep flying-sheep changed the title Add more qualname resolve Apply qualname_overrides in more circumstances Jan 14, 2025
Copy link

@ilan-gold ilan-gold left a comment

Choose a reason for hiding this comment

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

I think this update should be documented https://icb-scanpydoc.readthedocs-hosted.com/en/latest/scanpydoc.elegant_typehints.html#module-scanpydoc.elegant_typehints ? Or no?

Also, just to be clear, this enables qualname_overrides to interact with intersphinx mappings in a way that affects how the doc is fetched, and not just rendered? Is that right?

@flying-sheep
Copy link
Collaborator Author

flying-sheep commented Jan 16, 2025

I think this update should be documented

The docs already say “It defines a configuration value qualname_overrides for conf.py that overrides automatically created links”.

This PR just makes that work more reliably.

Also, just to be clear, this enables qualname_overrides to interact with intersphinx mappings in a way that affects how the doc is fetched, and not just rendered? Is that right?

Sphinx fires the missing-reference event each time Sphinx can’t resolve a reference. The reference gets passed a pending_xref node that it’s supposed to replace with a reference node (i.e. a link), or signal that it failed to do so.

When intersphinx is enabled, it has an event handler for that event. If it fails, other event handlers for that event with a higher priority value are run (yeah higher priority value means lower priority).

This PR adds a new event handler for missing-reference (if intersphinx is enabled) with a priority value that makes it run after intersphinx’s, handler. So with this PR, after intersphinx fails to resolve a reference, this PR’s code tries running intersphinx’s code again, this time with the value from qualname_overrides.

@flying-sheep flying-sheep merged commit 7578770 into main Jan 16, 2025
7 checks passed
@flying-sheep flying-sheep deleted the pa/more-qualname-overriding branch January 16, 2025 09:18
@flying-sheep flying-sheep removed the request for review from ilan-gold January 16, 2025 09:18
@flying-sheep flying-sheep linked an issue Jan 16, 2025 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make qualname_overrides interact with sphinx.ext.autodoc.typehints
2 participants