setup-python icon indicating copy to clipboard operation
setup-python copied to clipboard

Action breaks when `.python-version` file specifies multiple versions

Open OmeGak opened this issue 2 years ago • 2 comments

Description: The action breaks if the .python-version file specifies multiple Python versions. This is a supported behavior in pyenv. From pyenv README.md:

You can also specify multiple versions in a .python-version file by hand, separated by newlines.

Action version: v4.7.0

Platform:

  • [x] Ubuntu
  • [ ] macOS
  • [ ] Windows

Runner type:

  • [x] Hosted
  • [ ] Self-hosted

Tools version: All Python versions affected.

Repro steps:

  1. Add a .python-version file in the repository with multiple versions specified, one in each line.
  2. Add the action in one of the project's workflow jobs, without explicitly specifying the Python version so that the action falls back to using .python-version file.
  3. Trigger the workflow to run.

Example of failing run: https://github.com/unconventionaldotdev/unbeheader/actions/runs/6320589478/job/17163309443?pr=14#step:4:10

Expected behavior: The action should take the Python version from the first line of the .python-version file.

Actual behavior: The action takes the entire .python-version file as the Python version, instead, and fails.

OmeGak avatar Sep 27 '23 08:09 OmeGak

Hello @OmeGak. Thank you for your report. We'll take a look at the issue.

dmitry-shibanov avatar Sep 27 '23 08:09 dmitry-shibanov

Similar issue is when using pyenv-virtualenv auto-activation like

3.10.13/envs/virtualenv

Unfortunately, Pyenv doesn't feel like to fix the issue (pyenv/pyenv-virtualenv#472).

krystof-k avatar Jan 03 '24 22:01 krystof-k