Skip to content

Commit b5729b4

Browse files
okinrickeylevaignas
authored
feat(toolchain): Add support for Python 3.13.1. (bazel-contrib#2482)
Adds 3.13.1 Python toolchain. Also updates 3.13 to map to 3.13.1. Tests have been slightly altered to make spotting the override easier. --------- Co-authored-by: Richard Levasseur <[email protected]> Co-authored-by: Ignas Anikevicius <[email protected]>
1 parent 026b300 commit b5729b4

File tree

3 files changed

+118
-13
lines changed

3 files changed

+118
-13
lines changed

CHANGELOG.md

+9
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ Unreleased changes template.
5252

5353
{#v0-0-0-changed}
5454
### Changed
55+
* (toolchains) 3.13 means 3.13.1 (previously 3.13.0)
5556
* Bazel 6 support is dropped and Bazel 7.4.1 is the minimum supported
5657
version, per our Bazel support matrix. Earlier versions are not
5758
tested by CI, so functionality cannot be guaranteed.
@@ -88,6 +89,14 @@ Unreleased changes template.
8889
To select the free-threaded interpreter in the repo phase, please use
8990
the documented [env](/environment-variables.html) variables.
9091
Fixes [#2386](https://github.com/bazelbuild/rules_python/issues/2386).
92+
* (toolchains) Use the latest astrahl-sh toolchain release [20241206] for Python versions:
93+
* 3.9.21
94+
* 3.10.16
95+
* 3.11.11
96+
* 3.12.8
97+
* 3.13.1
98+
99+
[20241206]: https://github.com/astral-sh/python-build-standalone/releases/tag/20241206
91100

92101
{#v0-0-0-removed}
93102
### Removed

python/versions.bzl

+98-5
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,20 @@ TOOL_VERSIONS = {
252252
},
253253
"strip_prefix": "python",
254254
},
255+
"3.9.21": {
256+
"url": "20241206/cpython-{python_version}+20241206-{platform}-{build}.tar.gz",
257+
"sha256": {
258+
"aarch64-apple-darwin": "4bddc18228789d0316dcebc45b2242e0010fa6bc33c302b6b5a62a5ac39d2147",
259+
"aarch64-unknown-linux-gnu": "7d3b4ab90f73fa9dab0c350ca64b1caa9b8e4655913acd098e594473c49921c8",
260+
"ppc64le-unknown-linux-gnu": "966477345ca93f056cf18de9cff961aacda2318a8e641546e0fd7222f1362ee2",
261+
"s390x-unknown-linux-gnu": "3ba05a408edce4e20ebd116643c8418e62f7c8066c8a35fe8d3b78371d90b46a",
262+
"x86_64-apple-darwin": "619f5082288c771ad9b71e2daaf6df6bd39ca86e442638d150a71a6ccf62978d",
263+
"x86_64-pc-windows-msvc": "82736b5a185c57b296188ce778ed865ff10edc5fe9ff1ec4cb33b39ac8e4819c",
264+
"x86_64-unknown-linux-gnu": "208b2adc7c7e5d5df6d9385400dc7c4e3b4c3eed428e19a2326848978e98517e",
265+
"x86_64-unknown-linux-musl": "67c058dbaae8fd8c4f68e13b10805a9227918afc94326f21a9a2ec2daca3ddbd",
266+
},
267+
"strip_prefix": "python",
268+
},
255269
"3.10.2": {
256270
"url": "20220227/cpython-{python_version}+20220227-{platform}-{build}.tar.gz",
257271
"sha256": {
@@ -372,6 +386,20 @@ TOOL_VERSIONS = {
372386
},
373387
"strip_prefix": "python",
374388
},
389+
"3.10.16": {
390+
"url": "20241206/cpython-{python_version}+20241206-{platform}-{build}.tar.gz",
391+
"sha256": {
392+
"aarch64-apple-darwin": "c2d25840756127f3583b04b0697bef79edacb15f1402cd980292c93488c3df22",
393+
"aarch64-unknown-linux-gnu": "bbfc345615c5ed33916b4fd959fc16fa2e896a3c5eec1fb782c91b47c85c0542",
394+
"ppc64le-unknown-linux-gnu": "cb474b392733d5ac2adaa1cfcc2b63b957611dc26697e76822706cc61ac21515",
395+
"s390x-unknown-linux-gnu": "886a7effc8a3061d53cacc9cf54e82d6d57ac3665c258c6a2193528c16b557cd",
396+
"x86_64-apple-darwin": "31a110b631eb79103675ed556255045deeea5ff533296d7f35b4d195a0df0315",
397+
"x86_64-pc-windows-msvc": "fb7870717dc7e3aedcbab4a647782637da0046a4238db1d41eeaabb78566d814",
398+
"x86_64-unknown-linux-gnu": "b15de0d63eed9871ed57285f81fd123cf6c4117251a9cac8f81f9cf0cccc0a53",
399+
"x86_64-unknown-linux-musl": "bf956eeffcff002d2f38232faa750c279cbb76197b744761d1b253bf94d6f637",
400+
},
401+
"strip_prefix": "python",
402+
},
375403
"3.11.1": {
376404
"url": "20230116/cpython-{python_version}+20230116-{platform}-{build}.tar.gz",
377405
"sha256": {
@@ -487,6 +515,20 @@ TOOL_VERSIONS = {
487515
},
488516
"strip_prefix": "python",
489517
},
518+
"3.11.11": {
519+
"url": "20241206/cpython-{python_version}+20241206-{platform}-{build}.tar.gz",
520+
"sha256": {
521+
"aarch64-apple-darwin": "566c5e266f2c933d0c0b213a75496bc6a090e493097802f809dbe21c75cd5d13",
522+
"aarch64-unknown-linux-gnu": "50ee364cfa24ee7d933eda955c9fe455bc0a8ebb9d998c9948f2909dac701dd9",
523+
"ppc64le-unknown-linux-gnu": "e0cdc00e42a05191b9b75ba976fc0fca9205c66fdaef7571c20532346fd3db1e",
524+
"s390x-unknown-linux-gnu": "3b106b8a3c5aa97ff76200cd0d9ba6eaed23d88ccb947e00ff6bb2d9f5422d2a",
525+
"x86_64-apple-darwin": "8ecd267281fb5b2464ddcd2de79622cfa7aff42e929b17989da2721ba39d4a5e",
526+
"x86_64-pc-windows-msvc": "d8986f026599074ddd206f3f62d6f2c323ca8fa7a854bf744989bfc0b12f5d0d",
527+
"x86_64-unknown-linux-gnu": "57a171af687c926c5cabe3d1c7ce9950b98f00b932accd596eb60e14ca39c42d",
528+
"x86_64-unknown-linux-musl": "8129a9a5c3f2654e1a9eed6093f5dc42399667b341050ff03219cb7df210c348",
529+
},
530+
"strip_prefix": "python",
531+
},
490532
"3.12.0": {
491533
"url": "20231002/cpython-{python_version}+20231002-{platform}-{build}.tar.gz",
492534
"sha256": {
@@ -566,6 +608,20 @@ TOOL_VERSIONS = {
566608
},
567609
"strip_prefix": "python",
568610
},
611+
"3.12.8": {
612+
"url": "20241206/cpython-{python_version}+20241206-{platform}-{build}.tar.gz",
613+
"sha256": {
614+
"aarch64-apple-darwin": "e3c4aa607717b23903ca2650d5c3ee24f89b97543e2db2b0f463bddc7a9e92f3",
615+
"aarch64-unknown-linux-gnu": "ce674b55442b732973afb2932c281bb1ded4ad7e22bcf9b07071165770758c7e",
616+
"ppc64le-unknown-linux-gnu": "b7214790b273de9ed0532420054b72ba1393d62d2fc844ec55ade193771bd90c",
617+
"s390x-unknown-linux-gnu": "73102f5dbd7d1e7e9c2f2c80aedf2893d99a7fa407f6674ec8b2f57ba07daee5",
618+
"x86_64-apple-darwin": "3ba35c706577d755e8e52a4c161a042464577c0e695e2a605362fa469e26de10",
619+
"x86_64-pc-windows-msvc": "767b4be3ddf6b99e5ade519789c1615c191d8cf99d5aff4685cc18b48931f1e6",
620+
"x86_64-unknown-linux-gnu": "b9d6ee5ddac1198e72d53112698773fc8bb597de095592eb849ca794306699ba",
621+
"x86_64-unknown-linux-musl": "6f305888703691dd04cfff85284d23ea0b0146ed7c4415e472f1fb72b3f32cdf",
622+
},
623+
"strip_prefix": "python",
624+
},
569625
"3.13.0": {
570626
"url": "20241016/cpython-{python_version}+20241016-{platform}-{build}.{ext}",
571627
"sha256": {
@@ -603,16 +659,53 @@ TOOL_VERSIONS = {
603659
"x86_64-unknown-linux-gnu-freethreaded": "python/install",
604660
},
605661
},
662+
"3.13.1": {
663+
"url": "20241205/cpython-{python_version}+20241205-{platform}-{build}.{ext}",
664+
"sha256": {
665+
"aarch64-apple-darwin": "88b88b609129c12f4b3841845aca13230f61e97ba97bd0fb28ee64b0e442a34f",
666+
"aarch64-unknown-linux-gnu": "fdfa86c2746d2ae700042c461846e6c37f70c249925b58de8cd02eb8d1423d4e",
667+
"ppc64le-unknown-linux-gnu": "27b20b3237c55430ca1304e687d021f88373f906249f9cd272c5ff2803d5e5c3",
668+
"s390x-unknown-linux-gnu": "7d0187e20cb5e36c689eec27e4d3de56d8b7f1c50dc5523550fc47377801521f",
669+
"x86_64-apple-darwin": "47eef6efb8664e2d1d23a7cdaf56262d784f8ace48f3bfca1b183e95a49888d6",
670+
"x86_64-pc-windows-msvc": "f51f0493a5f979ff0b8d8c598a8d74f2a4d86a190c2729c85e0af65c36a9cbbe",
671+
"x86_64-unknown-linux-gnu": "242b2727df6c1e00de6a9f0f0dcb4562e168d27f428c785b0eb41a6aeb34d69a",
672+
"x86_64-unknown-linux-musl": "76b30c6373b9c0aa2ba610e07da02f384aa210ac79643da38c66d3e6171c6ef5",
673+
"aarch64-apple-darwin-freethreaded": "08f05618bdcf8064a7960b25d9ba92155447c9b08e0cf2f46a981e4c6a1bb5a5",
674+
"aarch64-unknown-linux-gnu-freethreaded": "9f2fcb809f9ba6c7c014a8803073a88786701a98971135bce684355062e4bb35",
675+
"ppc64le-unknown-linux-gnu-freethreaded": "15ceea78dff78ca8ccaac8d9c54b808af30daaa126f1f561e920a6896e098634",
676+
"s390x-unknown-linux-gnu-freethreaded": "ed3c6118d1d12603309c930e93421ac7a30a69045ffd43006f63ecf71d72c317",
677+
"x86_64-apple-darwin-freethreaded": "dc780fecd215d2cc9e573abf1e13a175fcfa8f6efd100ef888494a248a16cda8",
678+
"x86_64-pc-windows-msvc-freethreaded": "7537b2ab361c0eabc0eabfca9ffd9862d7f5f6576eda13b97e98aceb5eea4fd3",
679+
"x86_64-unknown-linux-gnu-freethreaded": "9ec1b81213f849d91f5ebe6a16196e85cd6ff7c05ca823ce0ab7ba5b0e9fee84",
680+
},
681+
"strip_prefix": {
682+
"aarch64-apple-darwin": "python",
683+
"aarch64-unknown-linux-gnu": "python",
684+
"ppc64le-unknown-linux-gnu": "python",
685+
"s390x-unknown-linux-gnu": "python",
686+
"x86_64-apple-darwin": "python",
687+
"x86_64-pc-windows-msvc": "python",
688+
"x86_64-unknown-linux-gnu": "python",
689+
"x86_64-unknown-linux-musl": "python",
690+
"aarch64-apple-darwin-freethreaded": "python/install",
691+
"aarch64-unknown-linux-gnu-freethreaded": "python/install",
692+
"ppc64le-unknown-linux-gnu-freethreaded": "python/install",
693+
"s390x-unknown-linux-gnu-freethreaded": "python/install",
694+
"x86_64-apple-darwin-freethreaded": "python/install",
695+
"x86_64-pc-windows-msvc-freethreaded": "python/install",
696+
"x86_64-unknown-linux-gnu-freethreaded": "python/install",
697+
},
698+
},
606699
}
607700

608701
# buildifier: disable=unsorted-dict-items
609702
MINOR_MAPPING = {
610703
"3.8": "3.8.20",
611-
"3.9": "3.9.20",
612-
"3.10": "3.10.15",
613-
"3.11": "3.11.10",
614-
"3.12": "3.12.7",
615-
"3.13": "3.13.0",
704+
"3.9": "3.9.21",
705+
"3.10": "3.10.16",
706+
"3.11": "3.11.11",
707+
"3.12": "3.12.8",
708+
"3.13": "3.13.1",
616709
}
617710

618711
def _generate_platforms():

tests/python/python_tests.bzl

+11-8
Original file line numberDiff line numberDiff line change
@@ -413,17 +413,17 @@ def _test_add_new_version(env):
413413
strip_prefix = "python",
414414
platform = "aarch64-unknown-linux-gnu",
415415
coverage_tool = "specific_cov_tool",
416-
python_version = "3.13.1",
416+
python_version = "3.13.99",
417417
patch_strip = 2,
418418
patches = ["specific-patch.txt"],
419419
),
420420
],
421421
override = [
422422
_override(
423423
base_url = "",
424-
available_python_versions = ["3.12.4", "3.13.0", "3.13.1"],
424+
available_python_versions = ["3.12.4", "3.13.0", "3.13.1", "3.13.99"],
425425
minor_mapping = {
426-
"3.13": "3.13.0",
426+
"3.13": "3.13.99",
427427
},
428428
),
429429
],
@@ -436,13 +436,14 @@ def _test_add_new_version(env):
436436
"3.12.4",
437437
"3.13.0",
438438
"3.13.1",
439+
"3.13.99",
439440
])
440441
env.expect.that_dict(py.config.default["tool_versions"]["3.13.0"]).contains_exactly({
441442
"sha256": {"aarch64-unknown-linux-gnu": "deadbeef"},
442443
"strip_prefix": {"aarch64-unknown-linux-gnu": "prefix"},
443444
"url": {"aarch64-unknown-linux-gnu": ["example.org"]},
444445
})
445-
env.expect.that_dict(py.config.default["tool_versions"]["3.13.1"]).contains_exactly({
446+
env.expect.that_dict(py.config.default["tool_versions"]["3.13.99"]).contains_exactly({
446447
"coverage_tool": {"aarch64-unknown-linux-gnu": "specific_cov_tool"},
447448
"patch_strip": {"aarch64-unknown-linux-gnu": 2},
448449
"patches": {"aarch64-unknown-linux-gnu": ["specific-patch.txt"]},
@@ -452,7 +453,7 @@ def _test_add_new_version(env):
452453
})
453454
env.expect.that_dict(py.config.minor_mapping).contains_exactly({
454455
"3.12": "3.12.4", # The `minor_mapping` will be overriden only for the missing keys
455-
"3.13": "3.13.0",
456+
"3.13": "3.13.99",
456457
})
457458
env.expect.that_collection(py.toolchains).contains_exactly([
458459
struct(
@@ -484,13 +485,13 @@ def _test_register_all_versions(env):
484485
sha256 = "deadb00f",
485486
urls = ["something.org"],
486487
platform = "aarch64-unknown-linux-gnu",
487-
python_version = "3.13.1",
488+
python_version = "3.13.99",
488489
),
489490
],
490491
override = [
491492
_override(
492493
base_url = "",
493-
available_python_versions = ["3.12.4", "3.13.0", "3.13.1"],
494+
available_python_versions = ["3.12.4", "3.13.0", "3.13.1", "3.13.99"],
494495
register_all_versions = True,
495496
),
496497
],
@@ -503,11 +504,12 @@ def _test_register_all_versions(env):
503504
"3.12.4",
504505
"3.13.0",
505506
"3.13.1",
507+
"3.13.99",
506508
])
507509
env.expect.that_dict(py.config.minor_mapping).contains_exactly({
508510
# The mapping is calculated automatically
509511
"3.12": "3.12.4",
510-
"3.13": "3.13.1",
512+
"3.13": "3.13.99",
511513
})
512514
env.expect.that_collection(py.toolchains).contains_exactly([
513515
struct(
@@ -521,6 +523,7 @@ def _test_register_all_versions(env):
521523
"python_3_13": "3.13",
522524
"python_3_13_0": "3.13.0",
523525
"python_3_13_1": "3.13.1",
526+
"python_3_13_99": "3.13.99",
524527
}.items()
525528
])
526529

0 commit comments

Comments
 (0)