-
Notifications
You must be signed in to change notification settings - Fork 811
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[bazel,python] vendor in requirements.bzl
Our current version of rules_python autogenerates the `requirements.bzl` file from a `requirements.txt` lock file. However, this is awkward if this project is ever a dependency of another downstream bazel project, as shown here: bazelbuild/rules_python#608 To circumvent this issue, rules_python provides a mechanism to vendor in the requirements.bzl file into the repo, which this commit does. Signed-off-by: Tim Trippel <[email protected]>
- Loading branch information
1 parent
7ea4040
commit b2c2529
Showing
30 changed files
with
561 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,21 @@ | ||
# Adding Python Dependencies to the Project | ||
# Python Dependency Management | ||
|
||
To comply with software supply chain security requirements of various project partner organizations, we pin our Python packages to specific versions, and provide hashes for each dependency (including transitive dependencies). | ||
We accomplish this with the help of the `pip-compile` tool, which is part of the `pip-tools` package. | ||
|
||
Additionally, to make it easier for downstream Bazel projects to dependend on this Bazel project (`@lowrisc_opentitan`), we vendor in the autogenerated `requirements.bzl` file produced by `rules_python`, see the `rules_python` [documentation](https://rules-python.readthedocs.io/en/0.39.0/pypi-dependencies.html#vendoring-the-requirements-bzl-file) for more details. | ||
|
||
# Adding Python Dependencies to the Project | ||
If you need to add another Python package to the project, do so by: | ||
1. adding the package and version number to the `python-requirements.in` file, in the form of `<package>==<version>`, and | ||
1. run the script `util/sh/scripts/gen-python-requirements.sh`, which will auto-generate the updated `python-requirements.txt` file. | ||
1. adding the package and version number to the `python-requirements.in` file, in the form of `<package>==<version>`, | ||
1. running the script `util/sh/scripts/gen-python-requirements.sh`, which will auto-generate the updated `python-requirements.txt` file as shown below, and | ||
1. running the `//third_party/python:vendor_requirements` Bazel target which will update the vendored in `requirements.bzl` file as shown below. | ||
|
||
```sh | ||
# Update autogenerated python package management files. | ||
./util/sh/scripts/gen-python-requirements.sh > python-requirements.txt | ||
bazel run //third_party/python:vendor_requirements | ||
|
||
# Check that the package management files are up to date. | ||
bazel test //third_party/python/... | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.