Skip to content

Commit 3b2b838

Browse files
committed
feat: add a tool to update dependencies
Before this change the updates to the dependencies would happen very seldomly, with this script, I propose we do it before each minor version release. Adding a shell script and adding a reminder to the release process may help with that.
1 parent 49d2b7a commit 3b2b838

File tree

4 files changed

+62
-10
lines changed

4 files changed

+62
-10
lines changed

DEVELOPING.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ Before running through the release it's good to run the build and the tests loca
88
also test-drive the commit in an existing Bazel workspace to sanity check functionality.
99

1010
#### Steps
11+
1. (Optional) bump the internal dependencies using the script `./tools/print_pip_deps.sh`.
12+
1. (Optional) bump the coverage dependencies using the script `./tools/update_coverage_deps.py`
1113
1. [Determine the next semantic version number](#determining-semantic-version)
1214
1. Create a tag and push, e.g. `git tag 0.5.0 upstream/main && git push upstream --tags`
1315
NOTE: Pushing the tag will trigger release automation.

MODULE.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ internal_deps = use_extension("@rules_python//python/extensions/private:internal
1515
internal_deps.install()
1616
use_repo(
1717
internal_deps,
18+
# Generated with //tools:print_pip_deps.sh
1819
"pypi__build",
1920
"pypi__click",
2021
"pypi__colorama",

python/pip_install/repositories.bzl

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
2020
load("//:version.bzl", "MINIMUM_BAZEL_VERSION")
2121

2222
_RULE_DEPS = [
23+
# Generated with //tools:print_pip_deps.sh
2324
(
2425
"pypi__build",
2526
"https://files.pythonhosted.org/packages/03/97/f58c723ff036a8d8b4d3115377c0a37ed05c1f68dd9a0d66dab5e82c5c1c/build-0.9.0-py3-none-any.whl",
@@ -35,11 +36,21 @@ _RULE_DEPS = [
3536
"https://files.pythonhosted.org/packages/d1/d6/3965ed04c63042e047cb6a3e6ed1a63a35087b6a609aa3a15ed8ac56c221/colorama-0.4.6-py2.py3-none-any.whl",
3637
"4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6",
3738
),
39+
(
40+
"pypi__importlib_metadata",
41+
"https://files.pythonhosted.org/packages/d7/31/74dcb59a601b95fce3b0334e8fc9db758f78e43075f22aeb3677dfb19f4c/importlib_metadata-1.4.0-py2.py3-none-any.whl",
42+
"bdd9b7c397c273bcc9a11d6629a38487cd07154fa255a467bf704cd2c258e359",
43+
),
3844
(
3945
"pypi__installer",
4046
"https://files.pythonhosted.org/packages/e5/ca/1172b6638d52f2d6caa2dd262ec4c811ba59eee96d54a7701930726bce18/installer-0.7.0-py3-none-any.whl",
4147
"05d1933f0a5ba7d8d6296bb6d5018e7c94fa473ceb10cf198a92ccea19c27b53",
4248
),
49+
(
50+
"pypi__more_itertools",
51+
"https://files.pythonhosted.org/packages/bd/3f/c4b3dbd315e248f84c388bd4a72b131a29f123ecacc37ffb2b3834546e42/more_itertools-8.13.0-py3-none-any.whl",
52+
"c5122bffc5f104d37c1626b8615b511f3427aa5389b94d61e5ef8236bfbc3ddb",
53+
),
4354
(
4455
"pypi__packaging",
4556
"https://files.pythonhosted.org/packages/8f/7b/42582927d281d7cb035609cd3a543ffac89b74f3f4ee8e1c50914bcb57eb/packaging-22.0-py3-none-any.whl",
@@ -75,21 +86,11 @@ _RULE_DEPS = [
7586
"https://files.pythonhosted.org/packages/bd/7c/d38a0b30ce22fc26ed7dbc087c6d00851fb3395e9d0dac40bec1f905030c/wheel-0.38.4-py3-none-any.whl",
7687
"b60533f3f5d530e971d6737ca6d58681ee434818fab630c83a734bb10c083ce8",
7788
),
78-
(
79-
"pypi__importlib_metadata",
80-
"https://files.pythonhosted.org/packages/d7/31/74dcb59a601b95fce3b0334e8fc9db758f78e43075f22aeb3677dfb19f4c/importlib_metadata-1.4.0-py2.py3-none-any.whl",
81-
"bdd9b7c397c273bcc9a11d6629a38487cd07154fa255a467bf704cd2c258e359",
82-
),
8389
(
8490
"pypi__zipp",
8591
"https://files.pythonhosted.org/packages/f4/50/cc72c5bcd48f6e98219fc4a88a5227e9e28b81637a99c49feba1d51f4d50/zipp-1.0.0-py2.py3-none-any.whl",
8692
"8dda78f06bd1674bd8720df8a50bb47b6e1233c503a4eed8e7810686bde37656",
8793
),
88-
(
89-
"pypi__more_itertools",
90-
"https://files.pythonhosted.org/packages/bd/3f/c4b3dbd315e248f84c388bd4a72b131a29f123ecacc37ffb2b3834546e42/more_itertools-8.13.0-py3-none-any.whl",
91-
"c5122bffc5f104d37c1626b8615b511f3427aa5389b94d61e5ef8236bfbc3ddb",
92-
),
9394
]
9495

9596
_GENERIC_WHEEL = """\

tools/print_pip_deps.sh

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#!/bin/bash
2+
#
3+
# A script to manage internal dependencies
4+
5+
internal_deps=(
6+
build==0.9
7+
click==8.0.1
8+
colorama
9+
importlib_metadata==1.4.0
10+
installer
11+
more_itertools==8.13.0
12+
packaging==22.0
13+
pep517
14+
pip==22.3.1
15+
pip_tools==6.12.1
16+
setuptools==60.10
17+
tomli
18+
wheel==0.38.4
19+
zipp==1.0.0
20+
)
21+
echo "Copy the following to //python/pip_install/requirements.bzl"
22+
echo " # Generated with //tools:$(basename $0)"
23+
report=$(python -m pip install --quiet --dry-run --ignore-installed --report - ${internal_deps[@]})
24+
25+
echo "$report" |
26+
# FIXME: not sure how to sub `.` with jq as usual escaping with `\` fails.
27+
jq -r ".install[] \
28+
| [\"pypi__\" + (.metadata.name | sub(\"[_-]+\"; \"_\")), \
29+
.download_info.url, \
30+
.download_info.archive_info.hashes.sha256] \
31+
| @csv" |
32+
sort |
33+
sed -e "s/.*/(\0,),/g" \
34+
-e "s/(/ (\n /g" \
35+
-e "s/\",\"/\",\n \"/g" \
36+
-e "s/,)/,\n )/g"
37+
38+
echo ""
39+
echo "====================================="
40+
echo " Copy the following to MODULE.bazel"
41+
echo "====================================="
42+
echo " # Generated with //tools:$(basename $0)"
43+
echo "$report" |
44+
jq -r ".install[] \
45+
| [\"pypi__\" + (.metadata.name | sub(\"[_-]+\"; \"_\"))] \
46+
| @csv" |
47+
sort |
48+
sed "s/.*/ \0,/g"

0 commit comments

Comments
 (0)