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

`python-version-file` does not support multiple versions

Open astro-stan opened this issue 1 year ago • 2 comments

Description: It is possible to specify multiple python versions like so:

- uses: actions/setup-python@v5
  with:
    python-version: |
      3.8
      3.9
      3.10

However, specifying them like so breaks CI:

.python-version:

3.8
3.9
3.10
- uses: actions/setup-python@v5
   with:
     python-version-file: '.python-version'

Action version: 5

Platform:

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

Runner type:

  • [x] Hosted
  • [x] Self-hosted

Tools version:

Repro steps:
See description

Expected behavior: Multiple python versions can be read from .python-version

Actual behavior: Multiple python versions cannot be read from .python-version

astro-stan avatar Jun 16 '24 16:06 astro-stan

Hello @sdimovv, Thank you for creating this issue and we will look into it :)

aparnajyothi-y avatar Jun 17 '24 14:06 aparnajyothi-y

Hello @sdimovv, Thank you once again for creating this issue and as per the current implementation, the actions/setup-python action does not support reading multiple Python versions from a .python-version file. Instead, we should specify multiple versions directly in the yaml configuration under the python-version parameter like below as per this documentation.

  • uses: actions/setup-python@v5 with: python-version: | 3.8 3.9 3.10

    Adding support to list multiple versions from a python-version-file that is expecting from this issue can be implemented as a feature request.

aparnajyothi-y avatar Jul 11 '24 05:07 aparnajyothi-y

Thank you for your feedback and for highlighting the need for support of multiple Python versions via the python-version-file input. We’re happy to let you know that this feature has now been implemented as part of PR #787. With this update, specifying multiple Python versions in a .python-version file is now supported and works consistently with the python-version input.

As this feature request is now fulfilled, we are closing this issue. If you encounter any problems or have further suggestions, please feel free to open a new issue.

lmvysakh avatar May 23 '25 03:05 lmvysakh