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
Using actions/setup-python can be faster, because GitHub caches the Python versions alongside the runner.
So as a consequence - i'm trying to use that - but use the astral-sh/setup-uv function to install UV.
Unfortunately, there seems to be no way to have uv setup a virtual environment - all while reusing the existing python installation.
The only way i found was through passing in python-version: ${{ matrix.python-version }} - but that installs a 2nd copy of python alongside the one installed via actions/setup-python - so contradicts the above FAQ entry (i could remove the setup-python action as it's python ain't used).
- name: Set up Pythonuses: actions/setup-python@v5with:
python-version: ${{ matrix.python-version }}
- name: Install uvuses: astral-sh/setup-uv@v5with:
python-version: ${{ matrix.python-version }}
current workaround
(note: the below is for the windows variant - others will need slightly different workarounds)
- name: Set up Pythonuses: actions/setup-python@v5with:
python-version: ${{ matrix.python-version }}
- name: Install uvuses: astral-sh/setup-uv@v5
- name: Installationrun: | uv venv .venv\Scripts\activate # persist the venv path for future steps "$(pwd)/.venv/Scripts" >> $env:GITHUB_PATH...
Desired solution:
A flag/parameter to allow UV to use the existing python installed via setup-python - but still do the venv magic (create venv, aktivate for the rest of the job, caching, ...)
- name: Set up Pythonuses: actions/setup-python@v5with:
python-version: ${{ matrix.python-version }}
- name: Install uvuses: astral-sh/setup-uv@v5with:
create-venv: true
The text was updated successfully, but these errors were encountered:
xmatthias
changed the title
Enable creation of venv with installed python version
Enable creation of venv with existing python version
Dec 29, 2024
the FAQ specifically mentions:
So as a consequence - i'm trying to use that - but use the
astral-sh/setup-uv
function to install UV.Unfortunately, there seems to be no way to have uv setup a virtual environment - all while reusing the existing python installation.
The only way i found was through passing in
python-version: ${{ matrix.python-version }}
- but that installs a 2nd copy of python alongside the one installed viaactions/setup-python
- so contradicts the above FAQ entry (i could remove the setup-python action as it's python ain't used).current workaround
(note: the below is for the windows variant - others will need slightly different workarounds)
Desired solution:
A flag/parameter to allow UV to use the existing python installed via setup-python - but still do the venv magic (create venv, aktivate for the rest of the job, caching, ...)
The text was updated successfully, but these errors were encountered: