xref: /aosp_15_r20/external/bazelbuild-rules_python/CHANGELOG.md (revision 60517a1edbc8ecf509223e9af94a7adec7d736b8)
1*60517a1eSAndroid Build Coastguard Worker:::{default-domain} bzl
2*60517a1eSAndroid Build Coastguard Worker:::
3*60517a1eSAndroid Build Coastguard Worker
4*60517a1eSAndroid Build Coastguard Worker# rules_python Changelog
5*60517a1eSAndroid Build Coastguard Worker
6*60517a1eSAndroid Build Coastguard WorkerThis is a human-friendly changelog in a keepachangelog.com style format.
7*60517a1eSAndroid Build Coastguard WorkerBecause this changelog is for end-user consumption of meaningful changes,only
8*60517a1eSAndroid Build Coastguard Workera summary of a release's changes is described. This means every commit is not
9*60517a1eSAndroid Build Coastguard Workernecessarily mentioned, and internal refactors or code cleanups are omitted
10*60517a1eSAndroid Build Coastguard Workerunless they're particularly notable.
11*60517a1eSAndroid Build Coastguard Worker
12*60517a1eSAndroid Build Coastguard WorkerA brief description of the categories of changes:
13*60517a1eSAndroid Build Coastguard Worker
14*60517a1eSAndroid Build Coastguard Worker* `Changed`: Some behavior changed. If the change is expected to break a
15*60517a1eSAndroid Build Coastguard Worker  public API or supported behavior, it will be marked as **BREAKING**. Note that
16*60517a1eSAndroid Build Coastguard Worker  beta APIs will not have breaking API changes called out.
17*60517a1eSAndroid Build Coastguard Worker* `Fixed`: A bug, or otherwise incorrect behavior, was fixed.
18*60517a1eSAndroid Build Coastguard Worker* `Added`: A new feature, API, or behavior was added in a backwards compatible
19*60517a1eSAndroid Build Coastguard Worker  manner.
20*60517a1eSAndroid Build Coastguard Worker* Particular sub-systems are identified using parentheses, e.g. `(bzlmod)` or
21*60517a1eSAndroid Build Coastguard Worker  `(docs)`.
22*60517a1eSAndroid Build Coastguard Worker
23*60517a1eSAndroid Build Coastguard Worker## Unreleased
24*60517a1eSAndroid Build Coastguard Worker
25*60517a1eSAndroid Build Coastguard Worker[x.x.x]: https://github.com/bazelbuild/rules_python/releases/tag/x.x.x
26*60517a1eSAndroid Build Coastguard Worker
27*60517a1eSAndroid Build Coastguard Worker### Changed
28*60517a1eSAndroid Build Coastguard Worker* Nothing yet
29*60517a1eSAndroid Build Coastguard Worker
30*60517a1eSAndroid Build Coastguard Worker### Fixed
31*60517a1eSAndroid Build Coastguard Worker* Nothing yet
32*60517a1eSAndroid Build Coastguard Worker
33*60517a1eSAndroid Build Coastguard Worker### Added
34*60517a1eSAndroid Build Coastguard Worker* Nothing yet
35*60517a1eSAndroid Build Coastguard Worker
36*60517a1eSAndroid Build Coastguard Worker### Removed
37*60517a1eSAndroid Build Coastguard Worker* Nothing yet
38*60517a1eSAndroid Build Coastguard Worker
39*60517a1eSAndroid Build Coastguard Worker## [0.36.0] - 2024-09-24
40*60517a1eSAndroid Build Coastguard Worker
41*60517a1eSAndroid Build Coastguard Worker[0.36.0]: https://github.com/bazelbuild/rules_python/releases/tag/0.36.0
42*60517a1eSAndroid Build Coastguard Worker
43*60517a1eSAndroid Build Coastguard Worker### Changed
44*60517a1eSAndroid Build Coastguard Worker* (gazelle): Update error messages when unable to resolve a dependency to be more human-friendly.
45*60517a1eSAndroid Build Coastguard Worker* (flags) The {obj}`--python_version` flag now also returns
46*60517a1eSAndroid Build Coastguard Worker  {obj}`config_common.FeatureFlagInfo`.
47*60517a1eSAndroid Build Coastguard Worker* (toolchain): The toolchain patches now expose the `patch_strip` attribute
48*60517a1eSAndroid Build Coastguard Worker  that one should use when patching toolchains. Please set it if you are
49*60517a1eSAndroid Build Coastguard Worker  patching python interpreter. In the next release the default will be set to
50*60517a1eSAndroid Build Coastguard Worker  `0` which better reflects the defaults used in public `bazel` APIs.
51*60517a1eSAndroid Build Coastguard Worker* (toolchains) When {obj}`py_runtime.interpreter_version_info` isn't specified,
52*60517a1eSAndroid Build Coastguard Worker  the {obj}`--python_version` flag will determine the value. This allows
53*60517a1eSAndroid Build Coastguard Worker  specifying the build-time Python version for the
54*60517a1eSAndroid Build Coastguard Worker  {obj}`runtime_env_toolchains`.
55*60517a1eSAndroid Build Coastguard Worker* (toolchains) {obj}`py_cc_toolchain.libs` and {obj}`PyCcToolchainInfo.libs` is
56*60517a1eSAndroid Build Coastguard Worker  optional. This is to support situations where only the Python headers are
57*60517a1eSAndroid Build Coastguard Worker  available.
58*60517a1eSAndroid Build Coastguard Worker* (bazel) Minimum bazel 7 version that we test against has been bumped to `7.1`.
59*60517a1eSAndroid Build Coastguard Worker
60*60517a1eSAndroid Build Coastguard Worker### Fixed
61*60517a1eSAndroid Build Coastguard Worker* (whl_library): Remove `--no-index` and add `--no-build-isolation` to the
62*60517a1eSAndroid Build Coastguard Worker  `pip install` command when installing a wheel from a local file, which happens
63*60517a1eSAndroid Build Coastguard Worker  when `experimental_index_url` flag is used.
64*60517a1eSAndroid Build Coastguard Worker* (bzlmod) get the path to the host python interpreter in a way that results in
65*60517a1eSAndroid Build Coastguard Worker  platform non-dependent hashes in the lock file when the requirement markers need
66*60517a1eSAndroid Build Coastguard Worker  to be evaluated.
67*60517a1eSAndroid Build Coastguard Worker* (bzlmod) correctly watch sources used for evaluating requirement markers for
68*60517a1eSAndroid Build Coastguard Worker  any changes so that the repository rule or module extensions can be
69*60517a1eSAndroid Build Coastguard Worker  re-evaluated when the said files change.
70*60517a1eSAndroid Build Coastguard Worker* (gazelle): Fix incorrect use of `t.Fatal`/`t.Fatalf` in tests.
71*60517a1eSAndroid Build Coastguard Worker* (toolchain) Omit third-party python packages from coverage reports from
72*60517a1eSAndroid Build Coastguard Worker  stage2 bootstrap template.
73*60517a1eSAndroid Build Coastguard Worker* (bzlmod) Properly handle relative path URLs in parse_simpleapi_html.bzl
74*60517a1eSAndroid Build Coastguard Worker* (gazelle) Correctly resolve deps that have top-level module overlap with a gazelle_python.yaml dep module
75*60517a1eSAndroid Build Coastguard Worker* (rules) Make `RUNFILES_MANIFEST_FILE`-based invocations work when used with
76*60517a1eSAndroid Build Coastguard Worker  {obj}`--bootstrap_impl=script`. This fixes invocations using non-sandboxed
77*60517a1eSAndroid Build Coastguard Worker  test execution with `--enable_runfiles=false --build_runfile_manifests=true`.
78*60517a1eSAndroid Build Coastguard Worker  ([#2186](https://github.com/bazelbuild/rules_python/issues/2186)).
79*60517a1eSAndroid Build Coastguard Worker* (py_wheel) Fix incorrectly generated `Required-Dist` when specifying requirements with markers
80*60517a1eSAndroid Build Coastguard Worker  in extra_requires in py_wheel rule.
81*60517a1eSAndroid Build Coastguard Worker* (rules) Prevent pytest from trying run the generated stage2
82*60517a1eSAndroid Build Coastguard Worker  bootstrap .py file when using {obj}`--bootstrap_impl=script`
83*60517a1eSAndroid Build Coastguard Worker* (toolchain) The {bzl:obj}`gen_python_config_settings` has been fixed to include
84*60517a1eSAndroid Build Coastguard Worker  the flag_values from the platform definitions.
85*60517a1eSAndroid Build Coastguard Worker
86*60517a1eSAndroid Build Coastguard Worker
87*60517a1eSAndroid Build Coastguard Worker### Added
88*60517a1eSAndroid Build Coastguard Worker* (bzlmod): Toolchain overrides can now be done using the new
89*60517a1eSAndroid Build Coastguard Worker  {bzl:obj}`python.override`, {bzl:obj}`python.single_version_override` and
90*60517a1eSAndroid Build Coastguard Worker  {bzl:obj}`python.single_version_platform_override` tag classes.
91*60517a1eSAndroid Build Coastguard Worker  See [#2081](https://github.com/bazelbuild/rules_python/issues/2081).
92*60517a1eSAndroid Build Coastguard Worker* (rules) Executables provide {obj}`PyExecutableInfo`, which contains
93*60517a1eSAndroid Build Coastguard Worker  executable-specific information useful for packaging an executable or
94*60517a1eSAndroid Build Coastguard Worker  or deriving a new one from the original.
95*60517a1eSAndroid Build Coastguard Worker* (py_wheel) Removed use of bash to avoid failures on Windows machines which do not
96*60517a1eSAndroid Build Coastguard Worker  have it installed.
97*60517a1eSAndroid Build Coastguard Worker* (docs) Automatically generated documentation for {bzl:obj}`python_register_toolchains`
98*60517a1eSAndroid Build Coastguard Worker  and related symbols.
99*60517a1eSAndroid Build Coastguard Worker* (toolchains) Added {attr}`python_repository.patch_strip` attribute for
100*60517a1eSAndroid Build Coastguard Worker  allowing values that are other than `1`, which has been hard-coded up until
101*60517a1eSAndroid Build Coastguard Worker  now. If you are relying on the undocumented `patches` support in
102*60517a1eSAndroid Build Coastguard Worker  `TOOL_VERSIONS` for registering patched toolchains please consider setting
103*60517a1eSAndroid Build Coastguard Worker  the `patch_strip` explicitly to `1` if you depend on this value - in the
104*60517a1eSAndroid Build Coastguard Worker  future the value may change to default to `0`.
105*60517a1eSAndroid Build Coastguard Worker* (toolchains) Added `//python:none`, a special target for use with
106*60517a1eSAndroid Build Coastguard Worker  {obj}`py_exec_tools_toolchain.exec_interpreter` to treat the value as `None`.
107*60517a1eSAndroid Build Coastguard Worker
108*60517a1eSAndroid Build Coastguard Worker### Removed
109*60517a1eSAndroid Build Coastguard Worker* (toolchains): Removed accidentally exposed `http_archive` symbol from
110*60517a1eSAndroid Build Coastguard Worker  `python/repositories.bzl`.
111*60517a1eSAndroid Build Coastguard Worker* (toolchains): An internal _is_python_config_setting_ macro has been removed.
112*60517a1eSAndroid Build Coastguard Worker
113*60517a1eSAndroid Build Coastguard Worker## [0.35.0] - 2024-08-15
114*60517a1eSAndroid Build Coastguard Worker
115*60517a1eSAndroid Build Coastguard Worker[0.35.0]: https://github.com/bazelbuild/rules_python/releases/tag/0.35.0
116*60517a1eSAndroid Build Coastguard Worker
117*60517a1eSAndroid Build Coastguard Worker### Changed
118*60517a1eSAndroid Build Coastguard Worker* (whl_library) A better log message when the wheel is built from an sdist or
119*60517a1eSAndroid Build Coastguard Worker  when the wheel is downloaded using `download_only` feature to aid debugging.
120*60517a1eSAndroid Build Coastguard Worker* (gazelle): Simplify and make gazelle_python.yaml have only top level package name.
121*60517a1eSAndroid Build Coastguard Worker  It would work well in cases to reduce merge conflicts.
122*60517a1eSAndroid Build Coastguard Worker* (toolchains): Change some old toochain versions to use [20240726] release to
123*60517a1eSAndroid Build Coastguard Worker  include dependency updates `3.8.19`, `3.9.19`, `3.10.14`, `3.11.9`
124*60517a1eSAndroid Build Coastguard Worker* (toolchains): Bump default toolchain versions to:
125*60517a1eSAndroid Build Coastguard Worker    * `3.12 -> 3.12.4`
126*60517a1eSAndroid Build Coastguard Worker* (rules) `PYTHONSAFEPATH` is inherited from the calling environment to allow
127*60517a1eSAndroid Build Coastguard Worker  disabling it (Requires {obj}`--bootstrap_impl=script`)
128*60517a1eSAndroid Build Coastguard Worker  ([#2060](https://github.com/bazelbuild/rules_python/issues/2060)).
129*60517a1eSAndroid Build Coastguard Worker
130*60517a1eSAndroid Build Coastguard Worker### Fixed
131*60517a1eSAndroid Build Coastguard Worker* (rules) `compile_pip_requirements` now sets the `USERPROFILE` env variable on
132*60517a1eSAndroid Build Coastguard Worker  Windows to work around an issue where `setuptools` fails to locate the user's
133*60517a1eSAndroid Build Coastguard Worker  home directory.
134*60517a1eSAndroid Build Coastguard Worker* (rules) correctly handle absolute URLs in parse_simpleapi_html.bzl.
135*60517a1eSAndroid Build Coastguard Worker* (rules) Fixes build targets linking against `@rules_python//python/cc:current_py_cc_libs`
136*60517a1eSAndroid Build Coastguard Worker  in host platform builds on macOS, by editing the `LC_ID_DYLIB` field of the hermetic interpreter's
137*60517a1eSAndroid Build Coastguard Worker  `libpython3.x.dylib` using `install_name_tool`, setting it to its absolute path under Bazel's
138*60517a1eSAndroid Build Coastguard Worker  execroot.
139*60517a1eSAndroid Build Coastguard Worker* (rules) Signals are properly received when using {obj}`--bootstrap_impl=script`
140*60517a1eSAndroid Build Coastguard Worker  (for non-zip builds).
141*60517a1eSAndroid Build Coastguard Worker  ([#2043](https://github.com/bazelbuild/rules_python/issues/2043))
142*60517a1eSAndroid Build Coastguard Worker* (rules) Fixes Python builds when the `--build_python_zip` is set to `false` on
143*60517a1eSAndroid Build Coastguard Worker  Windows. See [#1840](https://github.com/bazelbuild/rules_python/issues/1840).
144*60517a1eSAndroid Build Coastguard Worker* (rules) Fixes Mac + `--build_python_zip` + {obj}`--bootstrap_impl=script`
145*60517a1eSAndroid Build Coastguard Worker  ([#2030](https://github.com/bazelbuild/rules_python/issues/2030)).
146*60517a1eSAndroid Build Coastguard Worker* (rules) User dependencies come before runtime site-packages when using
147*60517a1eSAndroid Build Coastguard Worker  {obj}`--bootstrap_impl=script`.
148*60517a1eSAndroid Build Coastguard Worker  ([#2064](https://github.com/bazelbuild/rules_python/issues/2064)).
149*60517a1eSAndroid Build Coastguard Worker* (rules) Version-aware rules now return both `@_builtins` and `@rules_python`
150*60517a1eSAndroid Build Coastguard Worker  providers instead of only one.
151*60517a1eSAndroid Build Coastguard Worker  ([#2114](https://github.com/bazelbuild/rules_python/issues/2114)).
152*60517a1eSAndroid Build Coastguard Worker* (pip) Fixed pypi parse_simpleapi_html function for feeds with package metadata
153*60517a1eSAndroid Build Coastguard Worker  containing ">" sign
154*60517a1eSAndroid Build Coastguard Worker* (toolchains) Added missing executable permission to
155*60517a1eSAndroid Build Coastguard Worker  `//python/runtime_env_toolchains` interpreter script so that it is runnable.
156*60517a1eSAndroid Build Coastguard Worker  ([#2085](https://github.com/bazelbuild/rules_python/issues/2085)).
157*60517a1eSAndroid Build Coastguard Worker* (pip) Correctly use the `sdist` downloaded by the bazel downloader when using
158*60517a1eSAndroid Build Coastguard Worker  `experimental_index_url` feature. Fixes
159*60517a1eSAndroid Build Coastguard Worker  [#2091](https://github.com/bazelbuild/rules_python/issues/2090).
160*60517a1eSAndroid Build Coastguard Worker* (gazelle) Make `gazelle_python_manifest.update` manual to avoid unnecessary
161*60517a1eSAndroid Build Coastguard Worker  network behavior.
162*60517a1eSAndroid Build Coastguard Worker* (bzlmod): The conflicting toolchains during `python` extension will no longer
163*60517a1eSAndroid Build Coastguard Worker  cause warnings by default. In order to see the warnings for diagnostic purposes
164*60517a1eSAndroid Build Coastguard Worker  set the env var `RULES_PYTHON_REPO_DEBUG_VERBOSITY` to one of `INFO`, `DEBUG` or `TRACE`.
165*60517a1eSAndroid Build Coastguard Worker  Fixes [#1818](https://github.com/bazelbuild/rules_python/issues/1818).
166*60517a1eSAndroid Build Coastguard Worker* (runfiles) Make runfiles lookups work for the situation of Bazel 7,
167*60517a1eSAndroid Build Coastguard Worker  Python 3.9 (or earlier, where safepath isn't present), and the Rlocation call
168*60517a1eSAndroid Build Coastguard Worker  in the same directory as the main file.
169*60517a1eSAndroid Build Coastguard Worker  Fixes [#1631](https://github.com/bazelbuild/rules_python/issues/1631).
170*60517a1eSAndroid Build Coastguard Worker
171*60517a1eSAndroid Build Coastguard Worker### Added
172*60517a1eSAndroid Build Coastguard Worker* (rules) `compile_pip_requirements` supports multiple requirements input files as `srcs`.
173*60517a1eSAndroid Build Coastguard Worker* (rules) `PYTHONSAFEPATH` is inherited from the calling environment to allow
174*60517a1eSAndroid Build Coastguard Worker  disabling it (Requires {obj}`--bootstrap_impl=script`)
175*60517a1eSAndroid Build Coastguard Worker  ([#2060](https://github.com/bazelbuild/rules_python/issues/2060)).
176*60517a1eSAndroid Build Coastguard Worker* (gazelle) Added `python_generation_mode_per_package_require_test_entry_point`
177*60517a1eSAndroid Build Coastguard Worker  in order to better accommodate users who use a custom macro,
178*60517a1eSAndroid Build Coastguard Worker  [`pytest-bazel`][pytest_bazel], [rules_python_pytest] or `rules_py`
179*60517a1eSAndroid Build Coastguard Worker  [py_test_main] in order to integrate with `pytest`. Currently the default
180*60517a1eSAndroid Build Coastguard Worker  flag value is set to `true` for backwards compatible behaviour, but in the
181*60517a1eSAndroid Build Coastguard Worker  future the flag will be flipped be `false` by default.
182*60517a1eSAndroid Build Coastguard Worker* (toolchains) New Python versions available: `3.12.4` using the [20240726] release.
183*60517a1eSAndroid Build Coastguard Worker* (pypi) Support env markers in requirements files. Note, that this means that
184*60517a1eSAndroid Build Coastguard Worker  if your requirements files contain env markers, the Python interpreter will
185*60517a1eSAndroid Build Coastguard Worker  need to be run during bzlmod phase to evaluate them. This may incur
186*60517a1eSAndroid Build Coastguard Worker  downloading an interpreter (for hermetic-based builds) or cause non-hermetic
187*60517a1eSAndroid Build Coastguard Worker  behavior (if using a system Python).
188*60517a1eSAndroid Build Coastguard Worker
189*60517a1eSAndroid Build Coastguard Worker[rules_python_pytest]: https://github.com/caseyduquettesc/rules_python_pytest
190*60517a1eSAndroid Build Coastguard Worker[py_test_main]: https://docs.aspect.build/rulesets/aspect_rules_py/docs/rules/#py_pytest_main
191*60517a1eSAndroid Build Coastguard Worker[pytest_bazel]: https://pypi.org/project/pytest-bazel
192*60517a1eSAndroid Build Coastguard Worker[20240726]: https://github.com/indygreg/python-build-standalone/releases/tag/20240726
193*60517a1eSAndroid Build Coastguard Worker
194*60517a1eSAndroid Build Coastguard Worker## [0.34.0] - 2024-07-04
195*60517a1eSAndroid Build Coastguard Worker
196*60517a1eSAndroid Build Coastguard Worker[0.34.0]: https://github.com/bazelbuild/rules_python/releases/tag/0.34.0
197*60517a1eSAndroid Build Coastguard Worker
198*60517a1eSAndroid Build Coastguard Worker### Changed
199*60517a1eSAndroid Build Coastguard Worker* `protobuf`/`com_google_protobuf` dependency bumped to `v24.4`
200*60517a1eSAndroid Build Coastguard Worker* (bzlmod): optimize the creation of config settings used in pip to
201*60517a1eSAndroid Build Coastguard Worker  reduce the total number of targets in the hub repo.
202*60517a1eSAndroid Build Coastguard Worker* (toolchains) The exec tools toolchain now finds its interpreter by reusing
203*60517a1eSAndroid Build Coastguard Worker  the regular interpreter toolchain. This avoids having to duplicate specifying
204*60517a1eSAndroid Build Coastguard Worker  where the runtime for the exec tools toolchain is.
205*60517a1eSAndroid Build Coastguard Worker* (toolchains) ({obj}`//python:autodetecting_toolchain`) is deprecated. It is
206*60517a1eSAndroid Build Coastguard Worker  replaced by {obj}`//python/runtime_env_toolchains:all`. The old target will be
207*60517a1eSAndroid Build Coastguard Worker  removed in a future release.
208*60517a1eSAndroid Build Coastguard Worker
209*60517a1eSAndroid Build Coastguard Worker### Fixed
210*60517a1eSAndroid Build Coastguard Worker* (bzlmod): When using `experimental_index_url` the `all_requirements`,
211*60517a1eSAndroid Build Coastguard Worker  `all_whl_requirements` and `all_data_requirements` will now only include
212*60517a1eSAndroid Build Coastguard Worker  common packages that are available on all target platforms. This is to ensure
213*60517a1eSAndroid Build Coastguard Worker  that packages that are only present for some platforms are pulled only via
214*60517a1eSAndroid Build Coastguard Worker  the `deps` of the materialized `py_library`. If you would like to include
215*60517a1eSAndroid Build Coastguard Worker  platform specific packages, using a `select` statement with references to the
216*60517a1eSAndroid Build Coastguard Worker  specific package will still work (e.g.
217*60517a1eSAndroid Build Coastguard Worker  ```
218*60517a1eSAndroid Build Coastguard Worker  my_attr = all_requirements + select(
219*60517a1eSAndroid Build Coastguard Worker      {
220*60517a1eSAndroid Build Coastguard Worker          "@platforms//os:linux": ["@pypi//foo_available_only_on_linux"],
221*60517a1eSAndroid Build Coastguard Worker          "//conditions:default": [],
222*60517a1eSAndroid Build Coastguard Worker      }
223*60517a1eSAndroid Build Coastguard Worker  )
224*60517a1eSAndroid Build Coastguard Worker  ```
225*60517a1eSAndroid Build Coastguard Worker* (bzlmod): Targets in `all_requirements` now use the same form as targets returned by the `requirement` macro.
226*60517a1eSAndroid Build Coastguard Worker* (rules) Auto exec groups are enabled. This allows actions run by the rules,
227*60517a1eSAndroid Build Coastguard Worker  such as precompiling, to pick an execution platform separately from what
228*60517a1eSAndroid Build Coastguard Worker  other toolchains support.
229*60517a1eSAndroid Build Coastguard Worker* (providers) {obj}`PyRuntimeInfo` doesn't require passing the
230*60517a1eSAndroid Build Coastguard Worker  `interpreter_version_info` arg.
231*60517a1eSAndroid Build Coastguard Worker* (bzlmod) Correctly pass `isolated`, `quiet` and `timeout` values to `whl_library`
232*60517a1eSAndroid Build Coastguard Worker  and drop the defaults from the lock file.
233*60517a1eSAndroid Build Coastguard Worker* (whl_library) Correctly handle arch-specific dependencies when we encounter a
234*60517a1eSAndroid Build Coastguard Worker  platform specific wheel and use `experimental_target_platforms`.
235*60517a1eSAndroid Build Coastguard Worker  Fixes [#1996](https://github.com/bazelbuild/rules_python/issues/1996).
236*60517a1eSAndroid Build Coastguard Worker* (rules) The first element of the default outputs is now the executable again.
237*60517a1eSAndroid Build Coastguard Worker* (pip) Fixed crash when pypi packages lacked a sha (e.g. yanked packages)
238*60517a1eSAndroid Build Coastguard Worker
239*60517a1eSAndroid Build Coastguard Worker### Added
240*60517a1eSAndroid Build Coastguard Worker* (toolchains) {obj}`//python/runtime_env_toolchains:all`, which is a drop-in
241*60517a1eSAndroid Build Coastguard Worker  replacement for the "autodetecting" toolchain.
242*60517a1eSAndroid Build Coastguard Worker* (gazelle) Added new `python_label_convention` and `python_label_normalization` directives. These directive
243*60517a1eSAndroid Build Coastguard Worker  allows altering default Gazelle label format to third-party dependencies useful for re-using Gazelle plugin
244*60517a1eSAndroid Build Coastguard Worker  with other rules, including `rules_pycross`. See [#1939](https://github.com/bazelbuild/rules_python/issues/1939).
245*60517a1eSAndroid Build Coastguard Worker
246*60517a1eSAndroid Build Coastguard Worker### Removed
247*60517a1eSAndroid Build Coastguard Worker* (pip): Removes the `entrypoint` macro that was replaced by `py_console_script_binary` in 0.26.0.
248*60517a1eSAndroid Build Coastguard Worker
249*60517a1eSAndroid Build Coastguard Worker## [0.33.2] - 2024-06-13
250*60517a1eSAndroid Build Coastguard Worker
251*60517a1eSAndroid Build Coastguard Worker[0.33.2]: https://github.com/bazelbuild/rules_python/releases/tag/0.33.2
252*60517a1eSAndroid Build Coastguard Worker
253*60517a1eSAndroid Build Coastguard Worker### Fixed
254*60517a1eSAndroid Build Coastguard Worker* (toolchains) The {obj}`exec_tools_toolchain_type` is disabled by default.
255*60517a1eSAndroid Build Coastguard Worker  To enable it, set {obj}`--//python/config_settings:exec_tools_toolchain=enabled`.
256*60517a1eSAndroid Build Coastguard Worker  This toolchain must be enabled for precompilation to work. This toolchain will
257*60517a1eSAndroid Build Coastguard Worker  be enabled by default in a future release.
258*60517a1eSAndroid Build Coastguard Worker  Fixes [#1967](https://github.com/bazelbuild/rules_python/issues/1967).
259*60517a1eSAndroid Build Coastguard Worker
260*60517a1eSAndroid Build Coastguard Worker## [0.33.1] - 2024-06-13
261*60517a1eSAndroid Build Coastguard Worker
262*60517a1eSAndroid Build Coastguard Worker[0.33.1]: https://github.com/bazelbuild/rules_python/releases/tag/0.33.1
263*60517a1eSAndroid Build Coastguard Worker
264*60517a1eSAndroid Build Coastguard Worker### Fixed
265*60517a1eSAndroid Build Coastguard Worker* (py_binary) Fix building of zip file when using `--build_python_zip`
266*60517a1eSAndroid Build Coastguard Worker  argument. Fixes [#1954](https://github.com/bazelbuild/rules_python/issues/1954).
267*60517a1eSAndroid Build Coastguard Worker
268*60517a1eSAndroid Build Coastguard Worker## [0.33.0] - 2024-06-12
269*60517a1eSAndroid Build Coastguard Worker
270*60517a1eSAndroid Build Coastguard Worker[0.33.0]: https://github.com/bazelbuild/rules_python/releases/tag/0.33.0
271*60517a1eSAndroid Build Coastguard Worker
272*60517a1eSAndroid Build Coastguard Worker### Changed
273*60517a1eSAndroid Build Coastguard Worker* (deps) Upgrade the `pip_install` dependencies to pick up a new version of pip.
274*60517a1eSAndroid Build Coastguard Worker* (toolchains) Optional toolchain dependency: `py_binary`, `py_test`, and
275*60517a1eSAndroid Build Coastguard Worker  `py_library` now depend on the `//python:exec_tools_toolchain_type` for build
276*60517a1eSAndroid Build Coastguard Worker  tools.
277*60517a1eSAndroid Build Coastguard Worker* (deps): Bumped `bazel_skylib` to 1.6.1.
278*60517a1eSAndroid Build Coastguard Worker* (bzlmod): The `python` and internal `rules_python` extensions have been
279*60517a1eSAndroid Build Coastguard Worker  marked as `reproducible` and will not include any lock file entries from now
280*60517a1eSAndroid Build Coastguard Worker  on.
281*60517a1eSAndroid Build Coastguard Worker* (gazelle): Remove gazelle plugin's python deps and make it hermetic.
282*60517a1eSAndroid Build Coastguard Worker  Introduced a new Go-based helper leveraging tree-sitter for syntax analysis.
283*60517a1eSAndroid Build Coastguard Worker  Implemented the use of `pypi/stdlib-list` for standard library module verification.
284*60517a1eSAndroid Build Coastguard Worker* (pip.parse): Do not ignore yanked packages when using `experimental_index_url`.
285*60517a1eSAndroid Build Coastguard Worker  This is to mimic what `uv` is doing. We will print a warning instead.
286*60517a1eSAndroid Build Coastguard Worker* (pip.parse): Add references to all supported wheels when using `experimental_index_url`
287*60517a1eSAndroid Build Coastguard Worker  to allowing to correctly fetch the wheels for the right platform. See the
288*60517a1eSAndroid Build Coastguard Worker  updated docs on how to use the feature. This is work towards addressing
289*60517a1eSAndroid Build Coastguard Worker  [#735](https://github.com/bazelbuild/rules_python/issues/735) and
290*60517a1eSAndroid Build Coastguard Worker  [#260](https://github.com/bazelbuild/rules_python/issues/260). The spoke
291*60517a1eSAndroid Build Coastguard Worker  repository names when using this flag will have a structure of
292*60517a1eSAndroid Build Coastguard Worker  `{pip_hub_prefix}_{wheel_name}_{py_tag}_{abi_tag}_{platform_tag}_{sha256}`,
293*60517a1eSAndroid Build Coastguard Worker  which is an implementation detail which should not be relied on and is there
294*60517a1eSAndroid Build Coastguard Worker  purely for better debugging experience.
295*60517a1eSAndroid Build Coastguard Worker* (bzlmod) The `pythons_hub//:interpreters.bzl` no longer has platform-specific
296*60517a1eSAndroid Build Coastguard Worker  labels which where left there for compatibility reasons. Move to
297*60517a1eSAndroid Build Coastguard Worker  `python_{version}_host` keys if you would like to have access to a Python
298*60517a1eSAndroid Build Coastguard Worker  interpreter that can be used in a repository rule context.
299*60517a1eSAndroid Build Coastguard Worker
300*60517a1eSAndroid Build Coastguard Worker### Fixed
301*60517a1eSAndroid Build Coastguard Worker* (gazelle) Remove `visibility` from `NonEmptyAttr`.
302*60517a1eSAndroid Build Coastguard Worker  Now empty(have no `deps/main/srcs/imports` attr) `py_library/test/binary` rules will
303*60517a1eSAndroid Build Coastguard Worker  be automatically deleted correctly. For example, if `python_generation_mode`
304*60517a1eSAndroid Build Coastguard Worker  is set to package, when `__init__.py` is deleted, the `py_library` generated
305*60517a1eSAndroid Build Coastguard Worker  for this package before will be deleted automatically.
306*60517a1eSAndroid Build Coastguard Worker* (whl_library): Use _is_python_config_setting_ to correctly handle multi-python
307*60517a1eSAndroid Build Coastguard Worker  version dependency select statements when the `experimental_target_platforms`
308*60517a1eSAndroid Build Coastguard Worker  includes the Python ABI. The default python version case within the select is
309*60517a1eSAndroid Build Coastguard Worker  also now handled correctly, stabilizing the implementation.
310*60517a1eSAndroid Build Coastguard Worker* (gazelle) Fix Gazelle failing on Windows with
311*60517a1eSAndroid Build Coastguard Worker  "panic: runtime error: invalid memory address or nil pointer dereference"
312*60517a1eSAndroid Build Coastguard Worker* (bzlmod) remove `pip.parse(annotations)` attribute as it is unused and has been
313*60517a1eSAndroid Build Coastguard Worker  replaced by whl_modifications.
314*60517a1eSAndroid Build Coastguard Worker* (pip) Correctly select wheels when the python tag includes minor versions.
315*60517a1eSAndroid Build Coastguard Worker  See ([#1930](https://github.com/bazelbuild/rules_python/issues/1930))
316*60517a1eSAndroid Build Coastguard Worker* (pip.parse): The lock file is now reproducible on any host platform if the
317*60517a1eSAndroid Build Coastguard Worker  `experimental_index_url` is not used by any of the modules in the dependency
318*60517a1eSAndroid Build Coastguard Worker  chain. To make the lock file identical on each `os` and `arch`, please use
319*60517a1eSAndroid Build Coastguard Worker  the `experimental_index_url` feature which will fetch metadata from PyPI or a
320*60517a1eSAndroid Build Coastguard Worker  different private index and write the contents to the lock file. Fixes
321*60517a1eSAndroid Build Coastguard Worker  [#1643](https://github.com/bazelbuild/rules_python/issues/1643).
322*60517a1eSAndroid Build Coastguard Worker* (pip.parse): Install `yanked` packages and print a warning instead of
323*60517a1eSAndroid Build Coastguard Worker  ignoring them. This better matches the behaviour of `uv pip install`.
324*60517a1eSAndroid Build Coastguard Worker* (toolchains): Now matching of the default hermetic toolchain is more robust
325*60517a1eSAndroid Build Coastguard Worker  and explicit and should fix rare edge-cases where the host toolchain
326*60517a1eSAndroid Build Coastguard Worker  autodetection would match a different toolchain than expected. This may yield
327*60517a1eSAndroid Build Coastguard Worker  to toolchain selection failures when the python toolchain is not registered,
328*60517a1eSAndroid Build Coastguard Worker  but is requested via `//python/config_settings:python_version` flag setting.
329*60517a1eSAndroid Build Coastguard Worker* (doc) Fix the `WORKSPACE` requirement vendoring example. Fixes
330*60517a1eSAndroid Build Coastguard Worker  [#1918](https://github.com/bazelbuild/rules_python/issues/1918).
331*60517a1eSAndroid Build Coastguard Worker
332*60517a1eSAndroid Build Coastguard Worker### Added
333*60517a1eSAndroid Build Coastguard Worker* (rules) Precompiling Python source at build time is available. but is
334*60517a1eSAndroid Build Coastguard Worker  disabled by default, for now. Set
335*60517a1eSAndroid Build Coastguard Worker  `@rules_python//python/config_settings:precompile=enabled` to enable it
336*60517a1eSAndroid Build Coastguard Worker  by default. A subsequent release will enable it by default. See the
337*60517a1eSAndroid Build Coastguard Worker  [Precompiling docs][precompile-docs] and API reference docs for more
338*60517a1eSAndroid Build Coastguard Worker  information on precompiling. Note this requires Bazel 7+ and the Pystar rule
339*60517a1eSAndroid Build Coastguard Worker  implementation enabled.
340*60517a1eSAndroid Build Coastguard Worker  ([#1761](https://github.com/bazelbuild/rules_python/issues/1761))
341*60517a1eSAndroid Build Coastguard Worker* (rules) Attributes and flags to control precompile behavior: `precompile`,
342*60517a1eSAndroid Build Coastguard Worker  `precompile_optimize_level`, `precompile_source_retention`,
343*60517a1eSAndroid Build Coastguard Worker  `precompile_invalidation_mode`, and `pyc_collection`
344*60517a1eSAndroid Build Coastguard Worker* (toolchains) The target runtime toolchain (`//python:toolchain_type`) has
345*60517a1eSAndroid Build Coastguard Worker  two new optional attributes: `pyc_tag` (tells the pyc filename infix to use) and
346*60517a1eSAndroid Build Coastguard Worker  `implementation_name` (tells the Python implementation name).
347*60517a1eSAndroid Build Coastguard Worker* (toolchains) A toolchain type for build tools has been added:
348*60517a1eSAndroid Build Coastguard Worker  `//python:exec_tools_toolchain_type`.
349*60517a1eSAndroid Build Coastguard Worker* (providers) `PyInfo` has two new attributes: `direct_pyc_files` and
350*60517a1eSAndroid Build Coastguard Worker  `transitive_pyc_files`, which tell the pyc files a target makes available
351*60517a1eSAndroid Build Coastguard Worker  directly and transitively, respectively.
352*60517a1eSAndroid Build Coastguard Worker* `//python:features.bzl` added to allow easy feature-detection in the future.
353*60517a1eSAndroid Build Coastguard Worker* (pip) Allow specifying the requirements by (os, arch) and add extra
354*60517a1eSAndroid Build Coastguard Worker  validations when parsing the inputs. This is a non-breaking change for most
355*60517a1eSAndroid Build Coastguard Worker  users unless they have been passing multiple `requirements_*` files together
356*60517a1eSAndroid Build Coastguard Worker  with `extra_pip_args = ["--platform=manylinux_2_4_x86_64"]`, that was an
357*60517a1eSAndroid Build Coastguard Worker  invalid usage previously but we were not failing the build. From now on this
358*60517a1eSAndroid Build Coastguard Worker  is explicitly disallowed.
359*60517a1eSAndroid Build Coastguard Worker* (toolchains) Added riscv64 platform definition for python toolchains.
360*60517a1eSAndroid Build Coastguard Worker* (gazelle) The `python_visibility` directive now supports the `$python_root$`
361*60517a1eSAndroid Build Coastguard Worker  placeholder, just like the `python_default_visibility` directive does.
362*60517a1eSAndroid Build Coastguard Worker* (rules) A new bootstrap implementation that doesn't require a system Python
363*60517a1eSAndroid Build Coastguard Worker  is available. It can be enabled by setting
364*60517a1eSAndroid Build Coastguard Worker  {obj}`--@rules_python//python/config_settings:bootstrap_impl=script`. It
365*60517a1eSAndroid Build Coastguard Worker  will become the default in a subsequent release.
366*60517a1eSAndroid Build Coastguard Worker  ([#691](https://github.com/bazelbuild/rules_python/issues/691))
367*60517a1eSAndroid Build Coastguard Worker* (providers) `PyRuntimeInfo` has two new attributes:
368*60517a1eSAndroid Build Coastguard Worker  {obj}`PyRuntimeInfo.stage2_bootstrap_template` and
369*60517a1eSAndroid Build Coastguard Worker  {obj}`PyRuntimeInfo.zip_main_template`.
370*60517a1eSAndroid Build Coastguard Worker* (toolchains) A replacement for the Bazel-builtn autodetecting toolchain is
371*60517a1eSAndroid Build Coastguard Worker  available. The `//python:autodetecting_toolchain` alias now uses it.
372*60517a1eSAndroid Build Coastguard Worker* (pip): Support fetching and using the wheels for other platforms. This
373*60517a1eSAndroid Build Coastguard Worker  supports customizing whether the linux wheels are pulled for `musl` or
374*60517a1eSAndroid Build Coastguard Worker  `glibc`, whether `universal2` or arch-specific MacOS wheels are preferred and
375*60517a1eSAndroid Build Coastguard Worker  it also allows to select a particular `libc` version. All of this is done via
376*60517a1eSAndroid Build Coastguard Worker  the `string_flags` in `@rules_python//python/config_settings`. If there are
377*60517a1eSAndroid Build Coastguard Worker  no wheels that are supported for the target platform, `rules_python` will
378*60517a1eSAndroid Build Coastguard Worker  fallback onto building the `sdist` from source. This behaviour can be
379*60517a1eSAndroid Build Coastguard Worker  disabled if desired using one of the available string flags as well.
380*60517a1eSAndroid Build Coastguard Worker* (whl_filegroup) Added a new `whl_filegroup` rule to extract files from a wheel file.
381*60517a1eSAndroid Build Coastguard Worker  This is useful to extract headers for use in a `cc_library`.
382*60517a1eSAndroid Build Coastguard Worker
383*60517a1eSAndroid Build Coastguard Worker[precompile-docs]: /precompiling
384*60517a1eSAndroid Build Coastguard Worker
385*60517a1eSAndroid Build Coastguard Worker## [0.32.2] - 2024-05-14
386*60517a1eSAndroid Build Coastguard Worker
387*60517a1eSAndroid Build Coastguard Worker[0.32.2]: https://github.com/bazelbuild/rules_python/releases/tag/0.32.2
388*60517a1eSAndroid Build Coastguard Worker
389*60517a1eSAndroid Build Coastguard Worker### Fixed
390*60517a1eSAndroid Build Coastguard Worker
391*60517a1eSAndroid Build Coastguard Worker* Workaround existence of infinite symlink loops on case insensitive filesystems when targeting linux platforms with recent Python toolchains. Works around an upstream [issue][indygreg-231]. Fixes [#1800][rules_python_1800].
392*60517a1eSAndroid Build Coastguard Worker
393*60517a1eSAndroid Build Coastguard Worker[indygreg-231]: https://github.com/indygreg/python-build-standalone/issues/231
394*60517a1eSAndroid Build Coastguard Worker[rules_python_1800]: https://github.com/bazelbuild/rules_python/issues/1800
395*60517a1eSAndroid Build Coastguard Worker
396*60517a1eSAndroid Build Coastguard Worker## [0.32.0] - 2024-05-12
397*60517a1eSAndroid Build Coastguard Worker
398*60517a1eSAndroid Build Coastguard Worker[0.32.0]: https://github.com/bazelbuild/rules_python/releases/tag/0.32.0
399*60517a1eSAndroid Build Coastguard Worker
400*60517a1eSAndroid Build Coastguard Worker### Changed
401*60517a1eSAndroid Build Coastguard Worker
402*60517a1eSAndroid Build Coastguard Worker* (bzlmod): The `MODULE.bazel.lock` `whl_library` rule attributes are now
403*60517a1eSAndroid Build Coastguard Worker  sorted in the attributes section. We are also removing values that are not
404*60517a1eSAndroid Build Coastguard Worker  default in order to reduce the size of the lock file.
405*60517a1eSAndroid Build Coastguard Worker* (coverage) Bump `coverage.py` to [7.4.3](https://github.com/nedbat/coveragepy/blob/master/CHANGES.rst#version-743--2024-02-23).
406*60517a1eSAndroid Build Coastguard Worker* (deps): Bumped `bazel_features` to 1.9.1 to detect optional support
407*60517a1eSAndroid Build Coastguard Worker  non-blocking downloads.
408*60517a1eSAndroid Build Coastguard Worker* (deps): Updated `pip_tools` to >= 7.4.0
409*60517a1eSAndroid Build Coastguard Worker* (toolchains): Change some old toolchain versions to use [20240224] release to
410*60517a1eSAndroid Build Coastguard Worker  include security fixes `3.8.18`, `3.9.18` and `3.10.13`
411*60517a1eSAndroid Build Coastguard Worker* (toolchains): Bump default toolchain versions to:
412*60517a1eSAndroid Build Coastguard Worker    * `3.8 -> 3.8.19`
413*60517a1eSAndroid Build Coastguard Worker    * `3.9 -> 3.9.19`
414*60517a1eSAndroid Build Coastguard Worker    * `3.10 -> 3.10.14`
415*60517a1eSAndroid Build Coastguard Worker    * `3.11 -> 3.11.9`
416*60517a1eSAndroid Build Coastguard Worker    * `3.12 -> 3.12.3`
417*60517a1eSAndroid Build Coastguard Worker
418*60517a1eSAndroid Build Coastguard Worker### Fixed
419*60517a1eSAndroid Build Coastguard Worker
420*60517a1eSAndroid Build Coastguard Worker* (whl_library): Fix the experimental_target_platforms overriding for platform
421*60517a1eSAndroid Build Coastguard Worker  specific wheels when the wheels are for any python interpreter version. Fixes
422*60517a1eSAndroid Build Coastguard Worker  [#1810](https://github.com/bazelbuild/rules_python/issues/1810).
423*60517a1eSAndroid Build Coastguard Worker* (whl_library): Stop generating duplicate dependencies when encountering
424*60517a1eSAndroid Build Coastguard Worker  duplicates in the METADATA. Fixes
425*60517a1eSAndroid Build Coastguard Worker  [#1873](https://github.com/bazelbuild/rules_python/issues/1873).
426*60517a1eSAndroid Build Coastguard Worker* (gazelle) In `project` or `package` generation modes, do not generate `py_test`
427*60517a1eSAndroid Build Coastguard Worker  rules when there are no test files and do not set `main = "__test__.py"` when
428*60517a1eSAndroid Build Coastguard Worker  that file doesn't exist.
429*60517a1eSAndroid Build Coastguard Worker* (whl_library) The group redirection is only added when the package is part of
430*60517a1eSAndroid Build Coastguard Worker  the group potentially fixing aspects that want to traverse a `py_library` graph.
431*60517a1eSAndroid Build Coastguard Worker  Fixes [#1760](https://github.com/bazelbuild/rules_python/issues/1760).
432*60517a1eSAndroid Build Coastguard Worker* (bzlmod) Setting a particular micro version for the interpreter and the
433*60517a1eSAndroid Build Coastguard Worker  `pip.parse` extension is now possible, see the
434*60517a1eSAndroid Build Coastguard Worker  `examples/pip_parse/MODULE.bazel` for how to do it.
435*60517a1eSAndroid Build Coastguard Worker  See [#1371](https://github.com/bazelbuild/rules_python/issues/1371).
436*60517a1eSAndroid Build Coastguard Worker* (refactor) The pre-commit developer workflow should now pass `isort` and `black`
437*60517a1eSAndroid Build Coastguard Worker  checks (see [#1674](https://github.com/bazelbuild/rules_python/issues/1674)).
438*60517a1eSAndroid Build Coastguard Worker
439*60517a1eSAndroid Build Coastguard Worker### Added
440*60517a1eSAndroid Build Coastguard Worker
441*60517a1eSAndroid Build Coastguard Worker* (toolchains) Added armv7 platform definition for python toolchains.
442*60517a1eSAndroid Build Coastguard Worker* (toolchains) New Python versions available: `3.11.8`, `3.12.2` using the [20240224] release.
443*60517a1eSAndroid Build Coastguard Worker* (toolchains) New Python versions available: `3.8.19`, `3.9.19`, `3.10.14`, `3.11.9`, `3.12.3` using
444*60517a1eSAndroid Build Coastguard Worker  the [20240415] release.
445*60517a1eSAndroid Build Coastguard Worker* (gazelle) Added a new `python_visibility` directive to control visibility
446*60517a1eSAndroid Build Coastguard Worker  of generated targets by appending additional visibility labels.
447*60517a1eSAndroid Build Coastguard Worker* (gazelle) Added a new `python_default_visibility` directive to control the
448*60517a1eSAndroid Build Coastguard Worker  _default_ visibility of generated targets. See the [docs][python_default_visibility]
449*60517a1eSAndroid Build Coastguard Worker  for details.
450*60517a1eSAndroid Build Coastguard Worker* (gazelle) Added a new `python_test_file_pattern` directive. This directive tells
451*60517a1eSAndroid Build Coastguard Worker  gazelle which python files should be mapped to the `py_test` rule. See the
452*60517a1eSAndroid Build Coastguard Worker  [original issue][test_file_pattern_issue] and the [docs][test_file_pattern_docs]
453*60517a1eSAndroid Build Coastguard Worker  for details.
454*60517a1eSAndroid Build Coastguard Worker* (wheel) Add support for `data_files` attributes in py_wheel rule
455*60517a1eSAndroid Build Coastguard Worker  ([#1777](https://github.com/bazelbuild/rules_python/issues/1777))
456*60517a1eSAndroid Build Coastguard Worker* (py_wheel) `bzlmod` installations now provide a `twine` setup for the default
457*60517a1eSAndroid Build Coastguard Worker  Python toolchain in `rules_python` for version 3.11.
458*60517a1eSAndroid Build Coastguard Worker* (bzlmod) New `experimental_index_url`, `experimental_extra_index_urls` and
459*60517a1eSAndroid Build Coastguard Worker  `experimental_index_url_overrides` to `pip.parse` for using the bazel
460*60517a1eSAndroid Build Coastguard Worker  downloader. If you see any issues, report in
461*60517a1eSAndroid Build Coastguard Worker  [#1357](https://github.com/bazelbuild/rules_python/issues/1357). The URLs for
462*60517a1eSAndroid Build Coastguard Worker  the whl and sdist files will be written to the lock file. Controlling whether
463*60517a1eSAndroid Build Coastguard Worker  the downloading of metadata is done in parallel can be done using
464*60517a1eSAndroid Build Coastguard Worker  `parallel_download` attribute.
465*60517a1eSAndroid Build Coastguard Worker* (gazelle) Add a new annotation `include_dep`. Also add documentation for
466*60517a1eSAndroid Build Coastguard Worker  annotations to `gazelle/README.md`.
467*60517a1eSAndroid Build Coastguard Worker* (deps): `rules_python` depends now on `rules_cc` 0.0.9
468*60517a1eSAndroid Build Coastguard Worker* (pip_parse): A new flag `use_hub_alias_dependencies` has been added that is going
469*60517a1eSAndroid Build Coastguard Worker  to become default in the next release. This makes use of `dep_template` flag
470*60517a1eSAndroid Build Coastguard Worker  in the `whl_library` rule. This also affects the
471*60517a1eSAndroid Build Coastguard Worker  `experimental_requirement_cycles` feature where the dependencies that are in
472*60517a1eSAndroid Build Coastguard Worker  a group would be only accessible via the hub repo aliases. If you still
473*60517a1eSAndroid Build Coastguard Worker  depend on legacy labels instead of the hub repo aliases and you use the
474*60517a1eSAndroid Build Coastguard Worker  `experimental_requirement_cycles`, now is a good time to migrate.
475*60517a1eSAndroid Build Coastguard Worker
476*60517a1eSAndroid Build Coastguard Worker[python_default_visibility]: gazelle/README.md#directive-python_default_visibility
477*60517a1eSAndroid Build Coastguard Worker[test_file_pattern_issue]: https://github.com/bazelbuild/rules_python/issues/1816
478*60517a1eSAndroid Build Coastguard Worker[test_file_pattern_docs]: gazelle/README.md#directive-python_test_file_pattern
479*60517a1eSAndroid Build Coastguard Worker[20240224]: https://github.com/indygreg/python-build-standalone/releases/tag/20240224.
480*60517a1eSAndroid Build Coastguard Worker[20240415]: https://github.com/indygreg/python-build-standalone/releases/tag/20240415.
481*60517a1eSAndroid Build Coastguard Worker
482*60517a1eSAndroid Build Coastguard Worker
483*60517a1eSAndroid Build Coastguard Worker## [0.31.0] - 2024-02-12
484*60517a1eSAndroid Build Coastguard Worker
485*60517a1eSAndroid Build Coastguard Worker[0.31.0]: https://github.com/bazelbuild/rules_python/releases/tag/0.31.0
486*60517a1eSAndroid Build Coastguard Worker
487*60517a1eSAndroid Build Coastguard Worker### Changed
488*60517a1eSAndroid Build Coastguard Worker
489*60517a1eSAndroid Build Coastguard Worker* For Bazel 7, the core rules and providers are now implemented in rules_python
490*60517a1eSAndroid Build Coastguard Worker  directly and the rules bundled with Bazel are not used. Bazel 6 and earlier
491*60517a1eSAndroid Build Coastguard Worker  continue to use the Bazel builtin symbols. Of particular note, this means,
492*60517a1eSAndroid Build Coastguard Worker  under Bazel 7, the builtin global symbol `PyInfo` is **not** the same as what
493*60517a1eSAndroid Build Coastguard Worker  is loaded from rules_python. The same is true of `PyRuntimeInfo`.
494*60517a1eSAndroid Build Coastguard Worker
495*60517a1eSAndroid Build Coastguard Worker## [0.30.0] - 2024-02-12
496*60517a1eSAndroid Build Coastguard Worker
497*60517a1eSAndroid Build Coastguard Worker[0.30.0]: https://github.com/bazelbuild/rules_python/releases/tag/0.30.0
498*60517a1eSAndroid Build Coastguard Worker
499*60517a1eSAndroid Build Coastguard Worker### Changed
500*60517a1eSAndroid Build Coastguard Worker
501*60517a1eSAndroid Build Coastguard Worker* (toolchains) Windows hosts always ignore pyc files in the downloaded runtimes.
502*60517a1eSAndroid Build Coastguard Worker  This fixes issues due to pyc files being created at runtime and affecting the
503*60517a1eSAndroid Build Coastguard Worker  definition of what files were considered part of the runtime.
504*60517a1eSAndroid Build Coastguard Worker
505*60517a1eSAndroid Build Coastguard Worker* (pip_parse) Added the `envsubst` parameter, which enables environment variable
506*60517a1eSAndroid Build Coastguard Worker  substitutions in the `extra_pip_args` attribute.
507*60517a1eSAndroid Build Coastguard Worker
508*60517a1eSAndroid Build Coastguard Worker* (pip_repository) Added the `envsubst` parameter, which enables environment
509*60517a1eSAndroid Build Coastguard Worker  variable substitutions in the `extra_pip_args` attribute.
510*60517a1eSAndroid Build Coastguard Worker
511*60517a1eSAndroid Build Coastguard Worker### Fixed
512*60517a1eSAndroid Build Coastguard Worker
513*60517a1eSAndroid Build Coastguard Worker* (bzlmod) pip.parse now does not fail with an empty `requirements.txt`.
514*60517a1eSAndroid Build Coastguard Worker
515*60517a1eSAndroid Build Coastguard Worker* (py_wheel) Wheels generated by `py_wheel` now preserve executable bits when
516*60517a1eSAndroid Build Coastguard Worker  being extracted by `installer` and/or `pip`.
517*60517a1eSAndroid Build Coastguard Worker
518*60517a1eSAndroid Build Coastguard Worker* (coverage) During the running of lcov, the stdout/stderr was causing test
519*60517a1eSAndroid Build Coastguard Worker  failures.  By default, suppress output when generating lcov.  This can be
520*60517a1eSAndroid Build Coastguard Worker  overridden by setting 'VERBOSE_COVERAGE'.  This change only affect bazel
521*60517a1eSAndroid Build Coastguard Worker  7.x.x and above.
522*60517a1eSAndroid Build Coastguard Worker
523*60517a1eSAndroid Build Coastguard Worker* (toolchain) Changed the `host_toolchain` to symlink all files to support
524*60517a1eSAndroid Build Coastguard Worker  Windows host environments without symlink support.
525*60517a1eSAndroid Build Coastguard Worker
526*60517a1eSAndroid Build Coastguard Worker* (PyRuntimeInfo) Switch back to builtin PyRuntimeInfo for Bazel 6.4 and when
527*60517a1eSAndroid Build Coastguard Worker  pystar is disabled. This fixes an error about `target ... does not have ...
528*60517a1eSAndroid Build Coastguard Worker  PyRuntimeInfo`.
529*60517a1eSAndroid Build Coastguard Worker  ([#1732](https://github.com/bazelbuild/rules_python/issues/1732))
530*60517a1eSAndroid Build Coastguard Worker
531*60517a1eSAndroid Build Coastguard Worker### Added
532*60517a1eSAndroid Build Coastguard Worker
533*60517a1eSAndroid Build Coastguard Worker* (py_wheel) Added `requires_file` and `extra_requires_files` attributes.
534*60517a1eSAndroid Build Coastguard Worker
535*60517a1eSAndroid Build Coastguard Worker* (whl_library) *experimental_target_platforms* now supports specifying the
536*60517a1eSAndroid Build Coastguard Worker  Python version explicitly and the output `BUILD.bazel` file will be correct
537*60517a1eSAndroid Build Coastguard Worker  irrespective of the python interpreter that is generating the file and
538*60517a1eSAndroid Build Coastguard Worker  extracting the `whl` distribution. Multiple python target version can be
539*60517a1eSAndroid Build Coastguard Worker  specified and the code generation will generate version specific dependency
540*60517a1eSAndroid Build Coastguard Worker  closures but that is not yet ready to be used and may break the build if
541*60517a1eSAndroid Build Coastguard Worker  the default python version is not selected using
542*60517a1eSAndroid Build Coastguard Worker  `common --@rules_python//python/config_settings:python_version=X.Y.Z`.
543*60517a1eSAndroid Build Coastguard Worker
544*60517a1eSAndroid Build Coastguard Worker* New Python versions available: `3.11.7`, `3.12.1` using
545*60517a1eSAndroid Build Coastguard Worker  https://github.com/indygreg/python-build-standalone/releases/tag/20240107.
546*60517a1eSAndroid Build Coastguard Worker
547*60517a1eSAndroid Build Coastguard Worker* (toolchain) Allow setting `x.y` as the `python_version` parameter in
548*60517a1eSAndroid Build Coastguard Worker  the version-aware `py_binary` and `py_test` rules. This allows users to
549*60517a1eSAndroid Build Coastguard Worker  use the same rule import for testing with specific Python versions and
550*60517a1eSAndroid Build Coastguard Worker  rely on toolchain configuration and how the latest version takes precedence
551*60517a1eSAndroid Build Coastguard Worker  if e.g. `3.8` is selected. That also simplifies `.bazelrc` for any users
552*60517a1eSAndroid Build Coastguard Worker  that set the default `python_version` string flag in that way.
553*60517a1eSAndroid Build Coastguard Worker
554*60517a1eSAndroid Build Coastguard Worker* (toolchain) The runtime's shared libraries (libpython.so et al) can be
555*60517a1eSAndroid Build Coastguard Worker  accessed using `@rules_python//python/cc:current_py_cc_libs`. This uses
556*60517a1eSAndroid Build Coastguard Worker  toolchain resolution, so the files are from the same runtime used to run a
557*60517a1eSAndroid Build Coastguard Worker  target. If you were previously using e.g. `@python_3_11//:libpython`, then
558*60517a1eSAndroid Build Coastguard Worker  switch to `:current_py_cc_libs` for looser coupling to the underlying runtime
559*60517a1eSAndroid Build Coastguard Worker  repo implementation.
560*60517a1eSAndroid Build Coastguard Worker
561*60517a1eSAndroid Build Coastguard Worker* (repo rules) The environment variable `RULES_PYTHON_REPO_DEBUG=1` can be
562*60517a1eSAndroid Build Coastguard Worker  set to make repository rules log detailed information about what they're
563*60517a1eSAndroid Build Coastguard Worker  up to.
564*60517a1eSAndroid Build Coastguard Worker
565*60517a1eSAndroid Build Coastguard Worker* (coverage) Add support for python 3.12 and bump `coverage.py` to
566*60517a1eSAndroid Build Coastguard Worker  7.4.1.
567*60517a1eSAndroid Build Coastguard Worker
568*60517a1eSAndroid Build Coastguard Worker
569*60517a1eSAndroid Build Coastguard Worker## [0.29.0] - 2024-01-22
570*60517a1eSAndroid Build Coastguard Worker
571*60517a1eSAndroid Build Coastguard Worker[0.29.0]: https://github.com/bazelbuild/rules_python/releases/tag/0.29.0
572*60517a1eSAndroid Build Coastguard Worker
573*60517a1eSAndroid Build Coastguard Worker### Changed
574*60517a1eSAndroid Build Coastguard Worker
575*60517a1eSAndroid Build Coastguard Worker* **BREAKING** The deprecated `incompatible_generate_aliases` feature flags
576*60517a1eSAndroid Build Coastguard Worker  from `pip_parse` and `gazelle` got removed. They had been flipped to `True`
577*60517a1eSAndroid Build Coastguard Worker  in 0.27.0 release.
578*60517a1eSAndroid Build Coastguard Worker* **BREAKING** (wheel) The `incompatible_normalize_name` and
579*60517a1eSAndroid Build Coastguard Worker  `incompatible_normalize_version` flags have been removed. They had been
580*60517a1eSAndroid Build Coastguard Worker  flipped to `True` in 0.27.0 release.
581*60517a1eSAndroid Build Coastguard Worker* (bzlmod) The pip hub repository now uses the newly introduced config settings
582*60517a1eSAndroid Build Coastguard Worker  using the `X.Y` python version notation. This improves cross module
583*60517a1eSAndroid Build Coastguard Worker  interoperability and allows to share wheels built by interpreters using
584*60517a1eSAndroid Build Coastguard Worker  different patch versions.
585*60517a1eSAndroid Build Coastguard Worker
586*60517a1eSAndroid Build Coastguard Worker### Fixed
587*60517a1eSAndroid Build Coastguard Worker
588*60517a1eSAndroid Build Coastguard Worker* (bzlmod pip.parse) Use a platform-independent reference to the interpreter
589*60517a1eSAndroid Build Coastguard Worker  pip uses. This reduces (but doesn't eliminate) the amount of
590*60517a1eSAndroid Build Coastguard Worker  platform-specific content in `MODULE.bazel.lock` files; Follow
591*60517a1eSAndroid Build Coastguard Worker  [#1643](https://github.com/bazelbuild/rules_python/issues/1643) for removing
592*60517a1eSAndroid Build Coastguard Worker  platform-specific content in `MODULE.bazel.lock` files.
593*60517a1eSAndroid Build Coastguard Worker
594*60517a1eSAndroid Build Coastguard Worker* (wheel) The stamp variables inside the distribution name are no longer
595*60517a1eSAndroid Build Coastguard Worker  lower-cased when normalizing under PEP440 conventions.
596*60517a1eSAndroid Build Coastguard Worker
597*60517a1eSAndroid Build Coastguard Worker### Added
598*60517a1eSAndroid Build Coastguard Worker
599*60517a1eSAndroid Build Coastguard Worker* (toolchains) `python_register_toolchains` now also generates a repository
600*60517a1eSAndroid Build Coastguard Worker  that is suffixed with `_host`, that has a single label `:python` that is a
601*60517a1eSAndroid Build Coastguard Worker  symlink to the python interpreter for the host platform. The intended use is
602*60517a1eSAndroid Build Coastguard Worker  mainly in `repository_rule`, which are always run using `host` platform
603*60517a1eSAndroid Build Coastguard Worker  Python. This means that `WORKSPACE` users can now copy the `requirements.bzl`
604*60517a1eSAndroid Build Coastguard Worker  file for vendoring as seen in the updated `pip_parse_vendored` example.
605*60517a1eSAndroid Build Coastguard Worker
606*60517a1eSAndroid Build Coastguard Worker* (runfiles) `rules_python.python.runfiles.Runfiles` now has a static `Create`
607*60517a1eSAndroid Build Coastguard Worker  method to make imports more ergonomic. Users should only need to import the
608*60517a1eSAndroid Build Coastguard Worker  `Runfiles` object to locate runfiles.
609*60517a1eSAndroid Build Coastguard Worker
610*60517a1eSAndroid Build Coastguard Worker* (toolchains) `PyRuntimeInfo` now includes a `interpreter_version_info` field
611*60517a1eSAndroid Build Coastguard Worker  that contains the static version information for the given interpreter.
612*60517a1eSAndroid Build Coastguard Worker  This can be set via `py_runtime` when registering an interpreter toolchain,
613*60517a1eSAndroid Build Coastguard Worker  and will done automatically for the builtin interpreter versions registered via
614*60517a1eSAndroid Build Coastguard Worker  `python_register_toolchains`.
615*60517a1eSAndroid Build Coastguard Worker  Note that this only available on the Starlark implementation of the provider.
616*60517a1eSAndroid Build Coastguard Worker
617*60517a1eSAndroid Build Coastguard Worker* (config_settings) Added `//python/config_settings:is_python_X.Y` config
618*60517a1eSAndroid Build Coastguard Worker  settings to match on minor Python version. These settings match any `X.Y`
619*60517a1eSAndroid Build Coastguard Worker  version instead of just an exact `X.Y.Z` version.
620*60517a1eSAndroid Build Coastguard Worker
621*60517a1eSAndroid Build Coastguard Worker## [0.28.0] - 2024-01-07
622*60517a1eSAndroid Build Coastguard Worker
623*60517a1eSAndroid Build Coastguard Worker[0.28.0]: https://github.com/bazelbuild/rules_python/releases/tag/0.28.0
624*60517a1eSAndroid Build Coastguard Worker
625*60517a1eSAndroid Build Coastguard Worker### Changed
626*60517a1eSAndroid Build Coastguard Worker
627*60517a1eSAndroid Build Coastguard Worker* **BREAKING** (pip_install) the deprecated `pip_install` macro and related
628*60517a1eSAndroid Build Coastguard Worker  items have been removed.
629*60517a1eSAndroid Build Coastguard Worker
630*60517a1eSAndroid Build Coastguard Worker* **BREAKING** Support for Bazel 5 has been officially dropped. This release
631*60517a1eSAndroid Build Coastguard Worker  was only partially tested with Bazel 5 and may or may not work with Bazel 5.
632*60517a1eSAndroid Build Coastguard Worker  Subequent versions will no longer be tested under Bazel 5.
633*60517a1eSAndroid Build Coastguard Worker
634*60517a1eSAndroid Build Coastguard Worker* (runfiles) `rules_python.python.runfiles` now directly implements type hints
635*60517a1eSAndroid Build Coastguard Worker  and drops support for python2 as a result.
636*60517a1eSAndroid Build Coastguard Worker
637*60517a1eSAndroid Build Coastguard Worker* (toolchains) `py_runtime`, `py_runtime_pair`, and `PyRuntimeInfo` now use the
638*60517a1eSAndroid Build Coastguard Worker  rules_python Starlark implementation, not the one built into Bazel. NOTE: This
639*60517a1eSAndroid Build Coastguard Worker  only applies to Bazel 6+; Bazel 5 still uses the builtin implementation.
640*60517a1eSAndroid Build Coastguard Worker
641*60517a1eSAndroid Build Coastguard Worker* (pip_parse) The parameter `experimental_requirement_cycles` may be provided a
642*60517a1eSAndroid Build Coastguard Worker  map of names to lists of requirements which form a dependency
643*60517a1eSAndroid Build Coastguard Worker  cycle. `pip_parse` will break the cycle for you transparently. This behavior
644*60517a1eSAndroid Build Coastguard Worker  is also available under bzlmod as
645*60517a1eSAndroid Build Coastguard Worker  `pip.parse(experimental_requirement_cycles={})`.
646*60517a1eSAndroid Build Coastguard Worker
647*60517a1eSAndroid Build Coastguard Worker* (toolchains) `py_runtime` can now take an executable target. Note: runfiles
648*60517a1eSAndroid Build Coastguard Worker  from the target are not supported yet.
649*60517a1eSAndroid Build Coastguard Worker  ([#1612](https://github.com/bazelbuild/rules_python/issues/1612))
650*60517a1eSAndroid Build Coastguard Worker
651*60517a1eSAndroid Build Coastguard Worker* (gazelle) When `python_generation_mode` is set to `file`, create one `py_binary`
652*60517a1eSAndroid Build Coastguard Worker  target for each file with `if __name__ == "__main__"` instead of just one
653*60517a1eSAndroid Build Coastguard Worker  `py_binary` for the whole module.
654*60517a1eSAndroid Build Coastguard Worker
655*60517a1eSAndroid Build Coastguard Worker* (gazelle) the Gazelle manifest integrity field is now optional. If the
656*60517a1eSAndroid Build Coastguard Worker  `requirements` argument to `gazelle_python_manifest` is unset, no integrity
657*60517a1eSAndroid Build Coastguard Worker  field will be generated.
658*60517a1eSAndroid Build Coastguard Worker
659*60517a1eSAndroid Build Coastguard Worker### Fixed
660*60517a1eSAndroid Build Coastguard Worker
661*60517a1eSAndroid Build Coastguard Worker* (gazelle) The gazelle plugin helper was not working with Python toolchains 3.11
662*60517a1eSAndroid Build Coastguard Worker  and above due to a bug in the helper components not being on PYTHONPATH.
663*60517a1eSAndroid Build Coastguard Worker
664*60517a1eSAndroid Build Coastguard Worker* (pip_parse) The repositories created by `whl_library` can now parse the `whl`
665*60517a1eSAndroid Build Coastguard Worker  METADATA and generate dependency closures irrespective of the host platform
666*60517a1eSAndroid Build Coastguard Worker  the generation is executed on. This can be turned on by supplying
667*60517a1eSAndroid Build Coastguard Worker  `experimental_target_platforms = ["all"]` to the `pip_parse` or the `bzlmod`
668*60517a1eSAndroid Build Coastguard Worker  equivalent. This may help in cases where fetching wheels for a different
669*60517a1eSAndroid Build Coastguard Worker  platform using `download_only = True` feature.
670*60517a1eSAndroid Build Coastguard Worker* (bzlmod pip.parse) The `pip.parse(python_interpreter)` arg now works for
671*60517a1eSAndroid Build Coastguard Worker  specifying a local system interpreter.
672*60517a1eSAndroid Build Coastguard Worker* (bzlmod pip.parse) Requirements files with duplicate entries for the same
673*60517a1eSAndroid Build Coastguard Worker  package (e.g. one for the package, one for an extra) now work.
674*60517a1eSAndroid Build Coastguard Worker* (bzlmod python.toolchain) Submodules can now (re)register the Python version
675*60517a1eSAndroid Build Coastguard Worker  that rules_python has set as the default.
676*60517a1eSAndroid Build Coastguard Worker  ([#1638](https://github.com/bazelbuild/rules_python/issues/1638))
677*60517a1eSAndroid Build Coastguard Worker* (whl_library) Actually use the provided patches to patch the whl_library.
678*60517a1eSAndroid Build Coastguard Worker  On Windows the patching may result in files with CRLF line endings, as a result
679*60517a1eSAndroid Build Coastguard Worker  the RECORD file consistency requirement is lifted and now a warning is emitted
680*60517a1eSAndroid Build Coastguard Worker  instead with a location to the patch that could be used to silence the warning.
681*60517a1eSAndroid Build Coastguard Worker  Copy the patch to your workspace and add it to the list if patches for the wheel
682*60517a1eSAndroid Build Coastguard Worker  file if you decide to do so.
683*60517a1eSAndroid Build Coastguard Worker* (coverage): coverage reports are now created when the version-aware
684*60517a1eSAndroid Build Coastguard Worker  rules are used.
685*60517a1eSAndroid Build Coastguard Worker  ([#1600](https://github.com/bazelbuild/rules_python/issues/1600))
686*60517a1eSAndroid Build Coastguard Worker* (toolchains) Workspace builds register the py cc toolchain (bzlmod already
687*60517a1eSAndroid Build Coastguard Worker  was). This makes e.g. `//python/cc:current_py_cc_headers` Just Work.
688*60517a1eSAndroid Build Coastguard Worker  ([#1669](https://github.com/bazelbuild/rules_python/issues/1669))
689*60517a1eSAndroid Build Coastguard Worker* (bzlmod python.toolchain) The value of `ignore_root_user_error` is now decided
690*60517a1eSAndroid Build Coastguard Worker  by the root module only.
691*60517a1eSAndroid Build Coastguard Worker  ([#1658](https://github.com/bazelbuild/rules_python/issues/1658))
692*60517a1eSAndroid Build Coastguard Worker
693*60517a1eSAndroid Build Coastguard Worker### Added
694*60517a1eSAndroid Build Coastguard Worker
695*60517a1eSAndroid Build Coastguard Worker* (docs) bzlmod extensions are now documented on rules-python.readthedocs.io
696*60517a1eSAndroid Build Coastguard Worker* (docs) Support and backwards compatibility policies have been documented.
697*60517a1eSAndroid Build Coastguard Worker  See https://rules-python.readthedocs.io/en/latest/support.html
698*60517a1eSAndroid Build Coastguard Worker* (gazelle) `file` generation mode can now also add `__init__.py` to the srcs
699*60517a1eSAndroid Build Coastguard Worker  attribute for every target in the package. This is enabled through a separate
700*60517a1eSAndroid Build Coastguard Worker  directive `python_generation_mode_per_file_include_init`.
701*60517a1eSAndroid Build Coastguard Worker
702*60517a1eSAndroid Build Coastguard Worker## [0.27.0] - 2023-11-16
703*60517a1eSAndroid Build Coastguard Worker
704*60517a1eSAndroid Build Coastguard Worker[0.27.0]: https://github.com/bazelbuild/rules_python/releases/tag/0.27.0
705*60517a1eSAndroid Build Coastguard Worker
706*60517a1eSAndroid Build Coastguard Worker### Changed
707*60517a1eSAndroid Build Coastguard Worker
708*60517a1eSAndroid Build Coastguard Worker* Make `//python/pip_install:pip_repository_bzl` `bzl_library` target internal
709*60517a1eSAndroid Build Coastguard Worker  as all of the publicly available symbols (etc. `package_annotation`) are
710*60517a1eSAndroid Build Coastguard Worker  re-exported via `//python:pip_bzl` `bzl_library`.
711*60517a1eSAndroid Build Coastguard Worker
712*60517a1eSAndroid Build Coastguard Worker* (gazelle) Gazelle Python extension no longer has runtime dependencies. Using
713*60517a1eSAndroid Build Coastguard Worker  `GAZELLE_PYTHON_RUNTIME_DEPS` from `@rules_python_gazelle_plugin//:def.bzl` is
714*60517a1eSAndroid Build Coastguard Worker  no longer necessary.
715*60517a1eSAndroid Build Coastguard Worker
716*60517a1eSAndroid Build Coastguard Worker* (pip_parse) The installation of `pip_parse` repository rule toolchain
717*60517a1eSAndroid Build Coastguard Worker  dependencies is now done as part of `py_repositories` call.
718*60517a1eSAndroid Build Coastguard Worker
719*60517a1eSAndroid Build Coastguard Worker* (pip_parse) The generated `requirements.bzl` file now has an additional symbol
720*60517a1eSAndroid Build Coastguard Worker  `all_whl_requirements_by_package` which provides a map from the normalized
721*60517a1eSAndroid Build Coastguard Worker  PyPI package name to the target that provides the built wheel file. Use
722*60517a1eSAndroid Build Coastguard Worker  `pip_utils.normalize_name` function from `@rules_python//python:pip.bzl` to
723*60517a1eSAndroid Build Coastguard Worker  convert a PyPI package name to a key in the `all_whl_requirements_by_package`
724*60517a1eSAndroid Build Coastguard Worker  map.
725*60517a1eSAndroid Build Coastguard Worker
726*60517a1eSAndroid Build Coastguard Worker* (pip_parse) The flag `incompatible_generate_aliases` has been flipped to
727*60517a1eSAndroid Build Coastguard Worker  `True` by default on `non-bzlmod` setups allowing users to use the same label
728*60517a1eSAndroid Build Coastguard Worker  strings during the transition period. For example, instead of
729*60517a1eSAndroid Build Coastguard Worker  `@pypi_foo//:pkg`, you can now use `@pypi//foo` or `@pypi//foo:pkg`. Other
730*60517a1eSAndroid Build Coastguard Worker  labels that are present in the `foo` package are `dist_info`, `whl` and
731*60517a1eSAndroid Build Coastguard Worker  `data`. Note, that the `@pypi_foo//:pkg` labels are still present for
732*60517a1eSAndroid Build Coastguard Worker  backwards compatibility.
733*60517a1eSAndroid Build Coastguard Worker
734*60517a1eSAndroid Build Coastguard Worker* (gazelle) The flag `use_pip_repository_aliases` is now set to `True` by
735*60517a1eSAndroid Build Coastguard Worker  default, which will cause `gazelle` to change third-party dependency labels
736*60517a1eSAndroid Build Coastguard Worker  from `@pip_foo//:pkg` to `@pip//foo` by default.
737*60517a1eSAndroid Build Coastguard Worker
738*60517a1eSAndroid Build Coastguard Worker* The `compile_pip_requirements` now defaults to `pyproject.toml` if the `src`
739*60517a1eSAndroid Build Coastguard Worker  or `requirements_in` attributes are unspecified, matching the upstream
740*60517a1eSAndroid Build Coastguard Worker  `pip-compile` behaviour more closely.
741*60517a1eSAndroid Build Coastguard Worker
742*60517a1eSAndroid Build Coastguard Worker* (gazelle) Use relative paths if possible for dependencies added through
743*60517a1eSAndroid Build Coastguard Worker  the use of the `resolve` directive.
744*60517a1eSAndroid Build Coastguard Worker
745*60517a1eSAndroid Build Coastguard Worker* (gazelle) When using `python_generation_mode file`, one `py_test` target is
746*60517a1eSAndroid Build Coastguard Worker  made per test file even if a target named `__test__` or a file named
747*60517a1eSAndroid Build Coastguard Worker  `__test__.py` exists in the same package. Previously in these cases there
748*60517a1eSAndroid Build Coastguard Worker  would only be one test target made.
749*60517a1eSAndroid Build Coastguard Worker
750*60517a1eSAndroid Build Coastguard WorkerBreaking changes:
751*60517a1eSAndroid Build Coastguard Worker
752*60517a1eSAndroid Build Coastguard Worker* (pip) `pip_install` repository rule in this release has been disabled and
753*60517a1eSAndroid Build Coastguard Worker  will fail by default. The API symbol is going to be removed in the next
754*60517a1eSAndroid Build Coastguard Worker  version, please migrate to `pip_parse` as a replacement. The `pip_parse`
755*60517a1eSAndroid Build Coastguard Worker  rule no longer supports `requirements` attribute, please use
756*60517a1eSAndroid Build Coastguard Worker  `requirements_lock` instead.
757*60517a1eSAndroid Build Coastguard Worker
758*60517a1eSAndroid Build Coastguard Worker* (py_wheel) switch `incompatible_normalize_name` and
759*60517a1eSAndroid Build Coastguard Worker  `incompatible_normalize_version` to `True` by default to enforce `PEP440`
760*60517a1eSAndroid Build Coastguard Worker  for wheel names built by `rules_python`.
761*60517a1eSAndroid Build Coastguard Worker
762*60517a1eSAndroid Build Coastguard Worker* (tools/wheelmaker.py) drop support for Python 2 as only Python 3 is tested.
763*60517a1eSAndroid Build Coastguard Worker
764*60517a1eSAndroid Build Coastguard Worker### Fixed
765*60517a1eSAndroid Build Coastguard Worker
766*60517a1eSAndroid Build Coastguard Worker* Skip aliases for unloaded toolchains. Some Python versions that don't have full
767*60517a1eSAndroid Build Coastguard Worker  platform support, and referencing their undefined repositories can break operations
768*60517a1eSAndroid Build Coastguard Worker  like `bazel query rdeps(...)`.
769*60517a1eSAndroid Build Coastguard Worker
770*60517a1eSAndroid Build Coastguard Worker* Python code generated from `proto_library` with `strip_import_prefix` can be imported now.
771*60517a1eSAndroid Build Coastguard Worker
772*60517a1eSAndroid Build Coastguard Worker* (py_wheel) Produce deterministic wheel files and make `RECORD` file entries
773*60517a1eSAndroid Build Coastguard Worker  follow the order of files written to the `.whl` archive.
774*60517a1eSAndroid Build Coastguard Worker
775*60517a1eSAndroid Build Coastguard Worker* (gazelle) Generate a single `py_test` target when `gazelle:python_generation_mode project`
776*60517a1eSAndroid Build Coastguard Worker  is used.
777*60517a1eSAndroid Build Coastguard Worker
778*60517a1eSAndroid Build Coastguard Worker* (gazelle) Move waiting for the Python interpreter process to exit to the shutdown hook
779*60517a1eSAndroid Build Coastguard Worker  to make the usage of the `exec.Command` more idiomatic.
780*60517a1eSAndroid Build Coastguard Worker
781*60517a1eSAndroid Build Coastguard Worker* (toolchains) Keep tcl subdirectory in Windows build of hermetic interpreter.
782*60517a1eSAndroid Build Coastguard Worker
783*60517a1eSAndroid Build Coastguard Worker* (bzlmod) sub-modules now don't have the `//conditions:default` clause in the
784*60517a1eSAndroid Build Coastguard Worker  hub repos created by `pip.parse`. This should fix confusing error messages
785*60517a1eSAndroid Build Coastguard Worker  in case there is a misconfiguration of toolchains or a bug in `rules_python`.
786*60517a1eSAndroid Build Coastguard Worker
787*60517a1eSAndroid Build Coastguard Worker### Added
788*60517a1eSAndroid Build Coastguard Worker
789*60517a1eSAndroid Build Coastguard Worker* (bzlmod) Added `.whl` patching support via `patches` and `patch_strip`
790*60517a1eSAndroid Build Coastguard Worker  arguments to the new `pip.override` tag class.
791*60517a1eSAndroid Build Coastguard Worker
792*60517a1eSAndroid Build Coastguard Worker* (pip) Support for using [PEP621](https://peps.python.org/pep-0621/) compliant
793*60517a1eSAndroid Build Coastguard Worker  `pyproject.toml` for creating a resolved `requirements.txt` file.
794*60517a1eSAndroid Build Coastguard Worker
795*60517a1eSAndroid Build Coastguard Worker* (utils) Added a `pip_utils` struct with a `normalize_name` function to allow users
796*60517a1eSAndroid Build Coastguard Worker  to find out how `rules_python` would normalize a PyPI distribution name.
797*60517a1eSAndroid Build Coastguard Worker
798*60517a1eSAndroid Build Coastguard Worker## [0.26.0] - 2023-10-06
799*60517a1eSAndroid Build Coastguard Worker
800*60517a1eSAndroid Build Coastguard Worker### Changed
801*60517a1eSAndroid Build Coastguard Worker
802*60517a1eSAndroid Build Coastguard Worker* Python version patch level bumps:
803*60517a1eSAndroid Build Coastguard Worker  * 3.8.15  -> 3.8.18
804*60517a1eSAndroid Build Coastguard Worker  * 3.9.17  -> 3.9.18
805*60517a1eSAndroid Build Coastguard Worker  * 3.10.12 -> 3.10.13
806*60517a1eSAndroid Build Coastguard Worker  * 3.11.4  -> 3.11.6
807*60517a1eSAndroid Build Coastguard Worker
808*60517a1eSAndroid Build Coastguard Worker* (deps) Upgrade rules_go 0.39.1 -> 0.41.0; this is so gazelle integration works with upcoming Bazel versions
809*60517a1eSAndroid Build Coastguard Worker
810*60517a1eSAndroid Build Coastguard Worker* (multi-version) The `distribs` attribute is no longer propagated. This
811*60517a1eSAndroid Build Coastguard Worker  attribute has been long deprecated by Bazel and shouldn't be used.
812*60517a1eSAndroid Build Coastguard Worker
813*60517a1eSAndroid Build Coastguard Worker* Calling `//python:repositories.bzl#py_repositories()` is required. It has
814*60517a1eSAndroid Build Coastguard Worker  always been documented as necessary, but it was possible to omit it in certain
815*60517a1eSAndroid Build Coastguard Worker  cases. An error about `@rules_python_internal` means the `py_repositories()`
816*60517a1eSAndroid Build Coastguard Worker  call is missing in `WORKSPACE`.
817*60517a1eSAndroid Build Coastguard Worker
818*60517a1eSAndroid Build Coastguard Worker* (bzlmod) The `pip.parse` extension will generate os/arch specific lock
819*60517a1eSAndroid Build Coastguard Worker  file entries on `bazel>=6.4`.
820*60517a1eSAndroid Build Coastguard Worker
821*60517a1eSAndroid Build Coastguard Worker
822*60517a1eSAndroid Build Coastguard Worker### Added
823*60517a1eSAndroid Build Coastguard Worker
824*60517a1eSAndroid Build Coastguard Worker* (bzlmod, entry_point) Added {obj}`py_console_script_binary`, which
825*60517a1eSAndroid Build Coastguard Worker  allows adding custom dependencies to a package's entry points and customizing
826*60517a1eSAndroid Build Coastguard Worker  the `py_binary` rule used to build it.
827*60517a1eSAndroid Build Coastguard Worker
828*60517a1eSAndroid Build Coastguard Worker* New Python versions available: `3.8.17`, `3.11.5` using
829*60517a1eSAndroid Build Coastguard Worker  https://github.com/indygreg/python-build-standalone/releases/tag/20230826.
830*60517a1eSAndroid Build Coastguard Worker
831*60517a1eSAndroid Build Coastguard Worker* (gazelle) New `# gazelle:python_generation_mode file` directive to support
832*60517a1eSAndroid Build Coastguard Worker  generating one `py_library` per file.
833*60517a1eSAndroid Build Coastguard Worker
834*60517a1eSAndroid Build Coastguard Worker* (python_repository) Support `netrc` and `auth_patterns` attributes to enable
835*60517a1eSAndroid Build Coastguard Worker  authentication against private HTTP hosts serving Python toolchain binaries.
836*60517a1eSAndroid Build Coastguard Worker
837*60517a1eSAndroid Build Coastguard Worker* `//python:packaging_bzl` added, a `bzl_library` for the Starlark
838*60517a1eSAndroid Build Coastguard Worker  files `//python:packaging.bzl` requires.
839*60517a1eSAndroid Build Coastguard Worker* (py_wheel) Added the `incompatible_normalize_name` feature flag to
840*60517a1eSAndroid Build Coastguard Worker  normalize the package distribution name according to latest Python
841*60517a1eSAndroid Build Coastguard Worker  packaging standards. Defaults to `False` for the time being.
842*60517a1eSAndroid Build Coastguard Worker* (py_wheel) Added the `incompatible_normalize_version` feature flag
843*60517a1eSAndroid Build Coastguard Worker  to normalize the package version according to PEP440 standard. This
844*60517a1eSAndroid Build Coastguard Worker  also adds support for local version specifiers (versions with a `+`
845*60517a1eSAndroid Build Coastguard Worker  in them), in accordance with PEP440. Defaults to `False` for the
846*60517a1eSAndroid Build Coastguard Worker  time being.
847*60517a1eSAndroid Build Coastguard Worker
848*60517a1eSAndroid Build Coastguard Worker* New Python versions available: `3.8.18`, `3.9.18`, `3.10.13`, `3.11.6`, `3.12.0` using
849*60517a1eSAndroid Build Coastguard Worker  https://github.com/indygreg/python-build-standalone/releases/tag/20231002.
850*60517a1eSAndroid Build Coastguard Worker  `3.12.0` support is considered beta and may have issues.
851*60517a1eSAndroid Build Coastguard Worker
852*60517a1eSAndroid Build Coastguard Worker### Removed
853*60517a1eSAndroid Build Coastguard Worker
854*60517a1eSAndroid Build Coastguard Worker* (bzlmod) The `entry_point` macro is no longer supported and has been removed
855*60517a1eSAndroid Build Coastguard Worker  in favour of the `py_console_script_binary` macro for `bzlmod` users.
856*60517a1eSAndroid Build Coastguard Worker
857*60517a1eSAndroid Build Coastguard Worker* (bzlmod) The `pip.parse` no longer generates `{hub_name}_{py_version}` hub repos
858*60517a1eSAndroid Build Coastguard Worker  as the `entry_point` macro has been superseded by `py_console_script_binary`.
859*60517a1eSAndroid Build Coastguard Worker
860*60517a1eSAndroid Build Coastguard Worker* (bzlmod) The `pip.parse` no longer generates `{hub_name}_{distribution}` hub repos.
861*60517a1eSAndroid Build Coastguard Worker
862*60517a1eSAndroid Build Coastguard Worker### Fixed
863*60517a1eSAndroid Build Coastguard Worker
864*60517a1eSAndroid Build Coastguard Worker* (whl_library) No longer restarts repository rule when fetching external
865*60517a1eSAndroid Build Coastguard Worker  dependencies improving initial build times involving external dependency
866*60517a1eSAndroid Build Coastguard Worker  fetching.
867*60517a1eSAndroid Build Coastguard Worker
868*60517a1eSAndroid Build Coastguard Worker* (gazelle) Improve runfiles lookup hermeticity.
869*60517a1eSAndroid Build Coastguard Worker
870*60517a1eSAndroid Build Coastguard Worker[0.26.0]: https://github.com/bazelbuild/rules_python/releases/tag/0.26.0
871*60517a1eSAndroid Build Coastguard Worker
872*60517a1eSAndroid Build Coastguard Worker## [0.25.0] - 2023-08-22
873*60517a1eSAndroid Build Coastguard Worker
874*60517a1eSAndroid Build Coastguard Worker### Changed
875*60517a1eSAndroid Build Coastguard Worker
876*60517a1eSAndroid Build Coastguard Worker* Python version patch level bumps:
877*60517a1eSAndroid Build Coastguard Worker  * 3.9.16 -> 3.9.17
878*60517a1eSAndroid Build Coastguard Worker  * 3.10.9 -> 3.10.12
879*60517a1eSAndroid Build Coastguard Worker  * 3.11.1 -> 3.11.4
880*60517a1eSAndroid Build Coastguard Worker* (bzlmod) `pip.parse` can no longer automatically use the default
881*60517a1eSAndroid Build Coastguard Worker  Python version; this was an unreliable and unsafe behavior. The
882*60517a1eSAndroid Build Coastguard Worker  `python_version` arg must always be explicitly specified.
883*60517a1eSAndroid Build Coastguard Worker
884*60517a1eSAndroid Build Coastguard Worker### Fixed
885*60517a1eSAndroid Build Coastguard Worker
886*60517a1eSAndroid Build Coastguard Worker* (docs) Update docs to use correct bzlmod APIs and clarify how and when to use
887*60517a1eSAndroid Build Coastguard Worker  various APIs.
888*60517a1eSAndroid Build Coastguard Worker* (multi-version) The `main` arg is now correctly computed and usually optional.
889*60517a1eSAndroid Build Coastguard Worker* (bzlmod) `pip.parse` no longer requires a call for whatever the configured
890*60517a1eSAndroid Build Coastguard Worker  default Python version is.
891*60517a1eSAndroid Build Coastguard Worker
892*60517a1eSAndroid Build Coastguard Worker### Added
893*60517a1eSAndroid Build Coastguard Worker
894*60517a1eSAndroid Build Coastguard Worker* Created a changelog.
895*60517a1eSAndroid Build Coastguard Worker* (gazelle) Stop generating unnecessary imports.
896*60517a1eSAndroid Build Coastguard Worker* (toolchains) s390x supported for Python 3.9.17, 3.10.12, and 3.11.4.
897*60517a1eSAndroid Build Coastguard Worker
898*60517a1eSAndroid Build Coastguard Worker[0.25.0]: https://github.com/bazelbuild/rules_python/releases/tag/0.25.0
899*60517a1eSAndroid Build Coastguard Worker
900*60517a1eSAndroid Build Coastguard Worker## [0.24.0] - 2023-07-11
901*60517a1eSAndroid Build Coastguard Worker
902*60517a1eSAndroid Build Coastguard Worker### Changed
903*60517a1eSAndroid Build Coastguard Worker
904*60517a1eSAndroid Build Coastguard Worker* **BREAKING** (gazelle) Gazelle 0.30.0 or higher is required
905*60517a1eSAndroid Build Coastguard Worker* (bzlmod) `@python_aliases` renamed to `@python_versions
906*60517a1eSAndroid Build Coastguard Worker* (bzlmod) `pip.parse` arg `name` renamed to `hub_name`
907*60517a1eSAndroid Build Coastguard Worker* (bzlmod) `pip.parse` arg `incompatible_generate_aliases` removed and always
908*60517a1eSAndroid Build Coastguard Worker  true.
909*60517a1eSAndroid Build Coastguard Worker
910*60517a1eSAndroid Build Coastguard Worker### Fixed
911*60517a1eSAndroid Build Coastguard Worker
912*60517a1eSAndroid Build Coastguard Worker* (bzlmod) Fixing Windows Python Interpreter symlink issues
913*60517a1eSAndroid Build Coastguard Worker* (py_wheel) Allow twine tags and args
914*60517a1eSAndroid Build Coastguard Worker* (toolchain, bzlmod) Restrict coverage tool visibility under bzlmod
915*60517a1eSAndroid Build Coastguard Worker* (pip) Ignore temporary pyc.NNN files in wheels
916*60517a1eSAndroid Build Coastguard Worker* (pip) Add format() calls to glob_exclude templates
917*60517a1eSAndroid Build Coastguard Worker* plugin_output in py_proto_library rule
918*60517a1eSAndroid Build Coastguard Worker
919*60517a1eSAndroid Build Coastguard Worker### Added
920*60517a1eSAndroid Build Coastguard Worker
921*60517a1eSAndroid Build Coastguard Worker* Using Gazelle's lifecycle manager to manage external processes
922*60517a1eSAndroid Build Coastguard Worker* (bzlmod) `pip.parse` can be called multiple times with different Python
923*60517a1eSAndroid Build Coastguard Worker  versions
924*60517a1eSAndroid Build Coastguard Worker* (bzlmod) Allow bzlmod `pip.parse` to reference the default python toolchain and interpreter
925*60517a1eSAndroid Build Coastguard Worker* (bzlmod) Implementing wheel annotations via `whl_mods`
926*60517a1eSAndroid Build Coastguard Worker* (gazelle) support multiple requirements files in manifest generation
927*60517a1eSAndroid Build Coastguard Worker* (py_wheel) Support for specifying `Description-Content-Type` and `Summary` in METADATA
928*60517a1eSAndroid Build Coastguard Worker* (py_wheel) Support for specifying `Project-URL`
929*60517a1eSAndroid Build Coastguard Worker* (compile_pip_requirements) Added `generate_hashes` arg (default True) to
930*60517a1eSAndroid Build Coastguard Worker  control generating hashes
931*60517a1eSAndroid Build Coastguard Worker* (pip) Create all_data_requirements alias
932*60517a1eSAndroid Build Coastguard Worker* Expose Python C headers through the toolchain.
933*60517a1eSAndroid Build Coastguard Worker
934*60517a1eSAndroid Build Coastguard Worker[0.24.0]: https://github.com/bazelbuild/rules_python/releases/tag/0.24.0
935