Skip to content

Commit fca92bd

Browse files
committed
Merge branch 'main' into refactor/use-whl-alias-in-hub
2 parents 65db903 + 5913816 commit fca92bd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+735
-20518
lines changed

.bazelci/presubmit.yml

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ tasks:
132132
bazel: last_rc
133133
ubuntu_workspace:
134134
<<: *reusable_config
135+
<<: *common_workspace_flags
135136
name: "Default: Ubuntu, workspace"
136137
platform: ubuntu2004
137138
mac_workspace:
@@ -141,8 +142,30 @@ tasks:
141142
platform: macos
142143
windows_workspace:
143144
<<: *reusable_config
145+
<<: *common_workspace_flags
144146
name: "Default: Windows, workspace"
145147
platform: windows
148+
# Most of tests/integration are failing on Windows w/workspace. Skip them
149+
# for now until we can look into it.
150+
build_targets:
151+
- "--"
152+
- "..."
153+
# As a regression test for #225, check that wheel targets still build when
154+
# their package path is qualified with the repo name.
155+
- "@rules_python//examples/wheel/..."
156+
build_flags:
157+
- "--noenable_bzlmod"
158+
- "--enable_workspace"
159+
- "--keep_going"
160+
- "--build_tag_filters=-integration-test"
161+
- "--config=bazel7.x"
162+
test_targets:
163+
- "--"
164+
- "..."
165+
test_flags:
166+
- "--noenable_bzlmod"
167+
- "--enable_workspace"
168+
- "--test_tag_filters=-integration-test"
146169

147170
debian:
148171
<<: *reusable_config
@@ -275,28 +298,6 @@ tasks:
275298
working_directory: examples/bzlmod
276299
platform: windows
277300
bazel: last_rc
278-
integration_test_bzlmod_ubuntu_lockfile:
279-
<<: *reusable_build_test_all
280-
<<: *coverage_targets_example_bzlmod
281-
name: "examples/bzlmod: Ubuntu with lockfile"
282-
working_directory: examples/bzlmod
283-
platform: ubuntu2004
284-
bazel: 7.x
285-
shell_commands:
286-
# Update the lockfiles and fail if it is different.
287-
- "../../tools/private/update_bzlmod_lockfiles.sh"
288-
- "git diff --exit-code"
289-
integration_test_bzlmod_macos_lockfile:
290-
<<: *reusable_build_test_all
291-
<<: *coverage_targets_example_bzlmod
292-
name: "examples/bzlmod: macOS with lockfile"
293-
working_directory: examples/bzlmod
294-
platform: macos
295-
bazel: 7.x
296-
shell_commands:
297-
# Update the lockfiles and fail if it is different.
298-
- "../../tools/private/update_bzlmod_lockfiles.sh"
299-
- "git diff --exit-code"
300301

301302
integration_test_bzlmod_generate_build_file_generation_ubuntu_min:
302303
<<: *minimum_supported_version

.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/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
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
99

1010
test --test_output=errors
1111

.github/CODEOWNERS

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
* @rickeylev @aignas
44

55
# Directory containing the Gazelle extension and Go code.
6-
/gazelle/ @f0rmiga
7-
/examples/build_file_generation/ @f0rmiga
6+
/gazelle/ @dougthor42 @aignas
7+
/examples/build_file_generation/ @dougthor42 @aignas
88

99
# PyPI integration related code
10-
/python/private/pypi/ @aignas @groodt
11-
/tests/pypi/ @aignas @groodt
10+
/python/private/pypi/ @rickeylev @aignas @groodt
11+
/tests/pypi/ @rickeylev @aignas @groodt

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,3 @@ user.bazelrc
5252
# MODULE.bazel.lock is ignored for now as per recommendation from upstream.
5353
# See https://github.com/bazelbuild/bazel/issues/20369
5454
MODULE.bazel.lock
55-
!/examples/bzlmod/MODULE.bazel.lock

.pre-commit-config.yaml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,3 @@ repos:
4949
entry: bazel run @rules_bazel_integration_test//tools:update_deleted_packages
5050
files: ^((examples|tests)/.*/(MODULE.bazel|WORKSPACE|WORKSPACE.bzlmod|BUILD.bazel)|.bazelrc)$
5151
pass_filenames: false
52-
- id: update-bzlmod-lockfiles
53-
name: Update bzlmod lockfiles
54-
language: script
55-
entry: ./tools/private/update_bzlmod_lockfiles.sh
56-
files: ^python/
57-
pass_filenames: false

CHANGELOG.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,17 @@ Unreleased changes template.
6868
{bzl:obj}`python_register_toolchains` and
6969
{bzl:obj}`python_register_multi_toolchains` macros or the {bzl:obj}`python`
7070
bzlmod extension.
71+
* (bzlmod) `pip.parse.parse_all_requirements_files` attribute has been removed.
72+
See notes in the previous versions about what to do.
73+
* (deps) rules_cc 0.1.0 (workspace) and 0.0.16 (bzlmod).
74+
* (deps) protobuf 29.0-rc2 (workspace; bzlmod already specifying that version).
7175

7276
Other changes:
7377
* (python_repository) Start honoring the `strip_prefix` field for `zstd` archives.
7478
* (pypi) {bzl:obj}`pip_parse.extra_hub_aliases` now works in WORKSPACE files.
79+
* (binaries/tests) For {obj}`--bootstrap_impl=script`, a binary-specific (but
80+
otherwise empty) virtual env is used to customize `sys.path` initialization.
81+
* (deps) bazel_skylib 1.7.0 (workspace; bzlmod already specifying that version)
7582

7683
{#v0-0-0-fixed}
7784
### Fixed
@@ -81,11 +88,16 @@ Other changes:
8188
Fixes ([2337](https://github.com/bazelbuild/rules_python/issues/2337)).
8289
* (uv): Correct the sha256sum for the `uv` binary for aarch64-apple-darwin.
8390
Fixes ([2411](https://github.com/bazelbuild/rules_python/issues/2411)).
91+
* (binaries/tests) ({obj}`--bootstrap_impl=scipt`) Using `sys.executable` will
92+
use the same `sys.path` setup as the calling binary.
93+
([2169](https://github.com/bazelbuild/rules_python/issues/2169)).
94+
* (workspace) Corrected protobuf's name to com_google_protobuf, the name is
95+
hardcoded in Bazel, WORKSPACE mode.
8496

8597
{#v0-0-0-added}
8698
### Added
8799
* (gazelle): Parser failures will now be logged to the terminal. Additional
88-
details can be logged by setting `GAZELLE_VERBOSE=1`.
100+
details can be logged by setting `RULES_PYTHON_GAZELLE_VERBOSE=1`.
89101
* (toolchains) allow users to select which variant of the support host toolchain
90102
they would like to use through
91103
`RULES_PYTHON_REPO_TOOLCHAIN_{VERSION}_{OS}_{ARCH}` env variable setting. For
@@ -95,6 +107,9 @@ Other changes:
95107
for the latest toolchain versions for each minor Python version. You can control
96108
the toolchain selection by using the
97109
{bzl:obj}`//python/config_settings:py_linux_libc` build flag.
110+
* (providers) Added {obj}`py_runtime_info.site_init_template` and
111+
{obj}`PyRuntimeInfo.site_init_template` for specifying the template to use to
112+
initialize the interpreter via venv startup hooks.
98113

99114
{#v0-0-0-removed}
100115
### Removed
@@ -214,7 +229,7 @@ Other changes:
214229
* (bzlmod) The extension evaluation has been adjusted to always generate the
215230
same lock file irrespective if `experimental_index_url` is set by any module
216231
or not. To opt into this behavior, set
217-
{bzl:obj}`pip.parse.parse_all_requirements_files`, which will become the
232+
`pip.parse.parse_all_requirements_files`, which will become the
218233
default in future releases leading up to `1.0.0`. Fixes
219234
[#2268](https://github.com/bazelbuild/rules_python/issues/2268). A known
220235
issue is that it may break `bazel query` and in these use cases it is

DEVELOPING.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ The fix being included is commit `deadbeef`.
5656
1. `git checkout -b release/0.37 0.37.0`
5757
1. `git push upstream release/0.37`
5858
1. `git cherry-pick -x deadbeef`
59-
1. Fix merge conflicts, if any. If `MODULE.bazel.lock` conflicts occur, then
60-
run `pre-commit run update-bzlmod-lockfiles -a`
59+
1. Fix merge conflicts, if any.
6160
1. `git cherry-pick --continue` (if applicable)
6261
1. `git push upstream`
6362

MODULE.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module(
66

77
bazel_dep(name = "bazel_features", version = "1.9.1")
88
bazel_dep(name = "bazel_skylib", version = "1.7.1")
9-
bazel_dep(name = "rules_cc", version = "0.0.14")
9+
bazel_dep(name = "rules_cc", version = "0.0.16")
1010
bazel_dep(name = "platforms", version = "0.0.4")
1111

1212
# Those are loaded only when using py_proto_library
@@ -54,7 +54,7 @@ register_toolchains("@pythons_hub//:all")
5454
#####################
5555
# Install twine for our own runfiles wheel publishing and allow bzlmod users to use it.
5656

57-
pip = use_extension("//python/private/pypi:pip.bzl", "pip_internal")
57+
pip = use_extension("//python/extensions:pip.bzl", "pip")
5858
pip.parse(
5959
# NOTE @aignas 2024-10-26: We have an integration test that depends on us
6060
# being able to build sdists for this hub, so explicitly set this to False.

docs/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ _TARGET_COMPATIBLE_WITH = select({
3636
"@platforms//os:linux": [],
3737
"@platforms//os:macos": [],
3838
"//conditions:default": ["@platforms//:incompatible"],
39-
}) if IS_BAZEL_7_OR_HIGHER else ["@platforms//:incompatible"]
39+
}) if BZLMOD_ENABLED else ["@platforms//:incompatible"]
4040

4141
# See README.md for instructions. Short version:
4242
# * `bazel run //docs:docs.serve` in a separate terminal

docs/environment-variables.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,9 @@ stderr.
5656

5757
When `1`, debug information about coverage behavior is printed to stderr.
5858
:::
59+
60+
61+
:::{envvar} RULES_PYTHON_GAZELLE_VERBOSE
62+
63+
When `1`, debug information from gazelle is printed to stderr.
64+
:::

0 commit comments

Comments
 (0)