Option to setup the oldest available Python rather than the latest version when a range of version specified
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 38/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- github-actions, typescript
- 领域
- ci-cd
调研方向
首先跟踪 actions/setup-python 如何解析 python-version 范围,并参考 issue 中描述的 versions manifest 行为。定义 opt-in oldest-first 输入的预期行为,包括 runner 镜像的变更,并验证现有的 latest-version 行为保持不变。
由索引模型根据 Issue 内容生成。
描述
Description:
Describe your proposal.
When specifying the python-version with a version range or 3.x, the latest version will be installed.
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.7 - 3.13"
- name: Lint
run: 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 Python
uses: actions/setup-python@v5
with:
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.py
lines = ['a', 'b', 'c']
string = f'The joined lines are:\n{"\n".join(lines)}'
print(string)
$ python3.12 test.py
The joined lines are:
a
b
c
$ 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-latest
steps:
- name: Set up Python
uses: actions/setup-python@v5
with:
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?
- 主要语言
- TypeScript
- 星标
- 2.2k
- 派生
- 739
- 平均合并
- 6 天 18 小时
- 30 天内合并 PR
- 1
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
actions/setup-python 的其他 Issue
-
bug
难度 4/5 3-5 天 新手友好度 55/100
actions/setup-python#1348 · 5 条评论 ·
-
feature request
难度 5/5 一周以上 新手友好度 35/100
actions/setup-python#1346 · 12 条评论 ·
-
feature request
难度 3/5 1-2 天 新手友好度 58/100
actions/setup-python#1308 · 8 条评论 ·
-
feature request
难度 2/5 1-3 小时 新手友好度 35/100
actions/setup-python#1301 · 5 条评论 ·
-
feature request
难度 4/5 3-5 天 新手友好度 55/100
actions/setup-python#1294 · 3 条评论 · 2 个 reaction ·
查看 actions/setup-python 的全部 Issue
相似的 Issue
-
blocklist removal
难度 2/5 1-3 小时 新手友好度 65/100
MetaMask/eth-phishing-detect#296544 ·
-
难度 2/5 1-3 小时 新手友好度 70/100
pastelsky/bundlephobia#1122 ·
-
难度 2/5 1-3 小时 新手友好度 70/100
-
category/development priority/P2 scope/file-operations scope/testing type/enhancement
难度 2/5 1-3 小时 新手友好度 75/100
-
难度 2/5 1-3 小时 新手友好度 75/100