Skip to content

Commit b3e0003

Browse files
authored
Add Python 3.12 and Python 3.13 as probe-able versions (#448)
This (theoretically) adds support for running future Pants PEXes that requires Python 3.12 or 3.13 by adding them as versions that the fallback "probing" loop will query. This will hopefully reduce how often we need to force users to upgrade their scie-pants runner, because current versions of scie-pants will support more Python versions, giving us a bit more flexibility with doing internal upgrades. (Worst case: there's a problem in this PR and it doesn't work for the actual future 3.12/3.13-using versions of Pants... but, that's seemingly no worse than we were before, without any support at all.) ## Background Scie-pants downloads and runs PEXes from Pants releases. These PEXes require a specific Python version, that's indicated in the URL, e.g. <https://github.com/pantsbuild/pants/releases/download/release_2.25.0.dev4/pants.2.25.0.dev4-cp311-darwin_arm64.pex> (NB. `cp311`). There's two aspects of scie-pants working with these: - hard-coding the different Python versions, to have lift/ptex be able to download the right interpreter (in `scie-pants.toml`) - logic to find the right artifact to download: https://github.com/pantsbuild/scie-pants/blob/9d73b15a0f602de1359c842a7b153b1dda53c7e9/tools/src/scie_pants/pants_version.py#L239-L253 - first guess the URL based on the requested version, with hard-coded known cut-overs: https://github.com/pantsbuild/scie-pants/blob/9d73b15a0f602de1359c842a7b153b1dda53c7e9/tools/src/scie_pants/pants_version.py#L27-L33 - if that fails, then fallback to guessing successive URLs based on the known-versions (i.e. several requests to probe the possible request artifacts) The fallback feature allows us to have current scie-pants support potential future versions of Pants, to reduce how often users are forced to upgrade their scie-pants runner installation. ## Example Imagine we release 2.34.0 with cp312 support and had made no other changes, this gives an artifact like `pants.2.34.0-cp312-darwin_arm64.pex`: 1. Scie-pants' initial guess tries to download `pants.2.34.0-cp311-darwin_arm64.pex` (because 2.34.0 >= 2.25.0.dev0, which is the hard-coded cp311 threshold in `PANTS_PYTHON_VERSIONS`), but this would fail. 2. The fallback kicks in to go through the various `PYTHON_IDS`. It eventually hits `pants.2.34.0-cp312-darwin_arm64.pex` and succeeds, getting Pants 2.34 running for that user! Without this PR, step 2 would only run through 3.8 - 3.11, not find the artifact, and thus the overall installation would fail. (Hard-coding the version threshold once we know it will make this bootstrapping (slightly) more efficient/send fewer requests, but the fallback + extra versions means scie-pants is at least functional.)
1 parent 9d73b15 commit b3e0003

File tree

5 files changed

+24
-2
lines changed

5 files changed

+24
-2
lines changed

CHANGES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Release Notes
22

3+
## 0.12.3
4+
5+
Add support for running potential future Pants versions that use Python 3.12 or Python 3.13. No versions of Pants use those versions of Python yet.
6+
37
## 0.12.2
48

59
Support for Pants 2.25.0.dev0 and newer, which run on Python 3.11 instead of 3.9. (This is the first complete release that incorporates this change, that was originally attempted in 0.12.1.)

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ members = [
66
[package]
77
name = "scie-pants"
88
description = "Protects your Pants from the elements."
9-
version = "0.12.2"
9+
version = "0.12.3"
1010
edition = "2021"
1111
authors = [
1212
"John Sirois <[email protected]>",

package/scie-pants.toml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,20 @@ release = "20240415"
4242
lazy = true
4343
version = "3.11.9"
4444

45+
[[lift.interpreters]]
46+
id = "cpython312"
47+
provider = "PythonBuildStandalone"
48+
release = "20250106"
49+
lazy = true
50+
version = "3.12.8"
51+
52+
[[lift.interpreters]]
53+
id = "cpython313"
54+
provider = "PythonBuildStandalone"
55+
release = "20250106"
56+
lazy = true
57+
version = "3.13.1"
58+
4559
[[lift.interpreter_groups]]
4660
id = "cpython"
4761
selector = "{scie.bindings.configure:PYTHON}"
@@ -50,6 +64,8 @@ members = [
5064
"cpython39",
5165
"cpython310",
5266
"cpython311",
67+
"cpython312",
68+
"cpython313",
5369
]
5470

5571
[[lift.files]]

tools/src/scie_pants/pants_version.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
PYTHON_IDS = {
3535
# N.B.: These values must match the lift TOML interpreter ids.
3636
# Important: all pythons used in pants_python_versions.json must be represented in this list.
37+
"cp313": "cpython313",
38+
"cp312": "cpython312",
3739
"cp311": "cpython311",
3840
"cp310": "cpython310",
3941
"cp39": "cpython39",

0 commit comments

Comments
 (0)