Skip to content

Commit 6c02eb5

Browse files
committed
remove workaround from the uv lock
1 parent 3c7f542 commit 6c02eb5

File tree

2 files changed

+9
-24
lines changed

2 files changed

+9
-24
lines changed

python/uv/private/BUILD.bazel

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,8 @@ bzl_library(
4343
":toolchain_types_bzl",
4444
"//python:py_binary_bzl",
4545
"//python/private:bzlmod_enabled_bzl",
46-
"//python/private:full_version_bzl",
4746
"//python/private:toolchain_types_bzl",
4847
"@bazel_skylib//lib:shell",
49-
"@pythons_hub//:versions_bzl",
5048
],
5149
)
5250

python/uv/private/lock.bzl

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,8 @@
1616
"""
1717

1818
load("@bazel_skylib//lib:shell.bzl", "shell")
19-
load("@pythons_hub//:versions.bzl", "DEFAULT_PYTHON_VERSION", "MINOR_MAPPING")
2019
load("//python:py_binary.bzl", "py_binary")
2120
load("//python/private:bzlmod_enabled.bzl", "BZLMOD_ENABLED") # buildifier: disable=bzl-visibility
22-
load("//python/private:full_version.bzl", "full_version")
2321
load("//python/private:toolchain_types.bzl", "EXEC_TOOLS_TOOLCHAIN_TYPE") # buildifier: disable=bzl-visibility
2422
load(":toolchain_types.bzl", "UV_TOOLCHAIN_TYPE")
2523

@@ -75,15 +73,15 @@ def _args(ctx):
7573

7674
def _lock_impl(ctx):
7775
srcs = ctx.files.srcs
78-
python_version = full_version(
79-
version = ctx.attr.python_version or DEFAULT_PYTHON_VERSION,
80-
minor_mapping = MINOR_MAPPING,
81-
)
82-
output = ctx.actions.declare_file("{}.{}.out".format(
83-
ctx.label.name,
84-
python_version.replace(".", "_"),
85-
))
76+
fname = "{}.out".format(ctx.label.name)
77+
python_version = ctx.attr.python_version
78+
if python_version:
79+
fname = "{}.{}.out".format(
80+
ctx.label.name,
81+
python_version.replace(".", "_"),
82+
)
8683

84+
output = ctx.actions.declare_file(fname)
8785
toolchain_info = ctx.toolchains[UV_TOOLCHAIN_TYPE]
8886
uv = toolchain_info.uv_toolchain_info.uv[DefaultInfo].files_to_run.executable
8987

@@ -166,15 +164,7 @@ def _transition_impl(input_settings, attr):
166164
_PYTHON_VERSION_FLAG: input_settings[_PYTHON_VERSION_FLAG],
167165
}
168166
if attr.python_version:
169-
# FIXME @aignas 2025-03-20: using `full_version` is a workaround for a bug in
170-
# how we order toolchains in bazel. If I set the `python_version` flag
171-
# to `3.12`, I would expect the latest version to be selected, i.e. the
172-
# one that is in MINOR_MAPPING, but it seems that 3.12.0 is selected,
173-
# because of how the targets are ordered.
174-
settings[_PYTHON_VERSION_FLAG] = full_version(
175-
version = attr.python_version,
176-
minor_mapping = MINOR_MAPPING,
177-
)
167+
settings[_PYTHON_VERSION_FLAG] = attr.python_version
178168
return settings
179169

180170
_python_version_transition = transition(
@@ -436,9 +426,6 @@ def lock(
436426
if not BZLMOD_ENABLED:
437427
kwargs["target_compatible_with"] = ["@platforms//:incompatible"]
438428

439-
# FIXME @aignas 2025-03-17: should we have one more target that transitions
440-
# the python_version to ensure that if somebody calls `bazel build
441-
# :requirements` that it is locked with the right `python_version`?
442429
_lock(
443430
name = name,
444431
args = args,

0 commit comments

Comments
 (0)