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

Require Python 3.10 and Sphinx 7.3 #221

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

AA-Turner
Copy link
Member

@AA-Turner AA-Turner commented Feb 2, 2025

See also python/cpython#129576. This would mean this theme is no longer installable with the 3.10 or 3.11 branches, which require sphinx==3.4.3 and sphinx~=7.2.0 respectively.

Changes:

  • Require Python 3.10 (used on the docs server)
  • Require Sphinx 7.3
  • Drop _add_asset_hashes patch
  • Drop CSS for Sphinx 4.x
  • Drop sidebar.js_t for Sphinx 4.x
  • Add static type annotations to setup()
  • Convert theme.conf to the new theme.toml (via python -m sphinx.theming conf_to_toml python_docs_theme)
  • Define the version extension metadata field.
  • Replace @import url(...) with an entry in the sidebars list, to allow parallel stylesheet fetching by the user agent

A


📚 Documentation preview 📚: https://python-docs-theme-previews--221.org.readthedocs.build/

Copy link
Member

@hugovk hugovk left a comment

Choose a reason for hiding this comment

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

(There's a conflict after merging #219.)

Looking good, although before merging and pinning 3.11 to 2024.12 in python/cpython#129576, it might be nice to get #218 merged and released in 2025.2, and then pinning 3.11 to 2025.2?


return {
"version": "2024.12",
Copy link
Member

Choose a reason for hiding this comment

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

Hmm, it would be nice to avoid duplicating the version number here and in pyproject.toml (ideally I'd like to use something like hatch-vcs or setuptools_scm to avoid hardcoding altogether, as it unlocks more release automation).

If it's important to include the version here, and there's no easy way to avoid duplicating, let's document that this version also needs bumping in the release checklist:

https://github.com/python/python-docs-theme/blob/main/CONTRIBUTING.rst

Copy link
Member Author

@AA-Turner AA-Turner Feb 3, 2025

Choose a reason for hiding this comment

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

Personally I like the __version__ = '...' pattern, which would let us do "version": __version__ with no duplication. This can also be picked up by Flit, should we switch to it?

Copy link
Member

Choose a reason for hiding this comment

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

So we define __version__ = "..." once somewhere in Python code, and then Flit will pick it up so we don't need it in pyproject.toml? Yeah, that sounds fine.

(This would also be compatible with hatch-vcs or setuptools_scm, which can generate a version file at build time that you can from ._version import __version__. But that's out of scope here.)

Copy link
Member Author

Choose a reason for hiding this comment

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

See #222 (which also adopts the version-agnostic elements of this PR).


assert isinstance(app.builder, StandaloneHTMLBuilder)

if (4,) <= sphinx.version_info < (7, 1) and "css_files" in context:
Copy link
Member

Choose a reason for hiding this comment

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

Nice lot of cleanup!

@AA-Turner AA-Turner mentioned this pull request Feb 4, 2025
# Conflicts:
#	python_docs_theme/__init__.py
#	python_docs_theme/static/pydoctheme.css
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.

2 participants