Skip to content

Conversation

@ashnair1
Copy link
Collaborator

@ashnair1 ashnair1 commented Dec 2, 2025

Fixes #2006

Widely used across the scientific Python ecosystem. Major libraries using this theme include NumPy, Pandas, SciPy, GeoPandas, Xarray etc. pytorch_sphinx_theme2 inherits from this theme (link) as well.

@github-actions github-actions bot added documentation Improvements or additions to documentation dependencies Packaging and dependencies labels Dec 2, 2025
@ashnair1 ashnair1 marked this pull request as ready for review December 2, 2025 19:15
@ashnair1 ashnair1 requested a review from adamjstewart December 3, 2025 03:52
Copy link
Member

@adamjstewart adamjstewart left a comment

Choose a reason for hiding this comment

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

Looks decent, fixes many of our bugs. Quite different from our previous theme, so may take some getting used to. Hasn't had a new release in almost a year, so either very stable or unmaintained.

I think there are a few other things we'll like to customize, such as default pages for different tabs and the version selection menu, but we can do those if we decide this is the style we want.

If it's not too much work, it would be nice to see a few other alternatives that are either simple or widely used by the community.

'navigation_depth': 4,
'navbar_align': 'left',
'header_links_before_dropdown': 6,
'icon_links': [
Copy link
Member

Choose a reason for hiding this comment

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

These are cool!

@github-actions github-actions bot added the datasets Geospatial or benchmark datasets label Dec 3, 2025
@ashnair1 ashnair1 force-pushed the docs-pydata branch 2 times, most recently from addb7b1 to 415f278 Compare December 3, 2025 13:38
@ashnair1
Copy link
Collaborator Author

ashnair1 commented Dec 3, 2025

One note on the landing page (index). Currently it shows the docstring in torchgeo/__init__.py (left image) but I could show the README instead (right image)

image

Copy link
Member

@adamjstewart adamjstewart left a comment

Choose a reason for hiding this comment

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

I'm leaning towards this theme because it matches the rest of the PyTorch ecosystem but is still maintained. A couple remaining questions:

  • Are we able to remove any of the files in docs/_static? These were CSS hacks designed to fix bugs in pytorch-sphinx-theme.
  • I'm curious if there's a way to get rid of the version switcher in the bottom right corner and add one to the top menu bar like pytorch2-sphinx-theme. It's possible this is also a cache issue on my side.

Comment on lines +51 to +52
# Sphinx 5.3+ required to allow section titles inside autodoc class docstrings
# https://github.com/sphinx-doc/sphinx/pull/10887
Copy link
Member

Choose a reason for hiding this comment

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

I would also be okay with removing section headings from docstrings, I don't imagine it happens in very many places.

tools:
# Sphinx 6.1 and older do not support Python 3.13+
python: '3.12'
python: '3.13'
Copy link
Member

Choose a reason for hiding this comment

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

Can test 3.14 now if you rebase

Copy link
Collaborator Author

@ashnair1 ashnair1 Dec 16, 2025

Choose a reason for hiding this comment

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

Needs #3203 to be merged

Copy link
Member

Choose a reason for hiding this comment

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

Technically that shouldn't matter, the pytest warning filters don't apply to sphinx anyway.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I tried switching to 3.14 earlier and the lightly warnings caused the RtD build to fail.

Copy link
Member

Choose a reason for hiding this comment

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

Hmm, that might be a problem. I don't know how to tell RtD to ignore that, #3203 shouldn't help.

Copy link
Collaborator Author

@ashnair1 ashnair1 Dec 16, 2025

Choose a reason for hiding this comment

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

You were right. Warnings are still raised. I'll proceed with building docs on 3.13 for now

@ashnair1 ashnair1 force-pushed the docs-pydata branch 3 times, most recently from 89004f4 to 35b6ea0 Compare December 15, 2025 20:02
@ashnair1
Copy link
Collaborator Author

ashnair1 commented Dec 15, 2025

I'm leaning towards this theme because it matches the rest of the PyTorch ecosystem but is still maintained. A couple remaining questions:

  • Are we able to remove any of the files in docs/_static? These were CSS hacks designed to fix bugs in pytorch-sphinx-theme.
  • I'm curious if there's a way to get rid of the version switcher in the bottom right corner and add one to the top menu bar like pytorch2-sphinx-theme. It's possible this is also a cache issue on my side.
  • I have added the version switcher to the top of the navbar
  • I was able to remove badge-height.css and table-scroll.css without affecting the docs. notebook-prompt.css could be removed as well but I didn't go through with it as I think we don't want those line numbers. Below image shows how it would look. Left (current), Right (without notebook-prompt.css)
notebookprompt-removal

@ashnair1
Copy link
Collaborator Author

Note: Currently colors are based on the default pydata-sphinx-theme i.e. blue and purple. This can be overridden with a custom css. Can be done in a later PR

@adamjstewart
Copy link
Member

Python 3.14 error is:

WARNING: Failed to get a method signature for torchgeo.datasets.GeoDataset.__annotate_func__: None is not a callable object

This looks like sphinx-doc/sphinx#13701. So Sphinx 9+ is required for Python 3.14+.

@ashnair1
Copy link
Collaborator Author

ashnair1 commented Dec 17, 2025

Python 3.14 error is:

WARNING: Failed to get a method signature for torchgeo.datasets.GeoDataset.__annotate_func__: None is not a callable object

This looks like sphinx-doc/sphinx#13701. So Sphinx 9+ is required for Python 3.14+.

Only thing stopping us from supporting sphinx 9+ is myst-parser which currently doesn't support sphinx 9+ and is required to render the README in the documentation. Once executablebooks/MyST-Parser#1076 is merged that should be solved.

@adamjstewart
Copy link
Member

Drop the README then 🙂

@ashnair1
Copy link
Collaborator Author

ashnair1 commented Dec 19, 2025

Docs now work with Python 3.14. There is an issue with tutorials test though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

datasets Geospatial or benchmark datasets dependencies Packaging and dependencies documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Change documentation theme

2 participants