Skip to content

Commit

Permalink
Add Python 3.13.0rc2 support to rules_python in a form of a patch.
Browse files Browse the repository at this point in the history
TODO: once rules_python has 3.13 out of the box, the patch can be safely removed.

rules_python does not depend on rc versions of Python (seems to be against its philosophy), while JAX wants to support it, that is why adding RC support in a form of a patch instead of adding it directly to rules_python.

PiperOrigin-RevId: 675261914
  • Loading branch information
vam-google authored and Google-ML-Automation committed Sep 16, 2024
1 parent 4159597 commit 90be6e3
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 0 deletions.
2 changes: 2 additions & 0 deletions third_party/py/python_init_rules.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ def python_init_rules():
sha256 = "778aaeab3e6cfd56d681c89f5c10d7ad6bf8d2f1a72de9de55b23081b2d31618",
strip_prefix = "rules_python-0.34.0",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.34.0/rules_python-0.34.0.tar.gz",
patch_args = ["-p1"],
patches = [Label("//third_party/py:rules_python.patch")],
)
36 changes: 36 additions & 0 deletions third_party/py/rules_python.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
Subject: [PATCH] Add Python 3.13.0rc2 support to rules_python
---
Index: python/versions.bzl
<+>UTF-8
===================================================================
diff --git a/python/versions.bzl b/python/versions.bzl
--- a/python/versions.bzl (revision 084b877c98b580839ceab2b071b02fc6768f3de6)
+++ b/python/versions.bzl (date 1726256410148)
@@ -484,6 +484,19 @@
},
"strip_prefix": "python",
},
+ "3.13.0": {
+ "url": "20240909/cpython-{python_version}rc2+20240909-{platform}-{build}.tar.gz",
+ "sha256": {
+ "aarch64-apple-darwin": "5d38ca1e6b030b004714e10813903e906c6b8f2a6361770df4512a838f4a4a9f",
+ "aarch64-unknown-linux-gnu": "85e103fc81a1fcf94a93180f6df42e39a7dc15d4b711705e133dc2ec847552e7",
+ "ppc64le-unknown-linux-gnu": "3be3d8aefae579c420fc6abf01658ae89fda8120154f989575b08085d2f8d6dc",
+ "s390x-unknown-linux-gnu": "6ec5130d62473368ecc7e55338bf1cc58607dbfe8088959cab51265b9f13c38d",
+ "x86_64-apple-darwin": "c3dcd4314324159945dc19342c73b9deb8de0f2d1709171427dd52f1a05eecca",
+ "x86_64-pc-windows-msvc": "31282f912e984d399c56925dfb69a4f3ce76226dfb4806b09f37e3b4a15e5a30",
+ "x86_64-unknown-linux-gnu": "028581cce5004c66775a3ae8b3ed65681ab4b289608dfd1aec3354d169216099",
+ },
+ "strip_prefix": "python",
+ },
}

# buildifier: disable=unsorted-dict-items
@@ -493,6 +506,7 @@
"3.10": "3.10.14",
"3.11": "3.11.9",
"3.12": "3.12.3",
+ "3.13": "3.13.0",
}

PLATFORMS = {
2 changes: 2 additions & 0 deletions third_party/tsl/third_party/py/python_init_rules.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ def python_init_rules():
sha256 = "778aaeab3e6cfd56d681c89f5c10d7ad6bf8d2f1a72de9de55b23081b2d31618",
strip_prefix = "rules_python-0.34.0",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.34.0/rules_python-0.34.0.tar.gz",
patch_args = ["-p1"],
patches = [Label("//third_party/py:rules_python.patch")],
)
36 changes: 36 additions & 0 deletions third_party/tsl/third_party/py/rules_python.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
Subject: [PATCH] Add Python 3.13.0rc2 support to rules_python
---
Index: python/versions.bzl
<+>UTF-8
===================================================================
diff --git a/python/versions.bzl b/python/versions.bzl
--- a/python/versions.bzl (revision 084b877c98b580839ceab2b071b02fc6768f3de6)
+++ b/python/versions.bzl (date 1726256410148)
@@ -484,6 +484,19 @@
},
"strip_prefix": "python",
},
+ "3.13.0": {
+ "url": "20240909/cpython-{python_version}rc2+20240909-{platform}-{build}.tar.gz",
+ "sha256": {
+ "aarch64-apple-darwin": "5d38ca1e6b030b004714e10813903e906c6b8f2a6361770df4512a838f4a4a9f",
+ "aarch64-unknown-linux-gnu": "85e103fc81a1fcf94a93180f6df42e39a7dc15d4b711705e133dc2ec847552e7",
+ "ppc64le-unknown-linux-gnu": "3be3d8aefae579c420fc6abf01658ae89fda8120154f989575b08085d2f8d6dc",
+ "s390x-unknown-linux-gnu": "6ec5130d62473368ecc7e55338bf1cc58607dbfe8088959cab51265b9f13c38d",
+ "x86_64-apple-darwin": "c3dcd4314324159945dc19342c73b9deb8de0f2d1709171427dd52f1a05eecca",
+ "x86_64-pc-windows-msvc": "31282f912e984d399c56925dfb69a4f3ce76226dfb4806b09f37e3b4a15e5a30",
+ "x86_64-unknown-linux-gnu": "028581cce5004c66775a3ae8b3ed65681ab4b289608dfd1aec3354d169216099",
+ },
+ "strip_prefix": "python",
+ },
}

# buildifier: disable=unsorted-dict-items
@@ -493,6 +506,7 @@
"3.10": "3.10.14",
"3.11": "3.11.9",
"3.12": "3.12.3",
+ "3.13": "3.13.0",
}

PLATFORMS = {

0 comments on commit 90be6e3

Please sign in to comment.