Skip to content

Recreate venv for each build + install from pylock.toml when available - #345

Open
hugovk wants to merge 3 commits into
python:mainfrom
hugovk:clear-and-pylock
Open

Recreate venv for each build + install from pylock.toml when available#345
hugovk wants to merge 3 commits into
python:mainfrom
hugovk:clear-and-pylock

Conversation

@hugovk

@hugovk hugovk commented Jul 28, 2026

Copy link
Copy Markdown
Member

Re: python/cpython#153227 (comment)

python/cpython#153228 switched to use a dev version of pygments from GitHub, but it's not being picked up on the doc server.

This is because:

  • We re-use a venv per Python version on the docs server
  • pip install --upgrade -rrequirements.txt still sees pygments with the same version number in the venv, so doesn't need to upgrade it

This PR does two things:

  • Clear the venv for each build. We still have a pip cache on the server, so it's not downloading everything every time. This means we'll always a fresh venv matching what we expect.
  • We now have pylock.toml on newer branches (3.15+), which locks the actual required version, so this explicitly pin the dev version from GitHub. Let's use pylock.toml when when available.

Comment thread build_docs.py
venv_path,
symlinks=os.name != "nt",
with_pip=True,
clear=True,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This ensures a fresh venv.

Comment thread build_docs.py
symlinks=os.name != "nt",
with_pip=True,
clear=True,
upgrade_deps=True,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Upgrade pip, because otherwise we use the bundled pip, and we need at least 25.1 for pylock.toml support.

Could do this just for the pylock.toml part, but might as well update for both.

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.

1 participant