Skip to content
Open
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
4 changes: 4 additions & 0 deletions .github/bazel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,20 @@ set -eux
export MSYS_NO_PATHCONV='1'
export MSYS2_ARG_CONV_EXCL='*'

LIMITED_API="${PY_LIMITED_API:-unset}"

for compilation_mode in dbg opt
do
bazel clean
bazel build \
--extra_toolchains=//python/toolchains:all \
--@nanobind_bazel//:py-limited-api="${LIMITED_API}" \
--compilation_mode=${compilation_mode} -- \
//:re2 \
//python:re2
bazel test \
--extra_toolchains=//python/toolchains:all \
--@nanobind_bazel//:py-limited-api="${LIMITED_API}" \
--compilation_mode=${compilation_mode} -- \
//:small_tests \
//python:all
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/ci-bazel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,17 @@ jobs:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
# Keep in sync with python.yml.
ver: ['3.10', '3.11', '3.12', '3.13', '3.14']
ver: ['3.10', '3.11', '3.12', '3.13', '3.14', '3.12-abi3']
env:
PY_LIMITED_API: ${{ matrix.ver == '3.12-abi3' && 'cp312' || '' }}
steps:
- uses: actions/checkout@v4.2.2
- uses: bazel-contrib/setup-bazel@0.15.0
with:
bazelisk-version: '1.x'
- uses: actions/setup-python@v5.6.0
with:
python-version: ${{ matrix.ver }}
python-version: ${{ matrix.ver == '3.12-abi3' && '3.12' || matrix.ver }}
- name: Prepare Python ${{ matrix.ver }} environment
run: |
python -m pip install --upgrade pip
Expand Down
39 changes: 30 additions & 9 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ jobs:
os: [manylinux_2_28]
# Keep in sync with ci-bazel.yml and list below.
# Also, when bumping the minimum version, update ../../python/setup.py.
ver: ['3.10', '3.11', '3.12', '3.13', '3.14']
ver: ['3.10', '3.11', '3.12', '3.13', '3.14', '3.12-abi3']
env:
BAZELISK_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PYTHON: /usr/local/bin/python${{ matrix.ver }}
PYTHON: /usr/local/bin/python${{ matrix.ver == '3.12-abi3' && '3.12' || matrix.ver }}
PY_LIMITED_API: ${{ matrix.ver == '3.12-abi3' && 'cp312' || '' }}
# Bazel fails if the username is unknown.
USER: runner
steps:
Expand All @@ -47,7 +48,7 @@ jobs:
- name: Prepare Python ${{ matrix.ver }} environment
run: |
"${PYTHON}" -m pip install --upgrade pip
"${PYTHON}" -m pip install --upgrade setuptools build wheel auditwheel
"${PYTHON}" -m pip install --upgrade setuptools build wheel auditwheel abi3audit
"${PYTHON}" -m pip install --upgrade absl-py mypy
"${PYTHON}" python/toolchains/generate.py
shell: bash
Expand All @@ -59,6 +60,12 @@ jobs:
"${PYTHON}" -m auditwheel repair --wheel-dir=. dist/*
shell: bash
working-directory: python
- if: matrix.ver == '3.12-abi3'
name: Audit stable ABI compliance
run: |
"${PYTHON}" -m abi3audit --strict google_re2-*.whl
shell: bash
working-directory: python
- name: Test wheel
run: |
"${PYTHON}" -m pip install google_re2-*.whl
Expand Down Expand Up @@ -86,7 +93,7 @@ jobs:
# TODO(rsc): Stop cross-compiling now that we don't use macOS 12.
# instead, specify `-large` suffix on X64 and `-xlarge` suffix on ARM64.
os: [13, 14, 15, 26]
ver: ['3.10', '3.11', '3.12', '3.13', '3.14']
ver: ['3.10', '3.11', '3.12', '3.13', '3.14', '3.12-abi3']
env:
BAZELISK_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BAZEL_CPU: darwin_${{ matrix.arch.bazel-name }}
Expand All @@ -97,6 +104,7 @@ jobs:
# Stop macOS from reporting the system version as 10.x.
# Otherwise, Python refuses to install the built wheel!
SYSTEM_VERSION_COMPAT: 0
PY_LIMITED_API: ${{ matrix.ver == '3.12-abi3' && 'cp312' || '' }}
steps:
- uses: actions/checkout@v4.1.7
# Stash the timestamp for the commit SHA that triggered the workflow.
Expand All @@ -107,11 +115,11 @@ jobs:
bazelisk-version: '1.x'
- uses: actions/setup-python@v5.6.0
with:
python-version: ${{ matrix.ver }}
python-version: ${{ matrix.ver == '3.12-abi3' && '3.12' || matrix.ver }}
- name: Prepare Python ${{ matrix.ver }} environment
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools build wheel delocate
python -m pip install --upgrade setuptools build wheel delocate abi3audit
python -m pip install --upgrade absl-py mypy
python python/toolchains/generate.py
shell: bash
Expand All @@ -123,6 +131,12 @@ jobs:
python -m delocate.cmd.delocate_wheel --wheel-dir=. dist/*
shell: bash
working-directory: python
- if: matrix.ver == '3.12-abi3'
name: Audit stable ABI compliance
run: |
python -m abi3audit --strict google_re2-*.whl
shell: bash
working-directory: python
- if: matrix.arch.name == runner.arch
name: Test wheel
run: |
Expand All @@ -149,7 +163,7 @@ jobs:
- { name: X86, bazel-name: x64_x86, python-name: win32 }
- { name: X64, bazel-name: x64, python-name: win_amd64 }
- { name: ARM64, bazel-name: arm64, python-name: win_arm64 }
ver: ['3.10', '3.11', '3.12', '3.13', '3.14']
ver: ['3.10', '3.11', '3.12', '3.13', '3.14', '3.12-abi3']
exclude:
- arch: { name: ARM64, bazel-name: arm64, python-name: win_arm64 }
ver: '3.9'
Expand All @@ -159,6 +173,7 @@ jobs:
BAZELISK_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BAZEL_CPU: ${{ matrix.arch.bazel-name }}_windows
PLAT_NAME: ${{ matrix.arch.python-name }}
PY_LIMITED_API: ${{ matrix.ver == '3.12-abi3' && 'cp312' || '' }}
steps:
- uses: actions/checkout@v4.2.2
# Stash the timestamp for the commit SHA that triggered the workflow.
Expand All @@ -174,12 +189,12 @@ jobs:
shell: bash
- uses: actions/setup-python@v5.6.0
with:
python-version: ${{ matrix.ver }}
python-version: ${{ matrix.ver == '3.12-abi3' && '3.12' || matrix.ver }}
architecture: ${{ env.architecture }}
- name: Prepare Python ${{ matrix.ver }} environment
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools build wheel delvewheel
python -m pip install --upgrade setuptools build wheel delvewheel abi3audit
python -m pip install --upgrade absl-py mypy
python python/toolchains/generate.py
shell: bash
Expand All @@ -191,6 +206,12 @@ jobs:
python -m delvewheel repair --wheel-dir=. dist/*
shell: bash
working-directory: python
- if: matrix.ver == '3.12-abi3'
name: Audit stable ABI compliance
run: |
python -m abi3audit --strict google_re2-*.whl
shell: bash
working-directory: python
- name: Test wheel
run: |
python -m pip install google_re2-*.whl
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ core
obj/
benchlog.*
user.bazelrc
bazel-*

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was surprised this wasn't here yet. I added as a separate commit 862b674 but happy to remove or extract, I would very easily accidentally commit something massive without it

2 changes: 1 addition & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ bazel_dep(name = "apple_support", version = "1.24.2")
bazel_dep(name = "rules_cc", version = "0.2.14")
bazel_dep(name = "abseil-cpp", version = "20250814.1")
bazel_dep(name = "rules_python", version = "1.7.0")
bazel_dep(name = "pybind11_bazel", version = "3.0.0")
bazel_dep(name = "nanobind_bazel", version = "2.12.0")

# This is a temporary hack for `x64_x86_windows`.
# TODO(junyer): Remove whenever no longer needed.
Expand Down
4 changes: 2 additions & 2 deletions python/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

# Bazel (http://bazel.build/) BUILD file for RE2 Python.

load("@pybind11_bazel//:build_defs.bzl", "pybind_extension")
load("@nanobind_bazel//:build_defs.bzl", "nanobind_extension")
load("@rules_python//python:defs.bzl", "py_library", "py_test")

pybind_extension(
nanobind_extension(
name = "_re2",
srcs = ["_re2.cc"],
deps = [
Expand Down
Loading
Loading