-
Notifications
You must be signed in to change notification settings - Fork 638
Description
Description:
If you use cache: poetry, setup-python requires poetry to be installed, but doesn't install it itself. If you install poetry prior to running setup-python, as of today this seems to lead to a mismatch between the python version in which poetry is installed, and the one that setup-python installs.
Action version:
v5
Platform:
- Ubuntu
Runner type:
- Hosted
Tools version:
Unsure.
Repro steps:
A description with steps to reproduce the issue. If your have a public example or repo to share, please provide the link.
This fails, because poetry needs to be installed before setup-python
- name: Use Python 3.13
uses: actions/setup-python@v5
with:
python-version: "3.13"
cache: "poetry"
- name: Install poetry
run: pipx install poetry
This fails, because it leaves me with a version of poetry tied to python 3.11 (this just started happening today)
- name: Install Poetry # needed for actions/setup-python
run: pipx install poetry
- name: Use Python 3.13
uses: actions/setup-python@v5
with:
python-version: "3.13"
cache: "poetry"
I tried a number of different things (reinstall poetry after setup-python runs, calling poetry env use
), but my workaround has been to drop the use of this package's built-in cache entirely, and install poetry after setup-pyhon.
- uses: actions/cache@v4
name: Setup Poetry cache
with:
path: ${{ env.HOME }}/.cache/pypoetry/virtualenvs
key: ${{ runner.os }}-poetry-store-${{ hashFiles('**/poetry.lock') }}
- name: Use Python 3.13
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install Poetry
run: pip install poetry
Expected behavior:
Ideally you could just do this. I think that if you're caching poetry, it's reasonable for setup-python to assuem that poetry should be installed and handle that for you.
- name: Use Python 3.13
uses: actions/setup-python@v5
with:
python-version: "3.13"
cache: "poetry"
In order works, if the cache: poetry option is available, the script should:
- install python
- install poetry
- resolve the cache path