-
-
Notifications
You must be signed in to change notification settings - Fork 365
Improve compatibility between old sphinx and new mkdocs setup #3544
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
base: main
Are you sure you want to change the base?
Conversation
|
I'm not able to request reviews from you, but FYI @ilan-gold @ianhi |
|
Commented here @maxrjones but I think the check (in |
Can you please provide an example of an intersphinx link that is still broken following the changes in this PR? |
Apologies, I should have been clearer. I wasn't commenting on how well this fixes things, more just responding to what Davis said about checking URLs directly. I think the unit of interest shouldn't be the actual URLs but the intersphinix lookup i.e., the later should be checked. I try to avoid using URLs for exactly that reason - they can change but intersphinx allows us to keep the location in the reference the same over that. That being, here's what I got locally against https://zarr--3544.org.readthedocs.build/en/3544/: UPDATE: tried remotely as well: https://app.readthedocs.org/projects/annbatch/builds/30070579/ |
|
is there anything else we need here? |
|
I guess the question is whether or not the failures I saw in #3544 (comment) are acceptable or not. |
|
I think we'd like the transition to the new docs to be as smooth as possible. What do we need in this PR to fix the failures you saw? Bear in mind that I know nothing about how intersphinx works! |
Without being able to say specifically how to accomplish this, these references need to appear in the |
|
the end of this section of the mkdocstrings docs might be useful: https://mkdocstrings.github.io/usage/#cross-references-to-other-projects-inventories |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3544 +/- ##
=======================================
Coverage 61.77% 61.77%
=======================================
Files 85 85
Lines 10165 10165
=======================================
Hits 6279 6279
Misses 3886 3886 🚀 New features to boost your workflow:
|
We're using that feature for the objects inventory. However, it only adds references to API objects rather than all headers and sub-headers/labels, which is what sphinx does. We are missing mkdocstrings/mkdocstrings#508. Lots of libraries use intersphinx mapping for zarr: https://github.com/search?q=%22https%3A%2F%2Fzarr.readthedocs.io%22+path%3A**%2Fconf.py&type=code, but it may be more for the API cross-referencing than linking to docs pages. If we want complete compatibility with intersphinx, I think we have three options:
It'd be a bummer if the bespoke objects.inv has us locked into sphinx (1), but that might be the case. I'll look into how hard (2) or (3) would be. |
I think there are enough differences between how sphinx and mkdocs handle references that we will need to just switch to sphinx + sphinx-immaterial if we want full compatibility with intersphinx. For example, sphinx's autodoc seems to add headers for every attribute of a class (https://zarr.readthedocs.io/en/stable/api/zarr/abc/buffer/index.html#zarr.abc.buffer.BufferPrototype.buffer) whereas mkdocstrings does not (https://zarr.readthedocs.io/en/latest/api/abc/buffer/#zarr.abc.buffer.BufferPrototype). While we could try to reproduce sphinx' current logic in a hook to add more references to the object inventory from mkdocstrings, but the hook would likely deviate from sphinx' behavior over time. |
:( can we at least keep your markdown changes by using myst? |
|
I don't think complete sphinx compatibility needs to be our goal. Otherwise, we would have stuck with sphinx. I'm fine breaking some auto-generated documentation links as part of the release of a totally new docs backend, especially since we are doing this in a 3.2 release. What do other people think? |
I'd suspect that this is the case, and that direct linking to actual URLs is the case for linking to a section.
I'd be pretty happy if:
|
I just pushed some changes to reach this goal. |
|
thanks for this work max! @ilan-gold how do things look on your end with these changes? |
|
https://app.readthedocs.org/projects/annbatch/builds/30107997/ Still some errors, but maybe the way I'm linking to the pages is wrong. I saw you guys do local linking (i.e., not intersphinx) internally, so I couldn't glean much from that: zarr-python/docs/user-guide/arrays.md Line 26 in b3e9aed
anndata and got:
These aren't headers, I think, just pages.
At the end of the day, I think it's a decision for y'all whether you want the docs' guide pages to be intersphinx linkable in every way you were before. I personally like being able to point to a stable interphinx URL for full pages but I'm not sure it's worth blocking on at this point. I like the way the docs look so I'll survive either way. |
|
P.S: https://github.com/search?q=%22zarr%3Auser%22&type=code we appear to be the only people using this functionality. |
|
FYI I moved the scripts to gists to not pollute the repo:
|
|
Is there anything more you want to do here @maxrjones ? This situation is a bit of a bummer for @ilan-gold so how do you feel about this tradeoff? |
|
I would prefer to have errors when links break, but I am not sure it's holding up this release over this issue. It's not that many links. Maybe |
|
Thanks for understanding, @ilan-gold. I think this is ready for review. We can commit to providing absolute URLs via redirects at a minimum, but unfortunately it seems we cannot guarantee non-API intersphinx links work without extensive development. |
This PR aims to address #3542.
TODO:
docs/user-guide/*.mdchanges/