You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
2.[Installing third party packages](#installing-third-party-packages)
10
+
3.[Using third party packages as dependencies](#using-third-party-packages)
11
+
12
+
{#generating-requirements-file}
13
+
## Generating requirements file
14
+
15
+
Generally, when working on a Python project, you'll have some dependencies that themselves have other dependencies. You might also specify dependency bounds instead of specific versions. So you'll need to generate a full list of all transitive dependencies and pinned versions for every dependency.
16
+
17
+
Typically, you'd have your dependencies specified in `pyproject.toml` or `requirements.in` and generate the full pinned list of dependencies in `requirements_lock.txt`, which you can manage with the `compile_pip_requirements` Bazel rule:
-`bazel run [name].update` will regenerate the `requirements_txt` file
31
+
-`bazel test [name]_test` will test that the `requirements_txt` file is up to date
32
+
33
+
For more documentation, see the API docs under {obj}`@rules_python//python:pip.bzl`.
34
+
35
+
Once you generate this fully specified list of requirements, you can install the requirements with the instructions in [Installing third party packages](#installing-third-party-packages).
36
+
37
+
:::{warning}
38
+
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.
39
+
40
+
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)).
41
+
:::
10
42
11
43
{#installing-third-party-packages}
12
44
## Installing third party packages
@@ -27,8 +59,7 @@ pip.parse(
27
59
)
28
60
use_repo(pip, "my_deps")
29
61
```
30
-
For more documentation, including how the rules can update/create a requirements
31
-
file, see the bzlmod examples under the {gh-path}`examples` folder or the documentation
62
+
For more documentation, see the bzlmod examples under the {gh-path}`examples` folder or the documentation
32
63
for the {obj}`@rules_python//python/extensions:pip.bzl` extension.
0 commit comments