|
5 | 5 |
|
6 | 6 | :::{note}
|
7 | 7 | Currently `rules_python` only supports `requirements.txt` format.
|
| 8 | + |
| 9 | +#{gh-issue}`2787` tracks `pylock.toml` support. |
8 | 10 | :::
|
9 | 11 |
|
10 | 12 | ## requirements.txt
|
@@ -37,11 +39,33 @@ This rule generates two targets:
|
37 | 39 | Once you generate this fully specified list of requirements, you can install the requirements ([bzlmod](./download)/[WORKSPACE](./download-workspace)).
|
38 | 40 |
|
39 | 41 | :::{warning}
|
40 |
| -If you're specifying dependencies in `pyproject.toml`, make sure to include the `[build-system]` configuration, with pinned dependencies. `compile_pip_requirements` will use the build system specified to read your project's metadata, and you might see non-hermetic behavior if you don't pin the build system. |
| 42 | +If you're specifying dependencies in `pyproject.toml`, make sure to include the |
| 43 | +`[build-system]` configuration, with pinned dependencies. |
| 44 | +`compile_pip_requirements` will use the build system specified to read your |
| 45 | +project's metadata, and you might see non-hermetic behavior if you don't pin the |
| 46 | +build system. |
41 | 47 |
|
42 |
| -Not specifying `[build-system]` at all will result in using a default `[build-system]` configuration, which uses unpinned versions ([ref](https://peps.python.org/pep-0518/#build-system-table)). |
| 48 | +Not specifying `[build-system]` at all will result in using a default |
| 49 | +`[build-system]` configuration, which uses unpinned versions |
| 50 | +([ref](https://peps.python.org/pep-0518/#build-system-table)). |
43 | 51 | :::
|
44 | 52 |
|
| 53 | + |
| 54 | +#### pip compile Dependency groups |
| 55 | + |
| 56 | +pip-compile doesn't yet support pyproject.toml dependency groups. Follow |
| 57 | +[pip-tools #2062](https://github.com/jazzband/pip-tools/issues/2062) |
| 58 | +to see the status of their support. |
| 59 | + |
| 60 | +In the meantime, support can be emulated by passing multiple files to `srcs`: |
| 61 | + |
| 62 | +```starlark |
| 63 | +compile_pip_requirements( |
| 64 | + srcs = ["pyproject.toml", "requirements-dev.in"] |
| 65 | + ... |
| 66 | +) |
| 67 | +``` |
| 68 | + |
45 | 69 | ### uv pip compile (bzlmod only)
|
46 | 70 |
|
47 | 71 | We also have experimental setup for the `uv pip compile` way of generating lock files.
|
|
0 commit comments