@@ -26,25 +26,23 @@ _REQUIREMENTS_TARGET_COMPATIBLE_WITH = select({
2626 "//conditions:default" : [],
2727}) if BZLMOD_ENABLED else ["@platforms//:incompatible" ]
2828
29- def lock (* , name , srcs , out , upgrade = False , universal = True , python_version = None , args = [], ** kwargs ):
29+ def lock (* , name , srcs , out , upgrade = False , universal = True , args = [], ** kwargs ):
3030 """Pin the requirements based on the src files.
3131
32+ Differences with the current {obj}`compile_pip_requirements` rule:
33+ - This is implemented in shell and uv.
34+ - This does not error out if the output file does not exist yet.
35+ - Supports transitions out of the box.
36+
3237 Args:
3338 name: The name of the target to run for updating the requirements.
3439 srcs: The srcs to use as inputs.
3540 out: The output file.
3641 upgrade: Tell `uv` to always upgrade the dependencies instead of
3742 keeping them as they are.
3843 universal: Tell `uv` to generate a universal lock file.
39- python_version: Tell `rules_python` to use a particular version.
40- Defaults to the default py toolchain.
41- args: Extra args to pass to the rule.
42- **kwargs: Extra kwargs passed to the binary rule.
43-
44- Differences with the current pip-compile rule:
45- - This is implemented in shell and uv.
46- - This does not error out if the output file does not exist yet.
47- - Supports transitions out of the box.
44+ args: Extra args to pass to `uv`.
45+ **kwargs: Extra kwargs passed to the {obj}`py_binary` rule.
4846 """
4947 pkg = native .package_name ()
5048 update_target = name + ".update"
@@ -92,10 +90,6 @@ def lock(*, name, srcs, out, upgrade = False, universal = True, python_version =
9290 Label ("//python:current_py_toolchain" ),
9391 ],
9492 )
95- if python_version :
96- py_binary_rule = lambda * args , ** kwargs : py_binary (python_version = python_version , * args , ** kwargs )
97- else :
98- py_binary_rule = py_binary
9993
10094 # Write a script that can be used for updating the in-tree version of the
10195 # requirements file
@@ -116,7 +110,7 @@ def lock(*, name, srcs, out, upgrade = False, universal = True, python_version =
116110 ],
117111 )
118112
119- py_binary_rule (
113+ py_binary (
120114 name = update_target ,
121115 srcs = [update_target + ".py" ],
122116 main = update_target + ".py" ,
0 commit comments