Skip to content

Commit 20d3080

Browse files
authored
Merge branch 'main' into fix/1975/uv-auth
2 parents 08d42e5 + af9e959 commit 20d3080

Some content is hidden

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

63 files changed

+1613
-849
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,tests/modules/other,tests/modules/other/nspkg_delta,tests/modules/other/nspkg_gamma
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,tests/modules/other,tests/modules/other/nspkg_delta,tests/modules/other/nspkg_gamma
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,tests/modules/other,tests/modules/other/nspkg_delta,tests/modules/other/nspkg_gamma,tests/modules/other/nspkg_single
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,tests/modules/other,tests/modules/other/nspkg_delta,tests/modules/other/nspkg_gamma,tests/modules/other/nspkg_single
99

1010
test --test_output=errors
1111

CHANGELOG.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ END_UNRELEASED_TEMPLATE
7070
`_test` target is deprecated and will be removed in the next major release.
7171
([#2794](https://github.com/bazel-contrib/rules_python/issues/2794)
7272
* (py_wheel) py_wheel always creates zip64-capable wheel zips
73+
* (providers) (experimental) {obj}`PyInfo.venv_symlinks` replaces
74+
`PyInfo.site_packages_symlinks`
7375

7476
{#v0-0-0-fixed}
7577
### Fixed
@@ -91,6 +93,8 @@ END_UNRELEASED_TEMPLATE
9193
also retrieved from the URL as opposed to only the `--hash` parameter. Fixes
9294
[#2363](https://github.com/bazel-contrib/rules_python/issues/2363).
9395
* (pypi) `whl_library` now infers file names from its `urls` attribute correctly.
96+
* (pypi) When running under `bazel test`, be sure that temporary `requirements` file
97+
remains writable.
9498
* (py_test, py_binary) Allow external files to be used for main
9599

96100
{#v0-0-0-added}
@@ -107,6 +111,13 @@ END_UNRELEASED_TEMPLATE
107111
a `PyInfo` provider.
108112
* (uv) Handle `.netrc` and `auth_patterns` auth when downloading `uv`. Work towards
109113
[#1975](https://github.com/bazel-contrib/rules_python/issues/1975).
114+
* (toolchains) Arbitrary python-build-standalone runtimes can be registered
115+
and activated with custom flags. See the [Registering custom runtimes]
116+
docs and {obj}`single_version_platform_override()` API docs for more
117+
information.
118+
* (rules) Added support for a using constraints files with `compile_pip_requirements`.
119+
Useful when an intermediate dependency needs to be upgraded to pull in
120+
security patches.
110121

111122
{#v0-0-0-removed}
112123
### Removed
@@ -205,7 +216,7 @@ END_UNRELEASED_TEMPLATE
205216
please check the {obj}`uv.configure` tag class.
206217
* Add support for riscv64 linux platform.
207218
* (toolchains) Add python 3.13.2 and 3.12.9 toolchains
208-
* (providers) (experimental) {obj}`PyInfo.site_packages_symlinks` field added to
219+
* (providers) (experimental) `PyInfo.site_packages_symlinks` field added to
209220
allow specifying links to create within the venv site packages (only
210221
applicable with {obj}`--bootstrap_impl=script`)
211222
([#2156](https://github.com/bazelbuild/rules_python/issues/2156)).

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ to the actual rules_python project and begin the code review process.
6868
## Developer guide
6969

7070
For more more details, guidance, and tips for working with the code base,
71-
see [DEVELOPING.md](DEVELOPING.md)
71+
see [docs/devguide.md](./devguide)
7272

7373
## Formatting
7474

MODULE.bazel

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,22 @@ dev_python.override(
125125
register_all_versions = True,
126126
)
127127

128+
# For testing an arbitrary runtime triggered by a custom flag.
129+
# See //tests/toolchains:custom_platform_toolchain_test
130+
dev_python.single_version_platform_override(
131+
platform = "linux-x86-install-only-stripped",
132+
python_version = "3.13.1",
133+
sha256 = "56817aa976e4886bec1677699c136cb01c1cdfe0495104c0d8ef546541864bbb",
134+
target_compatible_with = [
135+
"@platforms//os:linux",
136+
"@platforms//cpu:x86_64",
137+
],
138+
target_settings = [
139+
"@@//tests/support:is_custom_runtime_linux-x86-install-only-stripped",
140+
],
141+
urls = ["https://github.com/astral-sh/python-build-standalone/releases/download/20250115/cpython-3.13.1+20250115-x86_64-unknown-linux-gnu-install_only_stripped.tar.gz"],
142+
)
143+
128144
dev_pip = use_extension(
129145
"//python/extensions:pip.bzl",
130146
"pip",
@@ -134,6 +150,7 @@ dev_pip.parse(
134150
download_only = True,
135151
experimental_index_url = "https://pypi.org/simple",
136152
hub_name = "dev_pip",
153+
parallel_download = False,
137154
python_version = "3.11",
138155
requirements_lock = "//docs:requirements.txt",
139156
)

docs/BUILD.bazel

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,10 @@ sphinx_stardocs(
120120
"//python/private:rule_builders_bzl",
121121
"//python/private/api:py_common_api_bzl",
122122
"//python/private/pypi:config_settings_bzl",
123+
"//python/private/pypi:env_marker_info_bzl",
123124
"//python/private/pypi:pkg_aliases_bzl",
125+
"//python/private/pypi:whl_config_setting_bzl",
126+
"//python/private/pypi:whl_library_bzl",
124127
"//python/uv:lock_bzl",
125128
"//python/uv:uv_bzl",
126129
"//python/uv:uv_toolchain_bzl",

docs/conf.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,12 @@
8787
"api/sphinxdocs/sphinx": "/api/sphinxdocs/sphinxdocs/sphinx.html",
8888
"api/sphinxdocs/sphinx_stardoc": "/api/sphinxdocs/sphinxdocs/sphinx_stardoc.html",
8989
"api/sphinxdocs/readthedocs": "/api/sphinxdocs/sphinxdocs/readthedocs.html",
90-
"api/sphinxdocs/index": "/api/sphinxdocs/sphinxdocs/index.html",
90+
"api/sphinxdocs/index": "sphinxdocs/index.html",
9191
"api/sphinxdocs/private/sphinx_docs_library": "/api/sphinxdocs/sphinxdocs/private/sphinx_docs_library.html",
9292
"api/sphinxdocs/sphinx_docs_library": "/api/sphinxdocs/sphinxdocs/sphinx_docs_library.html",
9393
"api/sphinxdocs/inventories/index": "/api/sphinxdocs/sphinxdocs/inventories/index.html",
94+
"pip.html": "pypi/index.html",
95+
"pypi-dependencies.html": "pypi/index.html",
9496
}
9597

9698
# Adapted from the template code:
@@ -139,7 +141,9 @@
139141

140142
# --- Extlinks configuration
141143
extlinks = {
144+
"gh-issue": (f"https://github.com/bazel-contrib/rules_python/issues/%s", "#%s issue"),
142145
"gh-path": (f"https://github.com/bazel-contrib/rules_python/tree/main/%s", "%s"),
146+
"gh-pr": (f"https://github.com/bazel-contrib/rules_python/pulls/%s", "#%s PR"),
143147
}
144148

145149
# --- MyST configuration

docs/getting-started.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ It assumes you have a `requirements.txt` file with your PyPI dependencies.
88

99
For more details information about configuring `rules_python`, see:
1010
* [Configuring the runtime](configuring-toolchains)
11-
* [Configuring third party dependencies (pip/pypi)](pypi-dependencies)
11+
* [Configuring third party dependencies (pip/pypi)](./pypi/index)
1212
* [API docs](api/index)
1313

14-
## Using bzlmod
14+
## Including dependencies
1515

16-
The first step to using rules_python with bzlmod is to add the dependency to
17-
your MODULE.bazel file:
16+
The first step to using `rules_python` is to add the dependency to
17+
your `MODULE.bazel` file:
1818

1919
```starlark
2020
# Update the version "0.0.0" to the release found here:
@@ -30,7 +30,7 @@ pip.parse(
3030
use_repo(pip, "pypi")
3131
```
3232

33-
## Using a WORKSPACE file
33+
### Using a WORKSPACE file
3434

3535
Using WORKSPACE is deprecated, but still supported, and a bit more involved than
3636
using Bzlmod. Here is a simplified setup to download the prebuilt runtimes.

docs/index.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,8 @@ See {gh-path}`Bzlmod support <BZLMOD_SUPPORT.md>` for any behaviour differences
9595
:hidden:
9696
self
9797
getting-started
98-
pypi-dependencies
98+
pypi/index
9999
Toolchains <toolchains>
100-
pip
101100
coverage
102101
precompiling
103102
gazelle

docs/pip.md

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)