Skip to content

refactor: use simplified rules_py providers#1231

Draft
jbedard wants to merge 4 commits into
mainfrom
indi-provider
Draft

refactor: use simplified rules_py providers#1231
jbedard wants to merge 4 commits into
mainfrom
indi-provider

Conversation

@jbedard

@jbedard jbedard commented Jul 6, 2026

Copy link
Copy Markdown
Member

Remove the direct usage of the rules_python PyInfo and create our own provider. Merge PyVirtualInfo into PyInfo

Changes are visible to end-users: yes

  • Searched for relevant documentation and updated as needed: yes
  • Breaking change (forces users to change their own code or config): yes
  • Suggested release notes appear below: yes

Outputs of aspect_rules_py may no longer be consumed by rules_python. All public entries into aspect_rules_pi such as deps of any field still support outputs of rules_python (including outputs of protobuf which outputs rules_python specific providers).

Test plan

  • Covered by existing test cases

@jbedard jbedard requested a review from xangcastle July 6, 2026 07:47
@aspect-workflows

aspect-workflows Bot commented Jul 6, 2026

Copy link
Copy Markdown

✨ Aspect Workflows Tasks

📅 Fri Jul 10 19:21:52 UTC 2026

✅ 36 successful tasks

  • ✅ buildifier · ⏱ 20.9s · 🐙 GitHub Actions · ☑️ Check
    💬 Format complete (clean)
  • ✅ gazelle · ⏱ 20.2s · 🐙 GitHub Actions · ☑️ Check
    💬 Gazelle complete (clean)
  • ✅ test-e2e-bazel-8 [test] · ⏱ 3m 17s · 🐙 GitHub Actions · ☑️ Check
    💬 Bazel test complete (195/195 passed)
  • ✅ test-e2e-bazel-9 [test] · ⏱ 5m 16s · 🐙 GitHub Actions · ☑️ Check
    💬 Bazel test complete (189/189 passed)
  • ✅ test-e2e-interpreter-input-validation-bazel-8 [test] · ⏱ 15.5s · 🐙 GitHub Actions · ☑️ Check
    💬 Bazel test complete (1/1 passed)
  • ✅ test-e2e-interpreter-input-validation-bazel-9 [test] · ⏱ 49.3s · 🐙 GitHub Actions · ☑️ Check
    💬 Bazel test complete (1/1 passed)
  • ✅ test-e2e-interpreter-runtime-metadata-bazel-8 [test] · ⏱ 22.5s · 🐙 GitHub Actions · ☑️ Check
    💬 Bazel test complete (2/2 passed · 2 cached)
  • ✅ test-e2e-interpreter-runtime-metadata-bazel-9 [test] · ⏱ 44.2s · 🐙 GitHub Actions · ☑️ Check
    💬 Bazel test complete (2/2 passed)
  • ✅ test-e2e-interpreter-toolchain-settings-bazel-8 [test] · ⏱ 16.1s · 🐙 GitHub Actions · ☑️ Check
    💬 Bazel test complete (1/1 passed)
  • ✅ test-e2e-interpreter-toolchain-settings-bazel-9 [test] · ⏱ 1m 19s · 🐙 GitHub Actions · ☑️ Check
    💬 Bazel test complete (1/1 passed)
  • ✅ test-e2e-rules-proto-grpc-python-bazel-8 [test] · ⏱ 2m 3s · 🐙 GitHub Actions · ☑️ Check
    💬 Bazel test complete (1/1 passed)
  • ✅ test-e2e-rules-proto-grpc-python-bazel-9 [test] · ⏱ 1m 7s · 🐙 GitHub Actions · ☑️ Check
    💬 Bazel test complete (1/1 passed)
  • ✅ test-examples-debugger-bazel-8 [test] · ⏱ 24.2s · 🐙 GitHub Actions · ☑️ Check
    💬 Bazel test complete (1/1 passed)
  • ✅ test-examples-debugger-bazel-9 [test] · ⏱ 40.6s · 🐙 GitHub Actions · ☑️ Check
    💬 Bazel test complete (1/1 passed)
  • ✅ test-examples-dev_deps-bazel-8 [test] · ⏱ 29.5s · 🐙 GitHub Actions · ☑️ Check
    💬 Bazel test complete (1/1 passed)
  • ✅ test-examples-dev_deps-bazel-9 [test] · ⏱ 50.3s · 🐙 GitHub Actions · ☑️ Check
    💬 Bazel test complete (1/1 passed)
  • ✅ test-examples-django-bazel-8 [test] · ⏱ 23.3s · 🐙 GitHub Actions · ☑️ Check
    💬 Bazel test complete (1/1 passed)
  • ✅ test-examples-django-bazel-9 [test] · ⏱ 42.6s · 🐙 GitHub Actions · ☑️ Check
    💬 Bazel test complete (1/1 passed)
  • ✅ test-examples-multi_version-bazel-8 [test] · ⏱ 31.3s · 🐙 GitHub Actions · ☑️ Check
    💬 Bazel test complete (2/2 passed)
  • ✅ test-examples-multi_version-bazel-9 [test] · ⏱ 48.9s · 🐙 GitHub Actions · ☑️ Check
    💬 Bazel test complete (2/2 passed)
  • ✅ test-examples-protobuf-bazel-8 [test] · ⏱ 1m 43s · 🐙 GitHub Actions · ☑️ Check
    💬 Bazel test complete (1/1 passed)
  • ✅ test-examples-protobuf-bazel-9 [test] · ⏱ 2m 45s · 🐙 GitHub Actions · ☑️ Check
    💬 Bazel test complete (1/1 passed)
  • ✅ test-examples-py_binary-bazel-8 [test] · ⏱ 23.1s · 🐙 GitHub Actions · ☑️ Check
    💬 Bazel test complete (1/1 passed)
  • ✅ test-examples-py_binary-bazel-9 [test] · ⏱ 1m 14s · 🐙 GitHub Actions · ☑️ Check
    💬 Bazel test complete (1/1 passed)
  • ✅ test-examples-py_pex_binary-bazel-8 [test] · ⏱ 25.1s · 🐙 GitHub Actions · ☑️ Check
    💬 Bazel test complete (1/1 passed)
  • ✅ test-examples-py_pex_binary-bazel-9 [test] · ⏱ 46.1s · 🐙 GitHub Actions · ☑️ Check
    💬 Bazel test complete (1/1 passed)
  • ✅ test-examples-py_venv-bazel-8 [test] · ⏱ 21.2s · 🐙 GitHub Actions · ☑️ Check
    💬 Bazel test complete (3/3 passed)
  • ✅ test-examples-py_venv-bazel-9 [test] · ⏱ 48s · 🐙 GitHub Actions · ☑️ Check
    💬 Bazel test complete (3/3 passed)
  • ✅ test-examples-pytest-bazel-8 [test] · ⏱ 54.1s · 🐙 GitHub Actions · ☑️ Check
    💬 Bazel test complete (9/9 passed)
  • ✅ test-examples-pytest-bazel-9 [test] · ⏱ 2m 6s · 🐙 GitHub Actions · ☑️ Check
    💬 Bazel test complete (9/9 passed)
  • ✅ test-examples-uv_pip_compile-bazel-8 [test] · ⏱ 22.6s · 🐙 GitHub Actions · ☑️ Check
    💬 Bazel test complete (1/1 passed)
  • ✅ test-examples-uv_pip_compile-bazel-9 [test] · ⏱ 1m 32s · 🐙 GitHub Actions · ☑️ Check
    💬 Bazel test complete (1/1 passed)
  • ✅ test-examples-virtual_deps-bazel-8 [test] · ⏱ 22.2s · 🐙 GitHub Actions · ☑️ Check
    💬 Bazel test complete (1/1 passed)
  • ✅ test-examples-virtual_deps-bazel-9 [test] · ⏱ 43.3s · 🐙 GitHub Actions · ☑️ Check
    💬 Bazel test complete (1/1 passed)
  • ✅ test-root-bazel-8 [test] · ⏱ 2m 28s · 🐙 GitHub Actions · ☑️ Check
    💬 Bazel test complete (235/235 passed)
  • ✅ test-root-bazel-9 [test] · ⏱ 3m 44s · 🐙 GitHub Actions · ☑️ Check
    💬 Bazel test complete (234/234 passed)

⏱ Last updated Fri Jul 10 20:10:31 UTC 2026 · 📊 GitHub API quota 1,339/15,000 (9% used, resets in 2s)
🚀 Powered by Aspect CLI (v2026.28.2)  |  Aspect Build · X · LinkedIn · YouTube

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

py_binary startup benchmark

Version Mean (ms) Median (ms) ± stddev vs BCR vs main Build (s)
BCR 1.11.7 (baseline) 173.324 173.016 ±1.542 31.07
HEAD main 56.133 55.736 ±1.488 -67.6% 10.00
This PR 57.090 56.333 ±3.483 -67.1% +1.7% 6.98

Measured with hyperfine --warmup 5 --runs 50 on Linux
Gate: PR vs HEAD main (threshold: 10%). BCR is shown only as a historical baseline.
Build time: cold bazel build //:bench with isolated output base, no disk cache.

sys.path quality

Version sys.path entries distinct site-packages roots duplicate realpaths
BCR 1.11.7 (baseline) 6 1 0
HEAD main 7 2 0
This PR 7 2 0

sys.path quality measured by bench_syspath inside the assembled venv. Duplicate realpaths indicate symlink redundancy; many distinct site-packages roots suggest an inefficient venv layout.

✅ No regression detected (PR is +1.7% vs HEAD main)

@jbedard jbedard force-pushed the indi-provider branch 3 times, most recently from 6e42120 to 8a3b275 Compare July 8, 2026 20:21
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown

py_binary startup benchmark

Version Mean (ms) Median (ms) ± stddev vs BCR vs main Build (s)
BCR 1.11.7 (baseline) 177.299 176.992 ±1.228 69.10
HEAD main 58.065 58.013 ±0.961 -67.3% 10.85
This PR 59.214 59.230 ±0.783 -66.6% +2.0% 7.69

Measured with hyperfine --warmup 5 --runs 50 on Linux
Gate: PR vs HEAD main (threshold: 10%). BCR is shown only as a historical baseline.
Build time: cold bazel build //:bench with isolated output base, no disk cache.

sys.path quality

Version sys.path entries distinct site-packages roots duplicate realpaths
BCR 1.11.7 (baseline) 6 1 0
HEAD main 7 2 0
This PR 7 2 0

sys.path quality measured by bench_syspath inside the assembled venv. Duplicate realpaths indicate symlink redundancy; many distinct site-packages roots suggest an inefficient venv layout.

Bazel analysis benchmark

Version Mean (ms) Median (ms) ± stddev vs BCR vs main Packages Targets
BCR 2.0.0-alpha.4 (baseline) 10831.563 10826.979 ±137.225 101 301
HEAD main 10004.231 9987.487 ±122.446 -7.6% 101 301
This PR 10063.422 10046.343 ±98.476 -7.1% +0.6% 101 301

Measured with hyperfine --warmup 1 --runs 10 on Linux
Gate: PR vs HEAD main (threshold: 10%). BCR is shown only as a historical baseline.
Command: cold bazel build --nobuild //workspace/... with isolated output base, no disk cache.

Auxiliary metrics

Version Loaded packages Configured targets
BCR 2.0.0-alpha.4 (baseline) 101 301
HEAD main 101 301
This PR 101 301

@jbedard jbedard changed the title WIP: use own providers refactor: use simplified rules_py providers Jul 9, 2026
@jbedard jbedard requested a review from gregmagolan July 9, 2026 23:01
@jbedard jbedard requested a review from dzbarsky July 11, 2026 04:44
@ctcjab

ctcjab commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Drive-by feedback from moving a codebase fully onto python_interpreters (as the rules_python python.toolchain() drop-in), relevant to this detachment work: version selection still requires @rules_python to be visible.

With the direct rules_python dep dropped, setting the interpreter fails, because the flag lives in rules_python:

ERROR: @rules_python//python/config_settings:python_version :: Error loading option
@rules_python//python/config_settings:python_version: No repository visible as
'@rules_python' from main repository

rules_py's own e2e selects the version the same way (--@rules_python//python/config_settings:python_version=…), so there doesn't appear to be a rules_py-native equivalent. Net effect: a consumer that "fully" moves to python_interpreters still has to keep a direct bazel_dep(rules_python) purely to pick a Python version. If the goal is for the detachment to go unnoticed by such consumers, python_interpreters probably wants to re-export (or provide its own) version-selection flag. Not blocking anything for us — just flagging while the surface is in flux.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants