@@ -26,25 +26,25 @@ _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+ - The execution of the lock file generation is happening inside of a build
37+ action in a `genrule`.
38+
3239 Args:
3340 name: The name of the target to run for updating the requirements.
3441 srcs: The srcs to use as inputs.
3542 out: The output file.
3643 upgrade: Tell `uv` to always upgrade the dependencies instead of
3744 keeping them as they are.
3845 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.
4146 args: Extra args to pass to the rule.
4247 **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.
4848 """
4949 pkg = native .package_name ()
5050 update_target = name + ".update"
@@ -92,10 +92,6 @@ def lock(*, name, srcs, out, upgrade = False, universal = True, python_version =
9292 Label ("//python:current_py_toolchain" ),
9393 ],
9494 )
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
9995
10096 # Write a script that can be used for updating the in-tree version of the
10197 # requirements file
@@ -116,7 +112,7 @@ def lock(*, name, srcs, out, upgrade = False, universal = True, python_version =
116112 ],
117113 )
118114
119- py_binary_rule (
115+ py_binary (
120116 name = update_target ,
121117 srcs = [update_target + ".py" ],
122118 main = update_target + ".py" ,
0 commit comments