File tree Expand file tree Collapse file tree 2 files changed +27
-27
lines changed Expand file tree Collapse file tree 2 files changed +27
-27
lines changed Original file line number Diff line number Diff line change 1414
1515"""The `uv` locking rule.
1616
17+ Differences with the legacy {obj}`compile_pip_requirements` rule:
18+ - This is implemented as a rule that performs locking in a build action.
19+ - Additionally one can use the runnable target.
20+ - Uses `uv`.
21+ - This does not error out if the output file does not exist yet.
22+ - Supports transitions out of the box.
23+
24+ Note, this does not provide a `test` target, if you would like to add a test
25+ target that always does the locking automatically to ensure that the
26+ `requirements.txt` file is up-to-date, add something similar to:
27+
28+ ```starlark
29+ load("@bazel_skylib//rules:native_binary.bzl", "native_test")
30+ load("@rules_python//python/uv:lock.bzl", "lock")
31+
32+ lock(
33+ name = "requirements",
34+ srcs = ["pyproject.toml"],
35+ )
36+
37+ native_test(
38+ name = "requirements_test",
39+ src = "requirements.update",
40+ )
41+ ```
42+
1743EXPERIMENTAL: This is experimental and may be removed without notice
1844"""
1945
Original file line number Diff line number Diff line change 1212# See the License for the specific language governing permissions and
1313# limitations under the License.
1414
15- """A simple macro to lock the requirements.
16-
17- Differences with the legacy {obj}`compile_pip_requirements` rule:
18- - This is implemented as a rule that performs locking in a build action.
19- - Additionally one can use the runnable target.
20- - Uses `uv`.
21- - This does not error out if the output file does not exist yet.
22- - Supports transitions out of the box.
23-
24- Note, this does not provide a `test` target, if you would like to add a test
25- target that always does the locking automatically to ensure that the
26- `requirements.txt` file is up-to-date, add something similar to:
27-
28- ```starlark
29- load("@bazel_skylib//rules:native_binary.bzl", "native_test")
30- load("@rules_python//python/uv:lock.bzl", "lock")
31-
32- lock(
33- name = "requirements",
34- srcs = ["pyproject.toml"],
35- )
36-
37- native_test(
38- name = "requirements_test",
39- src = "requirements.update",
40- )
41- ```
15+ """An implementation for a simple macro to lock the requirements.
4216"""
4317
4418load ("@bazel_skylib//lib:shell.bzl" , "shell" )
You can’t perform that action at this time.
0 commit comments