Skip to content

Commit 7d4b8a5

Browse files
authored
chore: bump twine dependencies and cleanup for 1.0 (bazel-contrib#2333)
This change updates the `requirements.txt` for all of the platforms for the `twine` component that is used in wheel publishing rules. Before that the deps would be maintained by `dependabot.txt` and it seems that it would constantly exclude the `requirements.txt` from the updated files, this means that the `requirements.txt` (used on Linux) has gone out of sync and it would be better to use a different mechanism to keep them in sync. Hence the proposal is to: - Use `uv` to sync the requirements. - Add `requirements_linux.txt` to explicitly highlight that the file is for Linux. - Keep `requirements.txt` but note that it is deprecated. - Add `requirements_universal.txt` in case people want to use a single requirements file. - Bump the dependencies to the latest versions and bring them back in sync. Whilst at it I had to: - support extra parameters in the locking format and allow setting visibility - chore: add `rules_multirun` as a `dev_dependency` - refactor: `uv pip compile` requirements for tools/publish - chore: bump uv to 0.4.25
1 parent c7a2078 commit 7d4b8a5

23 files changed

+2419
-1045
lines changed

.bazelrc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
# (Note, we cannot use `common --deleted_packages` because the bazel version command doesn't support it)
55
# To update these lines, execute
66
# `bazel run @rules_bazel_integration_test//tools:update_deleted_packages`
7-
build --deleted_packages=examples/build_file_generation,examples/build_file_generation/random_number_generator,examples/bzlmod,examples/bzlmod_build_file_generation,examples/bzlmod_build_file_generation/other_module/other_module/pkg,examples/bzlmod_build_file_generation/runfiles,examples/bzlmod/entry_points,examples/bzlmod/entry_points/tests,examples/bzlmod/libs/my_lib,examples/bzlmod/other_module,examples/bzlmod/other_module/other_module/pkg,examples/bzlmod/patches,examples/bzlmod/py_proto_library,examples/bzlmod/py_proto_library/example.com/another_proto,examples/bzlmod/py_proto_library/example.com/proto,examples/bzlmod/runfiles,examples/bzlmod/tests,examples/bzlmod/tests/other_module,examples/bzlmod/whl_mods,examples/multi_python_versions/libs/my_lib,examples/multi_python_versions/requirements,examples/multi_python_versions/tests,examples/pip_parse,examples/pip_parse_vendored,examples/pip_repository_annotations,examples/py_proto_library,examples/py_proto_library/example.com/another_proto,examples/py_proto_library/example.com/proto,gazelle,gazelle/manifest,gazelle/manifest/generate,gazelle/manifest/hasher,gazelle/manifest/test,gazelle/modules_mapping,gazelle/python,gazelle/pythonconfig,gazelle/python/private,tests/integration/compile_pip_requirements,tests/integration/compile_pip_requirements_test_from_external_repo,tests/integration/custom_commands,tests/integration/ignore_root_user_error,tests/integration/ignore_root_user_error/submodule,tests/integration/local_toolchains,tests/integration/pip_parse,tests/integration/pip_parse/empty,tests/integration/py_cc_toolchain_registered
8-
query --deleted_packages=examples/build_file_generation,examples/build_file_generation/random_number_generator,examples/bzlmod,examples/bzlmod_build_file_generation,examples/bzlmod_build_file_generation/other_module/other_module/pkg,examples/bzlmod_build_file_generation/runfiles,examples/bzlmod/entry_points,examples/bzlmod/entry_points/tests,examples/bzlmod/libs/my_lib,examples/bzlmod/other_module,examples/bzlmod/other_module/other_module/pkg,examples/bzlmod/patches,examples/bzlmod/py_proto_library,examples/bzlmod/py_proto_library/example.com/another_proto,examples/bzlmod/py_proto_library/example.com/proto,examples/bzlmod/runfiles,examples/bzlmod/tests,examples/bzlmod/tests/other_module,examples/bzlmod/whl_mods,examples/multi_python_versions/libs/my_lib,examples/multi_python_versions/requirements,examples/multi_python_versions/tests,examples/pip_parse,examples/pip_parse_vendored,examples/pip_repository_annotations,examples/py_proto_library,examples/py_proto_library/example.com/another_proto,examples/py_proto_library/example.com/proto,gazelle,gazelle/manifest,gazelle/manifest/generate,gazelle/manifest/hasher,gazelle/manifest/test,gazelle/modules_mapping,gazelle/python,gazelle/pythonconfig,gazelle/python/private,tests/integration/compile_pip_requirements,tests/integration/compile_pip_requirements_test_from_external_repo,tests/integration/custom_commands,tests/integration/ignore_root_user_error,tests/integration/ignore_root_user_error/submodule,tests/integration/local_toolchains,tests/integration/pip_parse,tests/integration/pip_parse/empty,tests/integration/py_cc_toolchain_registered
7+
build --deleted_packages=examples/build_file_generation,examples/build_file_generation/random_number_generator,examples/bzlmod,examples/bzlmod/entry_points,examples/bzlmod/entry_points/tests,examples/bzlmod/libs/my_lib,examples/bzlmod/other_module,examples/bzlmod/other_module/other_module/pkg,examples/bzlmod/patches,examples/bzlmod/py_proto_library,examples/bzlmod/py_proto_library/example.com/another_proto,examples/bzlmod/py_proto_library/example.com/proto,examples/bzlmod/runfiles,examples/bzlmod/tests,examples/bzlmod/tests/other_module,examples/bzlmod/whl_mods,examples/bzlmod_build_file_generation,examples/bzlmod_build_file_generation/other_module/other_module/pkg,examples/bzlmod_build_file_generation/runfiles,examples/multi_python_versions/libs/my_lib,examples/multi_python_versions/requirements,examples/multi_python_versions/tests,examples/pip_parse,examples/pip_parse_vendored,examples/pip_repository_annotations,examples/py_proto_library,examples/py_proto_library/example.com/another_proto,examples/py_proto_library/example.com/proto,gazelle,gazelle/manifest,gazelle/manifest/generate,gazelle/manifest/hasher,gazelle/manifest/test,gazelle/modules_mapping,gazelle/python,gazelle/python/private,gazelle/pythonconfig,tests/integration/compile_pip_requirements,tests/integration/compile_pip_requirements_test_from_external_repo,tests/integration/custom_commands,tests/integration/ignore_root_user_error,tests/integration/ignore_root_user_error/submodule,tests/integration/local_toolchains,tests/integration/pip_parse,tests/integration/pip_parse/empty,tests/integration/py_cc_toolchain_registered
8+
query --deleted_packages=examples/build_file_generation,examples/build_file_generation/random_number_generator,examples/bzlmod,examples/bzlmod/entry_points,examples/bzlmod/entry_points/tests,examples/bzlmod/libs/my_lib,examples/bzlmod/other_module,examples/bzlmod/other_module/other_module/pkg,examples/bzlmod/patches,examples/bzlmod/py_proto_library,examples/bzlmod/py_proto_library/example.com/another_proto,examples/bzlmod/py_proto_library/example.com/proto,examples/bzlmod/runfiles,examples/bzlmod/tests,examples/bzlmod/tests/other_module,examples/bzlmod/whl_mods,examples/bzlmod_build_file_generation,examples/bzlmod_build_file_generation/other_module/other_module/pkg,examples/bzlmod_build_file_generation/runfiles,examples/multi_python_versions/libs/my_lib,examples/multi_python_versions/requirements,examples/multi_python_versions/tests,examples/pip_parse,examples/pip_parse_vendored,examples/pip_repository_annotations,examples/py_proto_library,examples/py_proto_library/example.com/another_proto,examples/py_proto_library/example.com/proto,gazelle,gazelle/manifest,gazelle/manifest/generate,gazelle/manifest/hasher,gazelle/manifest/test,gazelle/modules_mapping,gazelle/python,gazelle/python/private,gazelle/pythonconfig,tests/integration/compile_pip_requirements,tests/integration/compile_pip_requirements_test_from_external_repo,tests/integration/custom_commands,tests/integration/ignore_root_user_error,tests/integration/ignore_root_user_error/submodule,tests/integration/local_toolchains,tests/integration/pip_parse,tests/integration/pip_parse/empty,tests/integration/py_cc_toolchain_registered
99

1010
test --test_output=errors
1111

CHANGELOG.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,24 @@ A brief description of the categories of changes:
3131
version used; this for Bazel 8+ support (previously version was rules_cc 0.0.9
3232
and no protobuf version specified)
3333
([2310](https://github.com/bazelbuild/rules_python/issues/2310)).
34+
* (publish) The dependencies have been updated to the latest available versions
35+
for the `twine` publishing rule.
3436

3537
{#v0-0-0-fixed}
3638
### Fixed
37-
- Nothing yet
39+
* Nothing yet
3840

3941
{#v0-0-0-added}
4042
### Added
41-
- Nothing yet
43+
* (publish) The requirements file for the `twine` publishing rules have been
44+
updated to have a new convention: `requirements_darwin.txt`,
45+
`requirements_linux.txt`, `requirements_windows.txt` for each respective OS
46+
and one extra file `requirements_universal.txt` if you prefer a single file.
47+
The `requirements.txt` file may be removed in the future.
4248

4349
{#v0-0-0-removed}
4450
### Removed
45-
- Nothing yet
51+
* Nothing yet
4652

4753
{#v0-37-1}
4854
## [0.37.1] - 2024-10-22

CONTRIBUTING.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,15 @@ and setup. Subsequent runs will be faster, but there are many tests, and some of
6565
them are slow. If you're working on a particular area of code, you can run just
6666
the tests in those directories instead, which can speed up your edit-run cycle.
6767

68+
## Updating tool dependencies
69+
70+
It's suggested to routinely update the tool versions within our repo - some of the
71+
tools are using requirement files compiled by `uv` and others use other means. In order
72+
to have everything self-documented, we have a special target -
73+
`//private:requirements.update`, which uses `rules_multirun` to run in sequence all
74+
of the requirement updating scripts in one go. This can be done once per release as
75+
we prepare for releases.
76+
6877
## Formatting
6978

7079
Starlark files should be formatted by

DEVELOPING.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@
44

55
1. Modify the `./python/private/pypi/requirements.txt` file and run:
66
```
7-
bazel run //tools/private/update_deps:update_pip_deps
7+
bazel run //private:whl_library_requirements.update
8+
```
9+
1. Run the following target to update `twine` dependencies:
10+
```
11+
bazel run //private:requirements.update
812
```
913
1. Bump the coverage dependencies using the script using:
1014
```

MODULE.bazel

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ pip.parse(
5959
hub_name = "rules_python_publish_deps",
6060
python_version = "3.11",
6161
requirements_by_platform = {
62-
"//tools/publish:requirements.txt": "linux_*",
6362
"//tools/publish:requirements_darwin.txt": "osx_*",
63+
"//tools/publish:requirements_linux.txt": "linux_*",
6464
"//tools/publish:requirements_windows.txt": "windows_*",
6565
},
6666
)
@@ -73,6 +73,7 @@ bazel_dep(name = "stardoc", version = "0.6.2", repo_name = "io_bazel_stardoc")
7373
bazel_dep(name = "rules_bazel_integration_test", version = "0.20.0", dev_dependency = True)
7474
bazel_dep(name = "rules_testing", version = "0.6.0", dev_dependency = True)
7575
bazel_dep(name = "rules_shell", version = "0.2.0", dev_dependency = True)
76+
bazel_dep(name = "rules_multirun", version = "0.9.0", dev_dependency = True)
7677

7778
# Extra gazelle plugin deps so that WORKSPACE.bzlmod can continue including it for e2e tests.
7879
# We use `WORKSPACE.bzlmod` because it is impossible to have dev-only local overrides.
@@ -140,7 +141,7 @@ uv = use_extension(
140141
"uv",
141142
dev_dependency = True,
142143
)
143-
uv.toolchain(uv_version = "0.2.23")
144+
uv.toolchain(uv_version = "0.4.25")
144145
use_repo(uv, "uv_toolchains")
145146

146147
register_toolchains(

docs/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ lock(
158158
srcs = ["pyproject.toml"],
159159
out = "requirements.txt",
160160
upgrade = True,
161+
visibility = ["//private:__pkg__"],
161162
)
162163

163164
# Temporary compatibility aliases for some other projects depending on the old

0 commit comments

Comments
 (0)