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
When specifying the python-version with a version range or 3.x, the latest version will be installed.
runs-on: ubuntu-lateststeps:
- name: Checkoutuses: actions/checkout@v4
- name: Set up Pythonuses: actions/setup-python@v5with:
python-version: "3.7 - 3.13"
- name: Lintrun: pipx run pre-commit ...
This issue requests an opt-in option to let the action install the oldest major version available on the runner rather than the latest.
- name: Set up Pythonuses: actions/setup-python@v5with:
python-version: "3.7 - 3.13"oldest-first: true
Justification:
Justification or a use case for your proposal.
Newer Python may introduce new syntax. The valid code that can run on the latest Python may contain syntax errors in older Python. For example, Python 3.12 supports more powerful f-strings.
$ cat test.pylines = ['a', 'b', 'c']string = f'The joined lines are:\n{"\n".join(lines)}'print(string)
$ python3.12 test.pyThe joined lines are:abc
$ python3.11 test.py File "/home/PanXuehai/.../test.py", line 2 string = f'The joined lines are:\n{"\n".join(lines)}' ^SyntaxError: f-string expression part cannot include a backslash
The linting tool may not complain about the backward incompatible code if the linter runs with the latest Python.
One solution is to pin an old Python in the CI manually. However, the GitHub-hosted runner image may be updated separately with actions/setup-python. Users cannot use:
runs-on: ubuntu-lateststeps:
- name: Set up Pythonuses: actions/setup-python@v5with:
python-version: "3.7"
Because the CI will break when ubuntu-latest changes from ubuntu-22.04 to ubuntu-24.04.
- The version '3.7' with architecture 'x64' was not found for Ubuntu 24.04.- The list of all available versions can be found here: https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json
This request reduces the potential CI breakage for the two cases above.
Are you willing to submit a PR?
The text was updated successfully, but these errors were encountered:
Description:
Describe your proposal.
When specifying the
python-version
with a version range or3.x
, the latest version will be installed.This issue requests an opt-in option to let the action install the oldest major version available on the runner rather than the latest.
Justification:
Justification or a use case for your proposal.
Newer Python may introduce new syntax. The valid code that can run on the latest Python may contain syntax errors in older Python. For example, Python 3.12 supports more powerful f-strings.
The linting tool may not complain about the backward incompatible code if the linter runs with the latest Python.
One solution is to pin an old Python in the CI manually. However, the GitHub-hosted runner image may be updated separately with
actions/setup-python
. Users cannot use:Because the CI will break when
ubuntu-latest
changes fromubuntu-22.04
toubuntu-24.04
.This request reduces the potential CI breakage for the two cases above.
Are you willing to submit a PR?
The text was updated successfully, but these errors were encountered: