Skip to content

Commit 76c703d

Browse files
committed
Merge branch 'main' into u/dthor/gazelle-pyi_srcs-gh3354
2 parents 027a83d + 39bd4d8 commit 76c703d

Some content is hidden

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

67 files changed

+609
-221
lines changed

.bazelci/presubmit.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -329,41 +329,41 @@ tasks:
329329
<<: *minimum_supported_version
330330
<<: *reusable_build_test_all
331331
<<: *coverage_targets_example_bzlmod_build_file_generation
332-
name: "examples/bzlmod_build_file_generation: Ubuntu, minimum Bazel"
333-
working_directory: examples/bzlmod_build_file_generation
332+
name: "gazelle/examples/bzlmod_build_file_generation: Ubuntu, minimum Bazel"
333+
working_directory: gazelle/examples/bzlmod_build_file_generation
334334
platform: ubuntu2204
335335
bazel: 7.x
336336
integration_test_bzlmod_generation_build_files_ubuntu:
337337
<<: *reusable_build_test_all
338338
<<: *coverage_targets_example_bzlmod_build_file_generation
339-
name: "examples/bzlmod_build_file_generation: Ubuntu"
340-
working_directory: examples/bzlmod_build_file_generation
339+
name: "gazelle/examples/bzlmod_build_file_generation: Ubuntu"
340+
working_directory: gazelle/examples/bzlmod_build_file_generation
341341
platform: ubuntu2204
342342
integration_test_bzlmod_generation_build_files_ubuntu_run:
343343
<<: *reusable_build_test_all
344-
name: "examples/bzlmod_build_file_generation: Ubuntu, Gazelle and pip"
345-
working_directory: examples/bzlmod_build_file_generation
344+
name: "gazelle/examples/bzlmod_build_file_generation: Ubuntu, Gazelle and pip"
345+
working_directory: gazelle/examples/bzlmod_build_file_generation
346346
platform: ubuntu2204
347347
shell_commands:
348348
- "bazel run //:gazelle_python_manifest.update"
349349
- "bazel run //:gazelle -- update"
350350
integration_test_bzlmod_build_file_generation_debian:
351351
<<: *reusable_build_test_all
352352
<<: *coverage_targets_example_bzlmod_build_file_generation
353-
name: "examples/bzlmod_build_file_generation: Debian"
354-
working_directory: examples/bzlmod_build_file_generation
353+
name: "gazelle/examples/bzlmod_build_file_generation: Debian"
354+
working_directory: gazelle/examples/bzlmod_build_file_generation
355355
platform: debian11
356356
integration_test_bzlmod_build_file_generation_macos:
357357
<<: *reusable_build_test_all
358358
<<: *coverage_targets_example_bzlmod_build_file_generation
359-
name: "examples/bzlmod_build_file_generation: MacOS"
360-
working_directory: examples/bzlmod_build_file_generation
359+
name: "gazelle/examples/bzlmod_build_file_generation: MacOS"
360+
working_directory: gazelle/examples/bzlmod_build_file_generation
361361
platform: macos
362362
integration_test_bzlmod_build_file_generation_windows:
363363
<<: *reusable_build_test_all
364364
# coverage is not supported on Windows
365-
name: "examples/bzlmod_build_file_generation: Windows"
366-
working_directory: examples/bzlmod_build_file_generation
365+
name: "gazelle/examples/bzlmod_build_file_generation: Windows"
366+
working_directory: gazelle/examples/bzlmod_build_file_generation
367367
platform: windows
368368

369369
integration_test_multi_python_versions_ubuntu_workspace:

.bazelignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ examples/pip_parse_vendored/bazel-pip_parse_vendored
2626
examples/pip_repository_annotations/bazel-pip_repository_annotations
2727
examples/py_proto_library/bazel-py_proto_library
2828
gazelle/bazel-gazelle
29+
gazelle/examples/bzlmod_build_file_generation/bazel-bin
30+
gazelle/examples/bzlmod_build_file_generation/bazel-bzlmod_build_file_generation
31+
gazelle/examples/bzlmod_build_file_generation/bazel-out
32+
gazelle/examples/bzlmod_build_file_generation/bazel-testlog
2933
tests/integration/compile_pip_requirements/bazel-compile_pip_requirements
3034
tests/integration/ignore_root_user_error/bazel-ignore_root_user_error
3135
tests/integration/local_toolchains/bazel-local_toolchains

.bazelrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,17 @@ query --deleted_packages=examples/build_file_generation,examples/build_file_gene
99

1010
test --test_output=errors
1111

12+
common --deleted_packages=gazelle/examples/bzlmod_build_file_generation
13+
common --deleted_packages=gazelle/examples/bzlmod_build_file_generation/runfiles
14+
1215
# Do NOT implicitly create empty __init__.py files in the runfiles tree.
1316
# By default, these are created in every directory containing Python source code
1417
# or shared libraries, and every parent directory of those directories,
1518
# excluding the repo root directory. With this flag set, we are responsible for
1619
# creating (possibly empty) __init__.py files and adding them to the srcs of
1720
# Python targets as required.
1821
build --incompatible_default_to_explicit_init_py
22+
build --//python/config_settings:incompatible_default_to_explicit_init_py=True
1923

2024
# Ensure ongoing compatibility with this flag.
2125
common --incompatible_disallow_struct_provider_syntax

.bcr/config.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,4 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
fixedReleaser:
16-
login: f0rmiga
17-
1815
moduleRoots: [".", "gazelle"]

.bcr/gazelle/presubmit.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414

1515
bcr_test_module:
16-
module_path: "../examples/bzlmod_build_file_generation"
16+
module_path: "examples/bzlmod_build_file_generation"
1717
matrix:
1818
platform: ["debian11", "macos", "ubuntu2004", "windows"]
1919
# last_rc is to get latest 8.x release. Replace with 8.x when available.
@@ -23,6 +23,8 @@ bcr_test_module:
2323
name: "Run test module"
2424
platform: ${{ platform }}
2525
bazel: ${{ bazel }}
26+
shell_commands:
27+
- "echo 'common --override_module=rules_python=' >> .bazelrc"
2628
build_targets:
2729
- "//..."
2830
- ":modules_map"

.github/workflows/create_archive_and_notes.sh

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,43 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
set -o errexit -o nounset -o pipefail
16+
set -o nounset
17+
set -o pipefail
18+
set -o errexit
19+
20+
set -x
21+
22+
TAG=$1
23+
if [ -z "$TAG" ]; then
24+
echo "ERROR: TAG env var must be set"
25+
exit 1
26+
fi
27+
# If the workflow checks out one commit, but is releasing another
28+
git fetch origin tag "$TAG"
29+
# Update our local state so the grep command below searches what we expect
30+
git checkout "$TAG"
1731

1832
# Exclude dot directories, specifically, this file so that we don't
1933
# find the substring we're looking for in our own file.
2034
# Exclude CONTRIBUTING.md, RELEASING.md because they document how to use these strings.
21-
if grep --exclude=CONTRIBUTING.md --exclude=RELEASING.md --exclude-dir=.* VERSION_NEXT_ -r; then
35+
grep --exclude=CONTRIBUTING.md \
36+
--exclude=RELEASING.md \
37+
--exclude=release.py \
38+
--exclude=release_test.py \
39+
--exclude-dir=.* \
40+
VERSION_NEXT_ -r || grep_exit_code=$?
41+
42+
if [[ $grep_exit_code -eq 0 ]]; then
2243
echo
2344
echo "Found VERSION_NEXT markers indicating version needs to be specified"
2445
exit 1
2546
fi
2647

27-
# Set by GH actions, see
28-
# https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables
29-
TAG=${GITHUB_REF_NAME}
3048
# A prefix is added to better match the GitHub generated archives.
3149
PREFIX="rules_python-${TAG}"
3250
ARCHIVE="rules_python-$TAG.tar.gz"
33-
git archive --format=tar --prefix=${PREFIX}/ ${TAG} | gzip > $ARCHIVE
34-
SHA=$(shasum -a 256 $ARCHIVE | awk '{print $1}')
51+
git archive --format=tar "--prefix=${PREFIX}/" "$TAG" | gzip > "$ARCHIVE"
52+
SHA=$(shasum -a 256 "$ARCHIVE" | awk '{print $1}')
3553

3654
cat > release_notes.txt << EOF
3755

.github/workflows/publish.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Publish new releases to Bazel Central Registry.
2+
name: Publish to BCR
3+
on:
4+
# Run the publish workflow after a successful release
5+
# Will be triggered from the release.yaml workflow
6+
workflow_call:
7+
inputs:
8+
tag_name:
9+
required: true
10+
type: string
11+
secrets:
12+
publish_token:
13+
required: true
14+
# In case of problems, let release engineers retry by manually dispatching
15+
# the workflow from the GitHub UI
16+
workflow_dispatch:
17+
inputs:
18+
tag_name:
19+
description: git tag being released
20+
required: true
21+
type: string
22+
jobs:
23+
publish:
24+
uses: bazel-contrib/publish-to-bcr/.github/workflows/[email protected]
25+
with:
26+
tag_name: ${{ inputs.tag_name }}
27+
# GitHub repository which is a fork of the upstream where the Pull Request will be opened.
28+
registry_fork: bazel-contrib/bazel-central-registry
29+
attest: false
30+
permissions:
31+
contents: write
32+
secrets:
33+
# Necessary to push to the BCR fork, and to open a pull request against a registry
34+
publish_token: ${{ secrets.publish_token || secrets.BCR_PUBLISH_TOKEN }}

.github/workflows/release.yml

Lines changed: 41 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,35 +21,64 @@ on:
2121
- "*.*.*"
2222
workflow_dispatch:
2323
inputs:
24+
tag_name:
25+
description: "release tag: tag that will be released"
26+
required: true
27+
type: string
2428
publish_to_pypi:
2529
description: 'Publish to PyPI'
2630
required: true
2731
type: boolean
2832
default: true
33+
secrets:
34+
publish_token:
35+
required: false
2936

3037
jobs:
31-
build:
38+
release:
39+
name: Release
3240
runs-on: ubuntu-latest
3341
steps:
3442
- name: Checkout
3543
uses: actions/checkout@v5
44+
with:
45+
ref: ${{ github.ref_name }}
3646
- name: Create release archive and notes
37-
run: .github/workflows/create_archive_and_notes.sh
38-
- name: Publish wheel dist
39-
if: github.event_name == 'push' || github.event.inputs.publish_to_pypi
40-
env:
41-
# This special value tells pypi that the user identity is supplied within the token
42-
TWINE_USERNAME: __token__
43-
# Note, the PYPI_API_TOKEN is for the rules-python pypi user, added by @rickylev on
44-
# https://github.com/bazel-contrib/rules_python/settings/secrets/actions
45-
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
46-
run: bazel run --stamp --embed_label=${{ github.ref_name }} //python/runfiles:wheel.publish
47+
run: .github/workflows/create_archive_and_notes.sh ${{ inputs.tag_name || github.ref_name }}
4748
- name: Release
4849
uses: softprops/action-gh-release@v2
4950
with:
5051
# Use GH feature to populate the changelog automatically
5152
generate_release_notes: true
5253
body_path: release_notes.txt
53-
prerelease: ${{ contains(github.ref, '-rc') }}
54+
prerelease: ${{ contains( (inputs.tag_name || github.ref), '-rc') }}
5455
fail_on_unmatched_files: true
5556
files: rules_python-*.tar.gz
57+
tag_name: ${{ inputs.tag_name || github.ref_name }}
58+
59+
publish_bcr:
60+
needs: release
61+
uses: ./.github/workflows/publish.yml
62+
with:
63+
tag_name: ${{ inputs.tag_name || github.ref_name }}
64+
secrets:
65+
publish_token: ${{ secrets.publish_token || secrets.BCR_PUBLISH_TOKEN }}
66+
67+
publish_pypi:
68+
# We just want publish_pypi last, since once uploaded, it can't be changed.
69+
name: Publish runfiles to PyPI
70+
needs: publish_bcr
71+
runs-on: ubuntu-latest
72+
steps:
73+
- name: Checkout
74+
uses: actions/checkout@v5
75+
with:
76+
ref: ${{ github.tag_name || github.ref_name }}
77+
- if: github.event_name == 'push' || github.event.inputs.publish_to_pypi
78+
env:
79+
# This special value tells pypi that the user identity is supplied within the token
80+
TWINE_USERNAME: __token__
81+
# Note, the PYPI_API_TOKEN is for the rules-python pypi user, added by @rickylev on
82+
# https://github.com/bazel-contrib/rules_python/settings/secrets/actions
83+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
84+
run: bazel run --stamp --embed_label=${{ inputs.tag_name || github.ref_name }} //python/runfiles:wheel.publish

CHANGELOG.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ BEGIN_UNRELEASED_TEMPLATE
3838
3939
{#v0-0-0-fixed}
4040
### Fixed
41-
* Nothing fixed.
41+
* (gazelle) Remove {obj}`py_binary` targets with invalid `srcs`. This includes files
42+
that are not generated or regular files.
4243
4344
{#v0-0-0-added}
4445
### Added
@@ -107,10 +108,12 @@ END_UNRELEASED_TEMPLATE
107108
vendoring the `requirements.bzl` file, please re-vendor so that downstream is unaffected
108109
when the APIs get removed. If you need to customize the way the dependencies get
109110
evaluated, see [our docs](/pypi/download.html#customizing-requires-dist-resolution) on customizing `Requires-Dist` resolution.
110-
* (toolchains) Added Python versions 3.14.0, 3.13.8, 3.12.12, 3.11.14, 3.10.19, and 3.9.24
111-
from the [20251010] release.
111+
* (toolchains) Added Python versions 3.15.0a1, 3.14.0, 3.13.9, 3.12.12, 3.11.14, 3.10.19, and 3.9.24
112+
from the [20251014] release.
113+
* (deps) (bzlmod) Upgraded to `bazel-skylib` version
114+
[1.8.2](https://github.com/bazelbuild/bazel-skylib/releases/tag/1.8.2)
112115

113-
[20251010]: https://github.com/astral-sh/python-build-standalone/releases/tag/20251010
116+
[20251014]: https://github.com/astral-sh/python-build-standalone/releases/tag/20251014
114117

115118
{#v1-7-0-fixed}
116119
### Fixed

MODULE.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ module(
55
)
66

77
bazel_dep(name = "bazel_features", version = "1.21.0")
8-
bazel_dep(name = "bazel_skylib", version = "1.8.1")
8+
bazel_dep(name = "bazel_skylib", version = "1.8.2")
99
bazel_dep(name = "rules_cc", version = "0.1.5")
1010
bazel_dep(name = "platforms", version = "0.0.11")
1111

0 commit comments

Comments
 (0)