Skip to content

Commit e57c003

Browse files
committed
Merge branch 'main' into feat/download-only-wheel-hubs
2 parents 91f86a9 + 3f40e98 commit e57c003

File tree

9 files changed

+95
-18
lines changed

9 files changed

+95
-18
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,15 @@ A brief description of the categories of changes:
1919

2020
## Unreleased
2121

22+
### Changed
23+
24+
### Fixed
25+
26+
### Added
27+
28+
* New Python versions available: `3.11.8`, `3.12.2` using
29+
https://github.com/indygreg/python-build-standalone/releases/tag/20240224.
30+
2231
[0.XX.0]: https://github.com/bazelbuild/rules_python/releases/tag/0.XX.0
2332

2433
### Added

WORKSPACE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ load("@rules_python_gazelle_plugin//:deps.bzl", _py_gazelle_deps = "gazelle_deps
8585
_py_gazelle_deps()
8686

8787
# This interpreter is used for various rules_python dev-time tools
88-
load("@python//3.11.7:defs.bzl", "interpreter")
88+
load("@python//3.11.8:defs.bzl", "interpreter")
8989

9090
#####################
9191
# Install twine for our own runfiles wheel publishing.

docs/sphinx/getting-started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ pip_parse(
159159

160160
After registration, your Python targets will use the toolchain's interpreter during execution, but a system-installed interpreter
161161
is still used to 'bootstrap' Python targets (see https://github.com/bazelbuild/rules_python/issues/691).
162-
You may also find some quirks while using this toolchain. Please refer to [python-build-standalone documentation's _Quirks_ section](https://python-build-standalone.readthedocs.io/en/latest/quirks.html).
162+
You may also find some quirks while using this toolchain. Please refer to [python-build-standalone documentation's _Quirks_ section](https://gregoryszorc.com/docs/python-build-standalone/main/quirks.html).
163163

164164
## Toolchain usage in other rules
165165

gazelle/README.md

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,8 @@ Python-specific directives are as follows:
176176
|--------------------------------------|-------------------|
177177
| `# gazelle:python_extension` | `enabled` |
178178
| Controls whether the Python extension is enabled or not. Sub-packages inherit this value. Can be either "enabled" or "disabled". | |
179-
| `# gazelle:python_root` | n/a |
180-
| Sets a Bazel package as a Python root. This is used on monorepos with multiple Python projects that don't share the top-level of the workspace as the root. | |
179+
| [`# gazelle:python_root`](#directive-python_root) | n/a |
180+
| Sets a Bazel package as a Python root. This is used on monorepos with multiple Python projects that don't share the top-level of the workspace as the root. See [Directive: `python_root`](#directive-python_root) below. | |
181181
| `# gazelle:python_manifest_file_name`| `gazelle_python.yaml` |
182182
| Overrides the default manifest file name. | |
183183
| `# gazelle:python_ignore_files` | n/a |
@@ -188,7 +188,7 @@ Python-specific directives are as follows:
188188
| Controls whether the Python import statements should be validated. Can be "true" or "false" | |
189189
| `# gazelle:python_generation_mode`| `package` |
190190
| Controls the target generation mode. Can be "file", "package", or "project" | |
191-
| `# gazelle:python_generation_mode_per_file_include_init`| `package` |
191+
| `# gazelle:python_generation_mode_per_file_include_init`| `false` |
192192
| Controls whether `__init__.py` files are included as srcs in each generated target when target generation mode is "file". Can be "true", or "false" | |
193193
| `# gazelle:python_library_naming_convention`| `$package_name$` |
194194
| Controls the `py_library` naming convention. It interpolates `$package_name$` with the Bazel package name. E.g. if the Bazel package name is `foo`, setting this to `$package_name$_my_lib` would result in a generated target named `foo_my_lib`. | |
@@ -199,6 +199,43 @@ Python-specific directives are as follows:
199199
| `# gazelle:resolve py ...` | n/a |
200200
| Instructs the plugin what target to add as a dependency to satisfy a given import statement. The syntax is `# gazelle:resolve py import-string label` where `import-string` is the symbol in the python `import` statement, and `label` is the Bazel label that Gazelle should write in `deps`. | |
201201

202+
203+
#### Directive: `python_root`:
204+
205+
Set this directive within the Bazel package that you want to use as the Python root.
206+
For example, if using a `src` dir (as recommended by the [Python Packaging User
207+
Guide][python-packaging-user-guide]), then set this directive in `src/BUILD.bazel`:
208+
209+
```starlark
210+
# ./src/BUILD.bazel
211+
# Tell gazelle that are python root is the same dir as this Bazel package.
212+
# gazelle:python_root
213+
```
214+
215+
Note that the directive does not have any arguments.
216+
217+
Gazelle will then add the necessary `imports` attribute to all targets that it
218+
generates:
219+
220+
```starlark
221+
# in ./src/foo/BUILD.bazel
222+
py_libary(
223+
...
224+
imports = [".."], # Gazelle adds this
225+
...
226+
)
227+
228+
# in ./src/foo/bar/BUILD.bazel
229+
py_libary(
230+
...
231+
imports = ["../.."], # Gazelle adds this
232+
...
233+
)
234+
```
235+
236+
[python-packaging-user-guide]: https://github.com/pypa/packaging.python.org/blob/4c86169a/source/tutorials/packaging-projects.rst
237+
238+
202239
### Libraries
203240

204241
Python source files are those ending in `.py` but not ending in `_test.py`.

python/private/repo_utils.bzl

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,13 @@ def _which_checked(rctx, binary_name):
160160
"""
161161
binary = rctx.which(binary_name)
162162
if binary == None:
163-
fail(("Unable to find the binary '{binary_name}' on PATH.\n" +
164-
" PATH = {path}".format(rctx.os.environ.get("PATH"))))
163+
fail((
164+
"Unable to find the binary '{binary_name}' on PATH.\n" +
165+
" PATH = {path}"
166+
).format(
167+
binary_name = binary_name,
168+
path = rctx.os.environ.get("PATH"),
169+
))
165170
return binary
166171

167172
def _args_to_str(arguments):

python/versions.bzl

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,19 @@ TOOL_VERSIONS = {
369369
},
370370
"strip_prefix": "python",
371371
},
372+
"3.11.8": {
373+
"url": "20240224/cpython-{python_version}+20240224-{platform}-{build}.tar.gz",
374+
"sha256": {
375+
"aarch64-apple-darwin": "389a51139f5abe071a0d70091ca5df3e7a3dfcfcbe3e0ba6ad85fb4c5638421e",
376+
"aarch64-unknown-linux-gnu": "389b9005fb78dd5a6f68df5ea45ab7b30d9a4b3222af96999e94fd20d4ad0c6a",
377+
"ppc64le-unknown-linux-gnu": "eb2b31f8e50309aae493c6a359c32b723a676f07c641f5e8fe4b6aa4dbb50946",
378+
"s390x-unknown-linux-gnu": "844f64f4c16e24965778281da61d1e0e6cd1358a581df1662da814b1eed096b9",
379+
"x86_64-apple-darwin": "097f467b0c36706bfec13f199a2eaf924e668f70c6e2bd1f1366806962f7e86e",
380+
"x86_64-pc-windows-msvc": "b618f1f047349770ee1ef11d1b05899840abd53884b820fd25c7dfe2ec1664d4",
381+
"x86_64-unknown-linux-gnu": "94e13d0e5ad417035b80580f3e893a72e094b0900d5d64e7e34ab08e95439987",
382+
},
383+
"strip_prefix": "python",
384+
},
372385
"3.12.0": {
373386
"url": "20231002/cpython-{python_version}+20231002-{platform}-{build}.tar.gz",
374387
"sha256": {
@@ -395,15 +408,28 @@ TOOL_VERSIONS = {
395408
},
396409
"strip_prefix": "python",
397410
},
411+
"3.12.2": {
412+
"url": "20240224/cpython-{python_version}+20240224-{platform}-{build}.tar.gz",
413+
"sha256": {
414+
"aarch64-apple-darwin": "01c064c00013b0175c7858b159989819ead53f4746d40580b5b0b35b6e80fba6",
415+
"aarch64-unknown-linux-gnu": "e52550379e7c4ac27a87de832d172658bc04150e4e27d4e858e6d8cbb96fd709",
416+
"ppc64le-unknown-linux-gnu": "74bc02c4bbbd26245c37b29b9e12d0a9c1b7ab93477fed8b651c988b6a9a6251",
417+
"s390x-unknown-linux-gnu": "ecd6b0285e5eef94deb784b588b4b425a15a43ae671bf206556659dc141a9825",
418+
"x86_64-apple-darwin": "a53a6670a202c96fec0b8c55ccc780ea3af5307eb89268d5b41a9775b109c094",
419+
"x86_64-pc-windows-msvc": "1e5655a6ccb1a64a78460e4e3ee21036c70246800f176a6c91043a3fe3654a3b",
420+
"x86_64-unknown-linux-gnu": "57a37b57f8243caa4cdac016176189573ad7620f0b6da5941c5e40660f9468ab",
421+
},
422+
"strip_prefix": "python",
423+
},
398424
}
399425

400426
# buildifier: disable=unsorted-dict-items
401427
MINOR_MAPPING = {
402428
"3.8": "3.8.18",
403429
"3.9": "3.9.18",
404430
"3.10": "3.10.13",
405-
"3.11": "3.11.7",
406-
"3.12": "3.12.1",
431+
"3.11": "3.11.8",
432+
"3.12": "3.12.2",
407433
}
408434

409435
PLATFORMS = {

tests/integration/pip_repository_entry_points/requirements_windows.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ imagesize==1.3.0 \
3838
--hash=sha256:1db2f82529e53c3e929e8926a1fa9235aa82d0bd0c580359c67ec31b2fddaa8c \
3939
--hash=sha256:cd1750d452385ca327479d45b64d9c7729ecf0b3969a58148298c77092261f9d
4040
# via sphinx
41-
jinja2==3.0.3 \
42-
--hash=sha256:077ce6014f7b40d03b47d1f1ca4b0fc8328a692bd284016f806ed0eaca390ad8 \
43-
--hash=sha256:611bb273cd68f3b993fabdc4064fc858c5b47a973cb5aa7999ec1ba405c87cd7
41+
jinja2==3.1.3 \
42+
--hash=sha256:7d6d50dd97d52cbc355597bd845fabfbac3f551e1f99619e39a35ce8c370b5fa \
43+
--hash=sha256:ac8bd6544d4bb2c9792bf3a159e80bba8fda7f07e81bc3aed565432d5925ba90
4444
# via sphinx
4545
markupsafe==2.0.1 \
4646
--hash=sha256:01a9b8ea66f1658938f65b93a85ebe8bc016e6769611be228d797c9d998dd298 \

tools/publish/requirements_darwin.txt

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tools/publish/requirements_windows.txt

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)