Skip to content

Commit 4f1ba1d

Browse files
committed
drop the usage of 3.9 in the bzlmod example
1 parent 165b9eb commit 4f1ba1d

File tree

12 files changed

+52
-1142
lines changed

12 files changed

+52
-1142
lines changed

examples/BUILD.bazel

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,6 @@ load("@rules_python//python/uv/private:lock.bzl", "lock") # buildifier: disable
1717

1818
licenses(["notice"]) # Apache 2.0
1919

20-
lock(
21-
name = "bzlmod_requirements_3_9",
22-
srcs = ["bzlmod/requirements.in"],
23-
out = "bzlmod/requirements_lock_3_9.txt",
24-
args = [
25-
"--emit-index-url",
26-
"--universal",
27-
"--python-version=3.9",
28-
],
29-
python_version = "3.9.19",
30-
)
31-
3220
lock(
3321
name = "bzlmod_requirements_3_11",
3422
srcs = ["bzlmod/requirements.in"],
@@ -40,16 +28,3 @@ lock(
4028
],
4129
python_version = "3.11",
4230
)
43-
44-
lock(
45-
name = "bzlmod_requirements_3_11_windows",
46-
srcs = ["bzlmod/requirements.in"],
47-
out = "bzlmod/requirements_windows_3_11.txt",
48-
args = [
49-
"--emit-index-url",
50-
"--python-platform",
51-
"windows",
52-
"--python-version=3.11",
53-
],
54-
python_version = "3.11",
55-
)

examples/bzlmod/.python_version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.9
1+
3.11

examples/bzlmod/BUILD.bazel

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
# The `load` statement imports the symbol for the rule, in the defined
44
# ruleset. When the symbol is loaded you can use the rule.
55

6-
# The names @pip and @python_39 are values that are repository
6+
# The names @pip and @python_3_10 are values that are repository
77
# names. Those names are defined in the MODULES.bazel file.
88
load("@bazel_skylib//rules:build_test.bzl", "build_test")
99
load("@pip//:requirements.bzl", "all_data_requirements", "all_requirements", "all_whl_requirements", "requirement")
10-
load("@python_3_9//:defs.bzl", py_test_with_transition = "py_test")
10+
load("@python_3_10//:defs.bzl", py_test_with_transition = "py_test")
1111
load("@python_versions//3.10:defs.bzl", compile_pip_requirements_3_10 = "compile_pip_requirements")
1212
load("@rules_python//python:py_binary.bzl", "py_binary")
1313
load("@rules_python//python:py_library.bzl", "py_library")
@@ -58,6 +58,7 @@ py_test(
5858
deps = [":lib"],
5959
)
6060

61+
# this is legacy API that we check that it works
6162
py_test_with_transition(
6263
name = "test_with_transition",
6364
srcs = ["test.py"],

examples/bzlmod/MODULE.bazel

Lines changed: 23 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ bazel_dep(name = "rules_rust", version = "0.54.1")
3030
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
3131
python.defaults(
3232
# Use python.defaults if you have defined multiple toolchain versions.
33-
python_version = "3.9",
33+
python_version = "3.11",
3434
python_version_env = "BAZEL_PYTHON_VERSION",
3535
)
3636
python.toolchain(
3737
configure_coverage_tool = True,
38-
python_version = "3.9",
38+
python_version = "3.10",
3939
)
4040

4141
# We are also using a second version of Python in this project.
@@ -45,7 +45,7 @@ python.toolchain(
4545
# work in progress.
4646
python.toolchain(
4747
configure_coverage_tool = True,
48-
python_version = "3.10",
48+
python_version = "3.11",
4949
)
5050

5151
# One can override the actual toolchain versions that are available, which can be useful
@@ -65,7 +65,7 @@ python.override(
6565
# instead of rules_python's defaulting to the latest available version,
6666
# controls what full version is used when `3.x` is requested.
6767
minor_mapping = {
68-
"3.9": "3.9.19",
68+
"3.10": "3.10.19",
6969
},
7070
)
7171

@@ -74,15 +74,15 @@ python.single_version_override(
7474
patch_strip = 1,
7575
# The user can specify patches to be applied to all interpreters.
7676
patches = [],
77-
python_version = "3.10.2",
77+
python_version = "3.11.14",
7878
sha256 = {
79-
"aarch64-apple-darwin": "1409acd9a506e2d1d3b65c1488db4e40d8f19d09a7df099667c87a506f71c0ef",
80-
"aarch64-unknown-linux-gnu": "8f351a8cc348bb45c0f95b8634c8345ec6e749e483384188ad865b7428342703",
81-
"x86_64-apple-darwin": "8146ad4390710ec69b316a5649912df0247d35f4a42e2aa9615bffd87b3e235a",
82-
"x86_64-pc-windows-msvc": "a1d9a594cd3103baa24937ad9150c1a389544b4350e859200b3e5c036ac352bd",
83-
"x86_64-unknown-linux-gnu": "9b64eca2a94f7aff9409ad70bdaa7fbbf8148692662e764401883957943620dd",
79+
"aarch64-apple-darwin": "01b4e23e35cf3f9aebb8ca1424452da1136070469cd92f44f0cadd825c2cfcc7",
80+
"aarch64-unknown-linux-gnu": "08141d31f95d86a23f23e4c741b726de0055f12f83200d1d4867b4e8e6e967c5",
81+
"x86_64-apple-darwin": "941b67f28d10498195af9a0df9e496871b4453ea5cbde0e98861f010c142cdda",
82+
"x86_64-pc-windows-msvc": "24f2d4bcb0e2ac0b088e12fd175a5f857b527b3cff4b12de94b6a9a2a30495e6",
83+
"x86_64-unknown-linux-gnu": "edd8d11aa538953d12822fab418359a692fd1ee4ca2675579fbf0fa31e3688f1",
8484
},
85-
urls = ["20220227/cpython-{python_version}+20220227-{platform}-{build}.tar.gz"],
85+
urls = ["20251028/cpython-{python_version}+20251028-{platform}-{build}.tar.gz"],
8686
)
8787

8888
# Or a single platform. This can be used in combination with the
@@ -93,16 +93,16 @@ python.single_version_platform_override(
9393
patch_strip = 1,
9494
patches = [],
9595
platform = "aarch64-apple-darwin",
96-
python_version = "3.10.2",
97-
sha256 = "1409acd9a506e2d1d3b65c1488db4e40d8f19d09a7df099667c87a506f71c0ef",
98-
urls = ["20220227/cpython-{python_version}+20220227-{platform}-{build}.tar.gz"],
96+
python_version = "3.11.14",
97+
sha256 = "01b4e23e35cf3f9aebb8ca1424452da1136070469cd92f44f0cadd825c2cfcc7",
98+
urls = ["20251028/cpython-{python_version}+20251028-{platform}-{build}.tar.gz"],
9999
)
100100

101101
# You only need to load this repositories if you are using multiple Python versions.
102102
# See the tests folder for various examples on using multiple Python versions.
103-
# The names "python_3_9" and "python_3_10" are autmatically created by the repo
103+
# The names "python_3_10" and "python_3_11" are automatically created by the repo
104104
# rules based on the `python_version` arg values.
105-
use_repo(python, "python_3_10", "python_3_9", "python_versions", "pythons_hub")
105+
use_repo(python, "python_3_10", "python_3_11", "python_versions", "pythons_hub")
106106

107107
# EXPERIMENTAL: This is experimental and may be changed or removed without notice
108108
uv = use_extension(
@@ -184,45 +184,6 @@ pip.default(
184184
# call.
185185
# Alternatively, `python_interpreter_target` can be used to directly specify
186186
# the Python interpreter to run to resolve dependencies.
187-
pip.parse(
188-
# We can use `envsubst in the above
189-
envsubst = ["PIP_INDEX_URL"],
190-
# Use the bazel downloader to query the simple API for downloading the sources
191-
# Note, that we can use envsubst for this value.
192-
experimental_index_url = "${PIP_INDEX_URL:-https://pypi.org/simple}",
193-
# One can also select a particular index for a particular package.
194-
# This ensures that the setup is resistant against confusion attacks.
195-
# experimental_index_url_overrides = {
196-
# "my_package": "https://different-index-url.com",
197-
# },
198-
# Or you can specify extra indexes like with `pip`:
199-
# experimental_extra_index_urls = [
200-
# "https://different-index-url.com",
201-
# ],
202-
experimental_requirement_cycles = {
203-
"sphinx": [
204-
"sphinx",
205-
"sphinxcontrib-qthelp",
206-
"sphinxcontrib-htmlhelp",
207-
"sphinxcontrib-devhelp",
208-
"sphinxcontrib-applehelp",
209-
"sphinxcontrib-serializinghtml",
210-
],
211-
},
212-
extra_hub_aliases = {
213-
"wheel": ["generated_file"],
214-
},
215-
hub_name = "pip",
216-
python_version = "3.9",
217-
requirements_lock = "requirements_lock_3_9.txt",
218-
# These modifications were created above and we
219-
# are providing pip.parse with the label of the mod
220-
# and the name of the wheel.
221-
whl_modifications = {
222-
"@whl_mods_hub//:requests.json": "requests",
223-
"@whl_mods_hub//:wheel.json": "wheel",
224-
},
225-
)
226187
pip.parse(
227188
experimental_requirement_cycles = {
228189
"sphinx": [
@@ -242,6 +203,9 @@ pip.parse(
242203
"//:requirements_lock_3_10.txt": "linux_*,osx_*",
243204
"//:requirements_windows_3_10.txt": "windows_x86_64",
244205
},
206+
extra_hub_aliases = {
207+
"wheel": ["generated_file"],
208+
},
245209
# These modifications were created above and we
246210
# are providing pip.parse with the label of the mod
247211
# and the name of the wheel.
@@ -254,14 +218,15 @@ pip.parse(
254218
hub_name = "pip",
255219
python_version = "3.11",
256220
requirements_by_platform = {
257-
# Default requirements file for needs to explicitly provide the platforms
258-
"//:requirements_lock_3_11.txt": "linux_*,osx_*",
259221
# This API allows one to specify additional platforms that the users
260222
# configure the toolchains for themselves. In this example we add
261223
# `windows_aarch64` to illustrate that `rules_python` won't fail to
262224
# process the value, but it does not mean that this example will work
263225
# on Windows ARM.
264-
"//:requirements_windows_3_11.txt": "windows_x86_64,windows_aarch64",
226+
"//:requirements_lock_3_11.txt": "linux_*,osx_*,windows_x86_64,windows_aarch64",
227+
},
228+
extra_hub_aliases = {
229+
"wheel": ["generated_file"],
265230
},
266231
# These modifications were created above and we
267232
# are providing pip.parse with the label of the mod

examples/bzlmod/entry_points/BUILD.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ py_console_script_binary(
2424
)
2525

2626
# A specific Python version can be forced by passing `python_version`
27-
# attribute, e.g. to force Python 3.9:
27+
# attribute, e.g. to force Python 3.10:
2828
py_console_script_binary(
2929
name = "yamllint",
3030
pkg = "@pip//yamllint:pkg",
31-
python_version = "3.9",
31+
python_version = "3.10",
3232
visibility = ["//entry_points:__subpackages__"],
3333
)

examples/bzlmod/entry_points/tests/pylint_deps_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def test_pylint_entry_point(self):
5151
"",
5252
proc.stderr.decode("utf-8").strip(),
5353
)
54-
self.assertRegex(proc.stdout.decode("utf-8").strip(), "^pylint 2\.15\.9")
54+
self.assertRegex(proc.stdout.decode("utf-8").strip(), "^pylint 2\.15\.10")
5555

5656
def test_pylint_report_has_expected_warnings(self):
5757
rlocation_path = os.environ.get("PYLINT_REPORT")

examples/bzlmod/entry_points/tests/pylint_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def test_pylint_entry_point(self):
5050
"",
5151
proc.stderr.decode("utf-8").strip(),
5252
)
53-
self.assertRegex(proc.stdout.decode("utf-8").strip(), "^pylint 2\.15\.9")
53+
self.assertRegex(proc.stdout.decode("utf-8").strip(), "^pylint 2\.15\.10")
5454

5555

5656
if __name__ == "__main__":

examples/bzlmod/entry_points/tests/yamllint_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def test_yamllint_entry_point(self):
4646
stdout=subprocess.PIPE,
4747
stderr=subprocess.PIPE,
4848
)
49-
self.assertEqual(proc.stdout.decode("utf-8").strip(), "yamllint 1.28.0")
49+
self.assertEqual(proc.stdout.decode("utf-8").strip(), "yamllint 1.32.0")
5050

5151

5252
if __name__ == "__main__":

0 commit comments

Comments
 (0)