Skip to content

Consider presence on the PATH an opt-in to Python pre-releases #7469

@zanieb

Description

@zanieb

From @henryiii in #7300 (comment)

Yes, the issue wasn't VIRTUAL_ENV, but rather that we were making the venv assuming it would use the Python on the top of the PATH. cibuildwheel 2.21.1 fixes this.

It's really weird, though, that it no longer takes the Python at the top of the PATH when --system is used. If someone goes to the trouble to put Python in the PATH, intentionally skipping over it is really surprising; and if you type python, you don't get the one you just installed to. For example:

- uses: actions/setup-python@v5
  with:
    python-version: ${{ matrix.python-version }}
    allow-prereleases: true
- uses: astral-sh/setup-uv@v3
- run: uv pip install --system some_lib
- run: python -c "import some_lib"

now fails only on 3.13 because uv installed to the 3.12 instead of the 3.13 that's been prepared by setup-python. The python above is 3.13, while uv is skipping it and installing into 3.12. (I've seen this failure somewhere but have forgotten which repos it affected).

I understand this makes sense with managed Python (where you have a bunch of Pythons and uv's just picking out the best one), but it is very surprising to have it do this to the Python on PATH.

We may want to consider allowing --system to opt-in here, but I'm a little hesitant to have different discovery behaviors.

cc @carljm / @AlexWaygood who suggested to me that we should not select Python pre-releases by default.

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-decisionUndecided if this should be done

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions