Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/ISSUE_TEMPLATE/patch_release_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
name: "🏗️ Patch release or backport"
about: Request a patch release or backport of a fix to a release.
title: 'Patch release: MAJOR.MINOR.PATCH'
labels: 'type: process'
---

<!--
Thank you for requesting a backport. Before submitting, please read:

* Backport policy: https://rules-python.readthedocs.io/en/latest/support.html#backports-and-patch-releases
-->

**What version of `rules_python` do you want to patch?**


**What pull requests do you want to backport?**

Please provide a list of pull request numbers.

- #
- #
14 changes: 13 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ END_UNRELEASED_TEMPLATE

{#v0-0-0-changed}
### Changed
* (gazelle) update minimum gazelle version to 0.36.0 - may cause BUILD file changes
* (gazelle) update minimum rules_go version to 0.55.1
* (gazelle) remove custom go-tree-sitter module BUILD file
* (gazelle) For package mode, resolve dependencies when imports are relative
to the package path. This is enabled via the
`# gazelle:python_experimental_allow_relative_imports` true directive ({gh-issue}`2203`).
Expand All @@ -69,6 +72,10 @@ END_UNRELEASED_TEMPLATE
* (toolchain) Python 3.13 now references 3.13.6
* (gazelle) Switched back to smacker/go-tree-sitter, fixing
[#2630](https://github.com/bazel-contrib/rules_python/issues/2630)
* (pypi) From now on the list of default platforms only includes `linux_x86_64`, `linux_aarch64`,
`osx_x86_64`, `osx_aarch64` and `windows_x86_64`. If you are on other platforms, you need to
use the `pip.default` to configure it yourself. If you are interested in graduating the
platform, consider helping set us up CI for them and update the documentation.
* (ci) We are now testing on Ubuntu 22.04 for RBE and non-RBE configurations.
* (core) `#!/usr/bin/env bash` is now used as a shebang in the stage1 bootstrap template.
* (gazelle:docs) The Gazelle docs have been migrated from {gh-path}`gazelle/README.md` to
Expand All @@ -90,6 +97,10 @@ END_UNRELEASED_TEMPLATE
([#2503](https://github.com/bazel-contrib/rules_python/issues/2503)).
* (pypi) The pipstar `defaults` configuration now supports any custom platform
name.
* (pypi) The selection of the whls has been changed and should no longer result
in ambiguous select matches ({gh-issue}`2759`) and should be much more efficient
when running `bazel query` due to fewer repositories being included
({gh-issue}`2849`).
* Multi-line python imports (e.g. with escaped newlines) are now correctly processed by Gazelle.
* (toolchains) `local_runtime_repo` works with multiarch Debian with Python 3.8
([#3099](https://github.com/bazel-contrib/rules_python/issues/3099)).
Expand Down Expand Up @@ -120,7 +131,8 @@ END_UNRELEASED_TEMPLATE
([#3114](https://github.com/bazel-contrib/rules_python/pull/3114)).
* (pypi) To configure the environment for `requirements.txt` evaluation, use the newly added
developer preview of the `pip.default` tag class. Only `rules_python` and root modules can use
this feature. You can also configure custom `config_settings` using `pip.default`.
this feature. You can also configure custom `config_settings` using `pip.default`. It
can also be used to set the global `netrc` or `auth_patterns` variables.
* (pypi) PyPI dependencies now expose an `:extracted_whl_files` filegroup target
of all the files extracted from the wheel. This can be used in lieu of
{obj}`whl_filegroup` to avoid copying/extracting wheel multiple times to
Expand Down
69 changes: 49 additions & 20 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,18 @@ pip = use_extension("//python/extensions:pip.bzl", "pip")
env = {"platform_version": "0"},
os_name = "linux",
platform = "linux_{}".format(cpu),
whl_abi_tags = [
"abi3",
"cp{major}{minor}",
],
whl_platform_tags = [
"linux_{}".format(cpu),
"manylinux_*_{}".format(cpu),
],
)
for cpu in [
"x86_64",
"aarch64",
# TODO @aignas 2025-05-19: only leave tier 0-1 cpus when stabilizing the
# `pip.default` extension. i.e. drop the below values - users will have to
# define themselves if they need them.
"arm",
"ppc",
"s390x",
]
]

Expand All @@ -99,26 +101,53 @@ pip = use_extension("//python/extensions:pip.bzl", "pip")
env = {"platform_version": "14.0"},
os_name = "osx",
platform = "osx_{}".format(cpu),
whl_abi_tags = [
"abi3",
"cp{major}{minor}",
],
whl_platform_tags = [
"macosx_*_{}".format(suffix)
for suffix in platform_tag_cpus
],
)
for cpu in [
"aarch64",
"x86_64",
]
for cpu, platform_tag_cpus in {
"aarch64": [
"universal2",
"arm64",
],
"x86_64": [
"universal2",
"x86_64",
],
}.items()
]

[
pip.default(
arch_name = cpu,
config_settings = [
"@platforms//cpu:{}".format(cpu),
"@platforms//os:windows",
],
env = {"platform_version": "0"},
os_name = "windows",
platform = "windows_{}".format(cpu),
whl_abi_tags = [
"abi3",
"cp{major}{minor}",
],
whl_platform_tags = whl_platform_tags,
)
for cpu, whl_platform_tags in {
"x86_64": ["win_amd64"],
}.items()
]

pip.default(
arch_name = "x86_64",
config_settings = [
"@platforms//cpu:x86_64",
"@platforms//os:windows",
],
env = {"platform_version": "0"},
os_name = "windows",
platform = "windows_x86_64",
)
pip.parse(
# NOTE @aignas 2024-10-26: We have an integration test that depends on us
# being able to build sdists for this hub, so explicitly set this to False.
#
# how do we test sdists? Maybe just worth adding a single sdist somewhere?
download_only = False,
experimental_index_url = "https://pypi.org/simple",
hub_name = "rules_python_publish_deps",
Expand Down
32 changes: 32 additions & 0 deletions docs/devguide.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,35 @@ to have everything self-documented, we have a special target,
`//private:requirements.update`, which uses `rules_multirun` to run all
of the requirement-updating scripts in sequence in one go. This can be done once per release as
we prepare for releases.

## Creating Backport PRs

The steps to create a backport PR are:

1. Create an issue for the patch release; use the [patch relase
template][patch-release-issue].
2. Create a fork of `rules_python`.
3. Checkout the `release/X.Y` branch.
4. Use `git cherry-pick -x` to cherry pick the desired fixes.
5. Update the release's `CHANGELOG.md` file:
* Add a Major.Minor.Patch section if one doesn't exist
* Copy the changelog text from `main` to the release's changelog.
6. Send a PR with the backport's changes.
* The title should be `backport: PR#N to Major.Minor`
* The body must preserve the original PR's number, commit hash, description,
and authorship.
Use the following format (`git cherry-pick` will use this format):
```
<original PR title>

<original PR body>
(cherry picked from commit <commit hash>)
-----
Co-authored-by: <original PR author; separate lines for each>
```
* If the PR contains multiple backport commits, separate each's description
with `-----`.
7. Send a PR to update the `main` branch's `CHANGELOG.md` to reflect the
changes done in the patched release.

[patch-release-issue]: https://github.com/bazelbuild/rules_python/issues/new?template=patch_release.md
16 changes: 16 additions & 0 deletions docs/support.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,22 @@ the willingness of volunteers.
If you want or need particular functionality backported, then the best way
is to open a PR to demonstrate the feasibility of the backport.

### Backports and Patch Releases

Backports and patch releases are provided on a best-effort basis. Only fixes are
backported. Features are not backported.

Backports can be done to older releases, but only if newer releases also have
the fix backported. For example, if the current release is 1.5, in order to
patch 1.4, version 1.5 must be patched first.

Backports can be requested by [creating an issue with the patch release
template][patch-release-issue] or by sending a pull request performing the backport.
See the dev guide for [how to create a backport PR][backport-pr].

[patch-release-issue]: https://github.com/bazelbuild/rules_python/issues/new?template=patch_release_request.md
[backport-pr]: devguide.html#creating-backport-prs

## Supported Bazel Versions

The supported Bazel versions are:
Expand Down
14 changes: 7 additions & 7 deletions examples/build_file_generation/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,20 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "io_bazel_rules_go",
sha256 = "278b7ff5a826f3dc10f04feaf0b70d48b68748ccd512d7f98bf442077f043fe3",
sha256 = "9d72f7b8904128afb98d46bbef82ad7223ec9ff3718d419afb355fddd9f9484a",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.41.0/rules_go-v0.41.0.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.41.0/rules_go-v0.41.0.zip",
"https://mirror.bazel.build/github.com/bazel-contrib/rules_go/releases/download/v0.55.1/rules_go-v0.55.1.zip",
"https://github.com/bazel-contrib/rules_go/releases/download/v0.55.1/rules_go-v0.55.1.zip",
],
)

# Download the bazel_gazelle ruleset.
http_archive(
name = "bazel_gazelle",
sha256 = "d3fa66a39028e97d76f9e2db8f1b0c11c099e8e01bf363a923074784e451f809",
sha256 = "75df288c4b31c81eb50f51e2e14f4763cb7548daae126817247064637fd9ea62",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.33.0/bazel-gazelle-v0.33.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.33.0/bazel-gazelle-v0.33.0.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.36.0/bazel-gazelle-v0.36.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.36.0/bazel-gazelle-v0.36.0.tar.gz",
],
)

Expand All @@ -49,7 +49,7 @@ go_rules_dependencies()
# go_rules_dependencies is a function that registers external dependencies
# needed by the Go rules.
# See: https://github.com/bazelbuild/rules_go/blob/master/go/dependencies.rst#go_rules_dependencies
go_register_toolchains(version = "1.19.4")
go_register_toolchains(version = "1.21.13")

# The following call configured the gazelle dependencies, Go environment and Go SDK.
gazelle_dependencies()
Expand Down
17 changes: 17 additions & 0 deletions examples/bzlmod/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,23 @@ pip.whl_mods(
)
use_repo(pip, "whl_mods_hub")

# Because below we are using `windows_aarch64` platform, we have to define various
# properties for it.
pip.default(
arch_name = "aarch64",
config_settings = [
"@platforms//os:windows",
"@platforms//cpu:aarch64",
],
env = {
"platform_version": "0",
},
os_name = "windows",
platform = "windows_aarch64",
whl_abi_tags = [], # default to all ABIs
whl_platform_tags = ["win_amd64"],
)

# To fetch pip dependencies, use pip.parse. We can pass in various options,
# but typically we pass requirements and the Python version. The Python
# version must have been configured by a corresponding `python.toolchain()`
Expand Down
2 changes: 1 addition & 1 deletion examples/bzlmod_build_file_generation/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ local_path_override(
# The following stanza defines the dependency for gazelle
# See here https://github.com/bazelbuild/bazel-gazelle/releases/ for the
# latest version.
bazel_dep(name = "gazelle", version = "0.30.0", repo_name = "bazel_gazelle")
bazel_dep(name = "gazelle", version = "0.36.0", repo_name = "bazel_gazelle")

# The following stanze returns a proxy object representing a module extension;
# its methods can be invoked to create module extension tags.
Expand Down
15 changes: 3 additions & 12 deletions gazelle/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ module(

bazel_dep(name = "bazel_skylib", version = "1.6.1")
bazel_dep(name = "rules_python", version = "0.18.0")
bazel_dep(name = "rules_go", version = "0.41.0", repo_name = "io_bazel_rules_go")
bazel_dep(name = "gazelle", version = "0.33.0", repo_name = "bazel_gazelle")
bazel_dep(name = "rules_go", version = "0.55.1", repo_name = "io_bazel_rules_go")
bazel_dep(name = "gazelle", version = "0.36.0", repo_name = "bazel_gazelle")
bazel_dep(name = "rules_cc", version = "0.0.16")

local_path_override(
Expand All @@ -23,21 +23,12 @@ use_repo(
"com_github_bmatcuk_doublestar_v4",
"com_github_emirpasic_gods",
"com_github_ghodss_yaml",
"com_github_smacker_go_tree_sitter",
"com_github_stretchr_testify",
"in_gopkg_yaml_v2",
"org_golang_x_sync",
)

http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "com_github_smacker_go_tree_sitter",
build_file = "//:internal/smacker_BUILD.bazel",
integrity = "sha256-4AkDY4Rh5Auu9Kwzhj5XYSirMLlhmd6ClMWo/r0kmu4=",
strip_prefix = "go-tree-sitter-dd81d9e9be82a8cac96ed1d50c7389c5f1997c02",
url = "https://github.com/smacker/go-tree-sitter/archive/dd81d9e9be82a8cac96ed1d50c7389c5f1997c02.zip",
)

python_stdlib_list = use_extension("//python:extensions.bzl", "python_stdlib_list")
use_repo(
python_stdlib_list,
Expand Down
14 changes: 7 additions & 7 deletions gazelle/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "io_bazel_rules_go",
sha256 = "278b7ff5a826f3dc10f04feaf0b70d48b68748ccd512d7f98bf442077f043fe3",
sha256 = "9d72f7b8904128afb98d46bbef82ad7223ec9ff3718d419afb355fddd9f9484a",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.41.0/rules_go-v0.41.0.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.41.0/rules_go-v0.41.0.zip",
"https://mirror.bazel.build/github.com/bazel-contrib/rules_go/releases/download/v0.55.1/rules_go-v0.55.1.zip",
"https://github.com/bazel-contrib/rules_go/releases/download/v0.55.1/rules_go-v0.55.1.zip",
],
)

http_archive(
name = "bazel_gazelle",
sha256 = "29d5dafc2a5582995488c6735115d1d366fcd6a0fc2e2a153f02988706349825",
sha256 = "75df288c4b31c81eb50f51e2e14f4763cb7548daae126817247064637fd9ea62",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.31.0/bazel-gazelle-v0.31.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.31.0/bazel-gazelle-v0.31.0.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.36.0/bazel-gazelle-v0.36.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.36.0/bazel-gazelle-v0.36.0.tar.gz",
],
)

Expand All @@ -25,7 +25,7 @@ load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_depe

go_rules_dependencies()

go_register_toolchains(version = "1.19.4")
go_register_toolchains(version = "1.21.13")

gazelle_dependencies()

Expand Down
Loading