Repository navigation
lazy import is not highlighted in the docs #153227
Description
Activity
- addeddocsDocumentation in the Doc dirDocumentation in the Doc dir
on Jul 6, 2026 - addedinfraCI, GitHub Actions, buildbots, Dependabot, etc.CI, GitHub Actions, buildbots, Dependabot, etc.
on Jul 6, 2026 - added a commit that references this issue
on Jul 6, 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?
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?I opened python/docsbuild-scripts#345 to create a fresh venv each time, and also use
pylock.tomlwhen available.Reacted by Peter BiermaThat'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
Reacted by Stan Ulbrych and Peter BiermaThank you!
Reacted by Hugo van Kemenade- added a commit that references this issue
on Oct 8, 2026
Metadata
Metadata
Assignees
Labels
Projects
- StatusShow more project fieldsTodo
Documentation
In our documentation,
lazyinlazy importisn't highlighted as a keyword. This is because the latest version of Pygments, the highlighting library used by Sphinx, does not include thelazy importimplementation.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
Linked PRs