-
-
Notifications
You must be signed in to change notification settings - Fork 645
Open
Description
🐞 bug report
Affected Rule
Uhh... py_library I guess?
Is this a regression?
It appears to be, yes. Bisect points to commit b8e32c4 (PR #3242) as the first bad commit. We're trying to bump from rules_python 1.6.1 to 1.7.0.
Description
It looks like the changes to the default system_python bootstrap have caused an issue with how imported modules are found. I suspect that it's due to the change in path ordering.
🔬 Minimal Reproduction
I'll see what I can do about creating a minimal repro. For now, here are the target definitions and whatnot:
py_library(
name = "types",
srcs = ["types.py"],
imports = [".."],
visibility = ["//visibility:public"],
deps = [
"//src/pyle/util:time",
"@pypi//attrs",
"@pypi//numpy",
"@pypi//typedunits",
],
)
pyle_py_test( # just a macro wrapping py_test that injects `pytest` stuff.
name = "types_test",
srcs = ["types_test.py"],
imports = [".."],
deps = [
":conftest",
":types",
"//src/pyle/util:time",
"@pypi//numpy",
"@pypi//pytest",
"@pypi//typedunits",
],
)I suspect that the issue is that our devs like to name modules the same as stdlib modules...
runfiles tree differences
$ # on rules_python commit b8e32c454a1~1
$ tree bazel-bin/src/labrad/types_test.runfiles/ > good.txt
$ # on rules_python commit b8e32c454a1
$ tree bazel-bin/src/labrad/types_test.runfiles/ > bad.txt
$ git diff --no-index good.txt bad.txtExpand to see diff
diff --git a/good.txt b/bad.txt
index 37755674f..52d0e68c0 100644
--- a/good.txt
+++ b/bad.txt
@@ -34,6 +34,17 @@ bazel-bin/src/labrad/types_test.runfiles/
│ │ │ ├── types.py -> /usr/local/google/home/dthor/dev/pyle3/src/labrad/types.py
│ │ │ ├── types_test -> /usr/local/google/home/dthor/.cache/bazel/_bazel_dthor/0f8c52850e7230283fc2f8033149fba2/execroot/_main/bazel-out/k8-fastbuild/bin/src/labrad/types_test
│ │ │ ├── types_test.py -> /usr/local/google/home/dthor/dev/pyle3/src/labrad/types_test.py
+│ │ │ ├── _types_test_stage2_bootstrap.py -> /usr/local/google/home/dthor/.cache/bazel/_bazel_dthor/0f8c52850e7230283fc2f8033149fba2/execroot/_main/bazel-out/k8-fastbuild/bin/src/labrad/_types_test_stage2_bootstrap.py
+│ │ │ ├── _types_test.venv
+│ │ │ │ ├── __init__.py
+│ │ │ │ └── lib
+│ │ │ │ ├── __init__.py
+│ │ │ │ └── python3.13
+│ │ │ │ ├── __init__.py
+│ │ │ │ └── site-packages
+│ │ │ │ ├── bazel.pth -> /usr/local/google/home/dthor/.cache/bazel/_bazel_dthor/0f8c52850e7230283fc2f8033149fba2/execroot/_main/bazel-out/k8-fastbuild/bin/src/labrad/_types_test.venv/lib/python3.13/site-packages/bazel
.pth
+│ │ │ │ ├── _bazel_site_init.py -> /usr/local/google/home/dthor/.cache/bazel/_bazel_dthor/0f8c52850e7230283fc2f8033149fba2/execroot/_main/bazel-out/k8-fastbuild/bin/src/labrad/_types_test.venv/lib/python3.13/site-pack
ages/_bazel_site_init.py
+│ │ │ │ └── __init__.py
│ │ │ └── util
│ │ │ ├── context.py -> /usr/local/google/home/dthor/dev/pyle3/src/labrad/util/context.py
│ │ │ ├── doc_utils.py -> /usr/local/google/home/dthor/dev/pyle3/src/labrad/util/doc_utils.py
@@ -677,6 +688,17 @@ bazel-bin/src/labrad/types_test.runfiles/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── main -> /usr/local/google/home/dthor/.cache/bazel/_bazel_dthor/0f8c52850e7230283fc2f8033149fba2/execroot/_main/bazel-out/k8-fastbuild/bin/src/pyle/quantum_engine/main
│ │ │ │ ├── main.py -> /usr/local/google/home/dthor/dev/pyle3/src/pyle/quantum_engine/main.py
+│ │ │ │ ├── _main_stage2_bootstrap.py -> /usr/local/google/home/dthor/.cache/bazel/_bazel_dthor/0f8c52850e7230283fc2f8033149fba2/execroot/_main/bazel-out/k8-fastbuild/bin/src/pyle/quantum_engine/_main_stage2_bootstrap.py
+│ │ │ │ ├── _main.venv
+│ │ │ │ │ ├── __init__.py
+│ │ │ │ │ └── lib
+│ │ │ │ │ ├── __init__.py
+│ │ │ │ │ └── python3.13
+│ │ │ │ │ ├── __init__.py
+│ │ │ │ │ └── site-packages
+│ │ │ │ │ ├── bazel.pth -> /usr/local/google/home/dthor/.cache/bazel/_bazel_dthor/0f8c52850e7230283fc2f8033149fba2/execroot/_main/bazel-out/k8-fastbuild/bin/src/pyle/quantum_engine/_main.venv/lib/python3.13/site-packages/bazel.pth
+│ │ │ │ │ ├── _bazel_site_init.py -> /usr/local/google/home/dthor/.cache/bazel/_bazel_dthor/0f8c52850e7230283fc2f8033149fba2/execroot/_main/bazel-out/k8-fastbuild/bin/src/pyle/quantum_engine/_main.venv/lib/python3.13/site-packages/_bazel_site_init.py
+│ │ │ │ │ └── __init__.py
│ │ │ │ ├── processor_service.py -> /usr/local/google/home/dthor/dev/pyle3/src/pyle/quantum_engine/processor_service.py
│ │ │ │ ├── processors.py -> /usr/local/google/home/dthor/dev/pyle3/src/pyle/quantum_engine/processors.py
│ │ │ │ ├── programs.py -> /usr/local/google/home/dthor/dev/pyle3/src/pyle/quantum_engine/programs.py
@@ -771,6 +793,17 @@ bazel-bin/src/labrad/types_test.runfiles/
│ │ │ │ │ └── util.py -> /usr/local/google/home/dthor/dev/pyle3/src/pyle/servers/analysis_plot/util.py
│ │ │ │ ├── auth -> /usr/local/google/home/dthor/.cache/bazel/_bazel_dthor/0f8c52850e7230283fc2f8033149fba2/execroot/_main/bazel-out/k8-fastbuild/bin/src/pyle/servers/auth
│ │ │ │ ├── auth.py -> /usr/local/google/home/dthor/dev/pyle3/src/pyle/servers/auth.py
+│ │ │ │ ├── _auth_stage2_bootstrap.py -> /usr/local/google/home/dthor/.cache/bazel/_bazel_dthor/0f8c52850e7230283fc2f8033149fba2/execroot/_main/bazel-out/k8-fastbuild/bin/src/pyle/servers/_auth_stage2_bootstrap.py
+│ │ │ │ ├── _auth.venv
+│ │ │ │ │ ├── __init__.py
+│ │ │ │ │ └── lib
+│ │ │ │ │ ├── __init__.py
+│ │ │ │ │ └── python3.13
+│ │ │ │ │ ├── __init__.py
+│ │ │ │ │ └── site-packages
+│ │ │ │ │ ├── bazel.pth -> /usr/local/google/home/dthor/.cache/bazel/_bazel_dthor/0f8c52850e7230283fc2f8033149fba2/execroot/_main/bazel-out/k8-fastbuild/bin/src/pyle/servers/_auth.venv/lib/python3.13/site-packages/bazel.pth
+│ │ │ │ │ ├── _bazel_site_init.py -> /usr/local/google/home/dthor/.cache/bazel/_bazel_dthor/0f8c52850e7230283fc2f8033149fba2/execroot/_main/bazel-out/k8-fastbuild/bin/src/pyle/servers/_auth.venv/lib/python3.13/site-packages/_bazel_site_init.py
+│ │ │ │ │ └── __init__.py
│ │ │ │ ├── autobot
│ │ │ │ │ ├── __init__.py
│ │ │ │ │ └── v3
@@ -868,7 +901,18 @@ bazel-bin/src/labrad/types_test.runfiles/
│ │ │ │ ├── tunnels.py -> /usr/local/google/home/dthor/dev/pyle3/src/pyle/util/tunnels.py
│ │ │ │ ├── web.py -> /usr/local/google/home/dthor/dev/pyle3/src/pyle/util/web.py
│ │ │ │ ├── zoosay -> /usr/local/google/home/dthor/.cache/bazel/_bazel_dthor/0f8c52850e7230283fc2f8033149fba2/execroot/_main/bazel-out/k8-fastbuild/bin/src/pyle/util/zoosay
-│ │ │ │ └── zoosay.py -> /usr/local/google/home/dthor/dev/pyle3/src/pyle/util/zoosay.py
+│ │ │ │ ├── zoosay.py -> /usr/local/google/home/dthor/dev/pyle3/src/pyle/util/zoosay.py
+│ │ │ │ ├── _zoosay_stage2_bootstrap.py -> /usr/local/google/home/dthor/.cache/bazel/_bazel_dthor/0f8c52850e7230283fc2f8033149fba2/execroot/_main/bazel-out/k8-fastbuild/bin/src/pyle/util/_zoosay_stage2_bootstrap.py
+│ │ │ │ └── _zoosay.venv
+│ │ │ │ ├── __init__.py
+│ │ │ │ └── lib
+│ │ │ │ ├── __init__.py
+│ │ │ │ └── python3.13
+│ │ │ │ ├── __init__.py
+│ │ │ │ └── site-packages
+│ │ │ │ ├── bazel.pth -> /usr/local/google/home/dthor/.cache/bazel/_bazel_dthor/0f8c52850e7230283fc2f8033149fba2/execroot/_main/bazel-out/k8-fastbuild/bin/src/pyle/util/_zoosay.venv/lib/python3.13/site-packages/bazel.pth
+│ │ │ │ ├── _bazel_site_init.py -> /usr/local/google/home/dthor/.cache/bazel/_bazel_dthor/0f8c52850e7230283fc2f8033149fba2/execroot/_main/bazel-out/k8-fastbuild/bin/src/pyle/util/_zoosay.venv/lib/python3.13/site-packages/_bazel_site_init.py
+│ │ │ │ └── __init__.py
│ │ │ ├── version.py -> /usr/local/google/home/dthor/dev/pyle3/src/pyle/version.py
│ │ │ ├── vis
│ │ │ │ ├── color.py -> /usr/local/google/home/dthor/dev/pyle3/src/pyle/vis/color.py
@@ -48081,4 +48125,4 @@ bazel-bin/src/labrad/types_test.runfiles/
├── python3.1 -> /usr/local/google/home/dthor/.cache/bazel/_bazel_dthor/0f8c52850e7230283fc2f8033149fba2/external/rules_python++python+python_3_13_4_x86_64-unknown-linux-gnu/share/man/man1/python3.1
└── python3.13.1 -> /usr/local/google/home/dthor/.cache/bazel/_bazel_dthor/0f8c52850e7230283fc2f8033149fba2/external/rules_python++python+python_3_13_4_x86_64-unknown-linux-gnu/share/man/man1/python3.13.1
-4735 directories, 43347 files
+4751 directories, 43375 files🔥 Exception or Error
$ bazel test //src/labrad:types_test
INFO: Invocation ID: 927d8bbe-37db-4a69-a543-52a84c799013
INFO: Streaming build results to: https://btx.cloud.google.com/invocations/927d8bbe-37db-4a69-a543-52a84c799013
INFO: From BazelWorkspaceStatusAction stable-status.txt:
### Running non-XC Bazel workspace status script "bazel_workspace_status.sh"
## Fetching git tags for pyle_version
## Looking for tag matching pattern
### Completed non-XC Bazel workspace status script "bazel_workspace_status.sh"
INFO: Analyzed target //src/labrad:types_test (89 packages loaded, 1779 targets configured).
INFO: Found 1 test target...
Target //src/labrad:types_test up-to-date:
bazel-bin/src/labrad/types_test
INFO: Elapsed time: 22.112s, Critical Path: 2.10s
INFO: 1 process: 281 action cache hit, 1 internal.
INFO: Build completed, 1 test FAILED, 1 total action
FAILED: //src/labrad:types_test (see /usr/local/google/home/dthor/.cache/bazel/_bazel_dthor/0f8c52850e7230283fc2f8033149fba2/execroot/_main/bazel-out/k8-fastbuild/testlogs/src/labrad/types_test/test.log)
INFO: From Testing //src/labrad:types_test
==================== Test output for //src/labrad:types_test:
Traceback (most recent call last):
File "/b/f/w/bazel-out/k8-fastbuild/bin/src/labrad/types_test.runfiles/_main/src/labrad/types_test", line 11, in <module>
import subprocess
File "/usr/lib/python3.12/subprocess.py", line 46, in <module>
import locale
File "/usr/lib/python3.12/locale.py", line 16, in <module>
import re
File "/usr/lib/python3.12/re/__init__.py", line 124, in <module>
import enum
File "/usr/lib/python3.12/enum.py", line 3, in <module>
from types import MappingProxyType, DynamicClassAttribute
File "/b/f/w/bazel-out/k8-fastbuild/bin/src/labrad/types_test.runfiles/_main/src/labrad/types.py", line 30, in <module>
import functools
File "/usr/lib/python3.12/functools.py", line 22, in <module>
from types import GenericAlias
ImportError: cannot import name 'GenericAlias' from partially initialized module 'types' (most likely due to a circular import) (/b/f/w/bazel-out/k8-fastbuild/bin/src/labrad/types_test.runfiles/_main/src/labrad/types.py)
================================================================================
//src/labrad:types_test (cached) FAILED in 8.9s
/usr/local/google/home/dthor/.cache/bazel/_bazel_dthor/0f8c52850e7230283fc2f8033149fba2/execroot/_main/bazel-out/k8-fastbuild/testlogs/src/labrad/types_test/test.log
Executed 0 out of 1 test: 1 fails remotely.
INFO: Streaming build results to: https://btx.cloud.google.com/invocations/927d8bbe-37db-4a69-a543-52a84c799013
🌍 Your Environment
Operating System:
gLinux (Debian Testing)
Output of bazel version:
$ bazel version
Bazelisk version: v1.26.0
Build label: 8.3.1
Build target: @@//src/main/java/com/google/devtools/build/lib/bazel:BazelServer
Build time: Mon Jun 30 16:23:40 2025 (1751300620)
Build timestamp: 1751300620
Build timestamp as int: 1751300620
Rules_python version:
1.7.0
Anything else relevant?
Metadata
Metadata
Assignees
Labels
No labels