You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
lazy import is not highlighted in the docs #153227
In our documentation, lazy in lazy import isn't highlighted as a keyword. This is because the latest version of Pygments, the highlighting library used by Sphinx, does not include the lazy import implementation.
Several weeks ago, I asked Pygments whether they were planning to release this anytime soon, but I haven't gotten a response. So, in the meantime, I think we should pin a development version of Pygments so the PEP 810 examples look correct.
cc @AA-Turner who I discussed this with on Discord a while back
I'm guessing it's because the docs server installs from requirements.txt and re-uses a per-version venv that isn't being upgraded. RTD uses both pylock.toml and a fresh build each run.
A quick fix will be to delete the venv for 3.15 on the docs server.
Activity
Infra: Pin Pygments to a development version (#5024)
gh-153227: Use a development version of Pygments (#153228)
[3.15] gh-153227: Use a development version of Pygments (GH-153228) (#…
ZeroIntensity commentedon Jul 28, 2026
Hmm, this didn't seem to apply to
docs.python.org:Oddly, this did apply for PRs (see this RTD build, for example):
Do we have a separate build configuration for the main site?
cc @hugovk @StanFromIreland
hugovk commentedon Jul 28, 2026
I'm guessing it's because the docs server installs from
requirements.txtand re-uses a per-version venv that isn't being upgraded. RTD uses bothpylock.tomland a fresh build each run.A quick fix will be to delete the venv for 3.15 on the docs server.
Perhaps we should update https://github.com/python/docsbuild-scripts to use
pylock.toml(where available on newer branches) instead?hugovk commentedon Jul 28, 2026
I opened python/docsbuild-scripts#345 to create a fresh venv each time, and also use
pylock.tomlwhen available.hugovk commentedon Jul 30, 2026
That's merged and 3.16 docs have just rebuilt and we now have eager lazy highlighting!
https://docs.python.org/3.16/whatsnew/3.15.html#whatsnew315-lazy-imports
ZeroIntensity commentedon Jul 30, 2026
Thank you!
gh-153227: Unpin development version of Pygments (#156163)
[3.15] gh-153227: Unpin development version of Pygments (GH-156163) (#…
Infra: Pin Pygments to a development version (python#5024)