Skip to content

fix(cmake): better --fresh support #5668

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

Merged
merged 1 commit into from
May 19, 2025

Conversation

henryiii
Copy link
Collaborator

@henryiii henryiii commented May 18, 2025

Description

This restructures the venv creation support. You can now run multiple times safely with different interpreters by adding --fresh. Before:

cmake --preset venv -DPYBIND11_CREATE_WITH_UV:PATH=~/.pyenv/versions/3.14.0b1t/bin/python
cmake --build --preset venv --target cpptest

rm -rf build .venv  # <-- Bug to forget this!
cmake --preset venv -DPYBIND11_CREATE_WITH_UV=3.13t
cmake --build --preset venv --target cpptest

After:

cmake --preset venv -DPYBIND11_CREATE_WITH_UV:PATH=~/.pyenv/versions/3.14.0b1t/bin/python
cmake --build --preset venv --target cpptest

cmake --preset venv -DPYBIND11_CREATE_WITH_UV=3.13t --fresh
cmake --build --preset venv --target cpptest

It also doesn't interfere with a developer .venv.

Maybe this should be in a distinct folder now, to keep default and venv from interfering?

Suggested changelog entry:

* Restucture venv support to support ``--fresh``, make in build folder

Signed-off-by: Henry Schreiner <[email protected]>
@henryiii henryiii merged commit cc86e8b into pybind:master May 19, 2025
67 checks passed
@henryiii henryiii deleted the henryiii/chore/cmakefresh branch May 19, 2025 01:12
@github-actions github-actions bot added the needs changelog Possibly needs a changelog entry label May 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs changelog Possibly needs a changelog entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant