-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Switch documentation to pydata-sphinx-theme #8708
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
Conversation
Docs build failed because we fail on warnings:
|
I just came across this trying to sort out #10223! Experimenting locally, that issue seems fixed by simply gutting the custom style file https://github.com/pydata/xarray/blob/main/doc/_static/style.css in favor of relying on newer theme defaults However, it seems probably a good time to also update the theme since executable_book_theme is not seeing as much development (xref https://executablebooks.org/en/latest/blog/2024-05-20-jupyter-book-myst/#what-this-means-for-jupyter-book-v1-users) as pydata_sphinx_theme (which it explicitly pins): Ok if I just take over this PR? Or should I start a fresh one? |
Do as you see fit @scottyhq ! FYI I think there are other discussion about the much more radical idea of using MyST for the docs. But that would be a big project... |
doc/_static/style.css
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe most of this is making adjustments to the previous theme, and I found that simply removing most of it does fix #10223 (the issue of strange sidebar behavior with varying theme size). You can see that is remedied by making this browser window narrower https://xray--8708.org.readthedocs.build/en/8708/getting-started-guide/quick-overview.html
@@ -37,119 +37,119 @@ | |||
|
|||
def _dsplot(plotfunc): | |||
commondoc = """ | |||
Parameters |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Took me an annoying long time to figure out that decreasing the indention on these solved the following sphinx/autodoc warnings:
/Users/scotthenderson/GitHub/xarray/xarray/xarray/plot/accessor.py:docstring of xarray.plot.accessor.DatasetPlotAccessor.quiver:7: CRITICAL: Unexpected section title.
Parameters
----------
xarray/plot/accessor.py:docstring of xarray.plot.accessor.DatasetPlotAccessor.quiver:11: ERROR: Unexpected indentation.
xarray/plot/accessor.py:docstring of xarray.plot.accessor.DatasetPlotAccessor.quiver:12: WARNING: Block quote ends without a blank line; unexpected unindent.
xarray/plot/accessor.py:docstring of xarray.plot.accessor.DatasetPlotAccessor.quiver:117: WARNING: Inline strong start-string without end-string.
OK, RTD is happy and I think this is looking pretty good. Would be great for others to review the preview, given the look and feel is different, albeit pretty similar to the past! https://xray--8708.org.readthedocs.build/en/8708/
|
Very nice! Thanks @scottyhq The API reference navigation is a weird: https://xray--8708.org.readthedocs.build/en/8708/api.html . Seems like what's on the right should be on the left. |
This is also probably a good time to change the top-level "tutorials link" to link to https://tutorial.xarray.dev |
I thought that initially too. But it's essentially how the current docs are structured (https://docs.xarray.dev/en/v2025.03.1/api.html), it's just that the current docs have the persistent left-hand sidebar to navigate the entire site. Seems possible to do more "section" subdivisions though to accomplish this, for example, see the Pandas API landing page: |
I wanted to add a bit more discussion and a concrete proposal for this. I think given the restructured theme it would be good to tweak the existing structure before merging this (just re-organize, not rewriting). To begin, here is a quick survey of "top bars":
Xarray this PR:
Proposal: Keep 4-6 main categories only in top bar, move the rest under respective sections:
Developer Guide -> Contributing Guide, Xarray Internals, Development Roadmap, Developers Meeting, Team, What’s New User Guide -> Gallery, Tutorials & Videos, How do I…, Getting Help, Ecosystem, Discussions, StackOverflow After writing this out I thought it could be nice to keep the ‘Gallery’ and ‘Getting Help’ as their own sections in the top bar… Obviously many ways to do it, but I think keeping the main sections to a minimum (<6) is appealing. Thoughts? Also pinging @andrewendlinger because I saw you had some nice suggestions in #10236 and your perspective would be appreciated! |
I like your "Developer Guide" top-level though perhaps call it "Contribute" (low-confidence suggestion).
These could be under the "Getting Help" (or even "Help") top-level heading (which is currently just one page. I think it's nice to surface this as top-level instead of expecting people to click in to User Guide to find it. |
Thanks for including me :) The new structure design is great! I agree, the current pile up inside "More" is probably too much / redundant. Also, since the Tutorials website is so neat, I would keep it at the top for a dedicated shout out. So something like that?
Btw, https://matplotlib.org also has a nice structure. |
.. ipython:: python | ||
.. jupyter-execute:: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was really quite straightforward to do this, and the resulting quickstart page in my opinion looks a lot more inviting for new users! I'd be happy to fully convert the other docs in a separate PR if people like it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://xray--8708.org.readthedocs.build/en/8708/getting-started-guide/quick-overview.html
vs
https://docs.xarray.dev/en/stable/getting-started-guide/quick-overview.html
note: except if 'dark mode' on the theme is set, I opened pydata/pydata-sphinx-theme#2189 to sort that out
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The html output instead of the raw string is amazing!
I haven't been looking at the changes here in depth, but from quick inspection of the rendered docs this looks great! (at least in light mode for now). Two comments:
|
The only social link shown in the top bar is twitter. I'd be in favor of either add other social links like https://bsky.app/profile/xarray.bsky.social (maybe the Xarray-dev Discord server as well?) there, or only keep the github link to avoid cluttering the top bar (and add all social links elsewhere). |
I agree that often-visited pages should be easy to reach! In general I think it's good to mimic but not copy the other major libraries. I view the top bar more as 'category' subsections each having many pages, rather than links to a specific page.W
Agreed! I'd be happy to tackle more re-org to that section as well as the API section as separate stand-alone PRs. I found that I was needing to restrain myself from too many changes... it's easy to get a bit carried away with a docs refresh :)
Yeah, I don't use these much, so am in favor of just the GitHub link |
Personally it often frustrates me when I can't quickly navigate to the release notes of any library in general, but I'm curious about others opinion on this! From what I see, the "release notes" page often gets special treatment at the same level as the top-level categories (for a good reason IMO). It could be linked as well in "Useful Links" (duplicate links are good), or like in astropy right next to the version number. |
Sounds good. Also, I liked the astropy approach of linking next to the version number! So I changed both and added a separate social media page. I'm pretty happy with this as-is now, but of course open to other modifications. After merging this one I think it'd be great to improve upon different sections one at a time (@andrewendlinger, I did not implement all your suggestions, but I think they are great so a separate PR would be very welcome). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a great step forward!
* main: (76 commits) Update how-to-add-new-backend.rst (#10240) Support extension array indexes (#9671) Switch documentation to pydata-sphinx-theme (#8708) Bump codecov/codecov-action from 5.4.0 to 5.4.2 in the actions group (#10239) Fix mypy, min-versions CI, xfail Zarr tests (#10255) Remove `test_dask_layers_and_dependencies` (#10242) Fix: Docs generation create temporary files that are not cleaned up. (#10238) opendap / dap4 support for pydap backend (#10182) Add RangeIndex (#10076) Fix mypy (#10232) Fix doctests (#10230) Fix broken Sphinx Roles (#10225) `DatasetView.map` fix `keep_attrs` (#10219) Add datatree repr asv (#10214) CI: Automatic PR labelling is back (#10201) Fixes dimension order in `xarray.Dataset.to_stacked_array` (#10205) Fix references to core classes in docs (#10207) Update pre-commit hooks (#10208) add `scipy-stubs` as extra `[types]` dependency (#10202) Fix sparse dask repr test (#10200) ...
* main: Fix convert calendar on non-temporal data in datasets (pydata#10268) BinGrouper: reduce indirection (pydata#10270) Fix reduction by subset of grouper dimensions (pydata#10258) Shorten text repr for ``DataTree`` (pydata#10139) Fix benchmarks runners (pydata#10265) Fix infinite recursion when calling `np.fix` (pydata#10248) BinGrouper: Support setting labels when provided with IntervalIndex (pydata#10259) Avoid stacking when grouping by chunked array (pydata#10254) Improve alignment checks (pydata#10251) Update how-to-add-new-backend.rst (pydata#10240) Support extension array indexes (pydata#9671) Switch documentation to pydata-sphinx-theme (pydata#8708) Bump codecov/codecov-action from 5.4.0 to 5.4.2 in the actions group (pydata#10239)
whats-new.rst
How might we want to move headers/sections around to take advantage of now having a navigation bar at the top? Adding an explicit link to the tutorial.xarray.dev site would be good.
PR Docs Preview Link for convenience: https://xray--8708.org.readthedocs.build/en/8708/