Open paulannetts opened 2 months ago
Most likely fixed by #1929, could you please check the docs and use the newly available feature to see if that is still an issue, please?
Thanks @aignas - it didn't fix things by bumping to the latest commit on rules_python
and then setting the bootstrap_impl=script
in flags/bazelrc.
However I noticed that this only repros on Python 3.9 and 3.10, if you target 3.11 or 3.12 (as per https://github.com/paulannetts/bazel_py_issue_apr24/commit/a8d98ae240a4f0d1c2e7e6a4fc53cc92aeb4ee64) then the relative paths resolve correctly.
Looks like this could be due to https://docs.python.org/dev/using/cmdline.html#cmdoption-P which is new in 3.11, which I wasn't aware of until now.
🐞 bug report
I'm seeing an unexpected testing failure when I import
google-cloud-storage
via pip, where there is also a subfolder calledgrpc
local to thepy_library
under test.It feels like a bug in how
py_library
resolves, certainly running the test withpython -m unittest [module]
works in the self-contained repro linked below.Affected Rule
py_library
seems to be most likely rule.Is this a regression?
Uncertain, going back a few versions of rules_python hit the same issue.
Description
The key parts is as follows:
utils/BUILD.bazel:
The local
utils/grpc
subfolder just contains another trivialpy_library
that has a function that prints to stdout.🔬 Minimal Reproduction
See https://github.com/paulannetts/bazel_py_issue_apr24
🔥 Exception or Error
Truncated error of
bazel test //utils:lib_test
(full error log available which jumps via the various pip dependencies ofgoogle_cloud_storage
)🌍 Your Environment
Operating System: MacOS Sonoma
Output of
bazel version
:Rules_python version:
rules_python 0.31.0
Other info: Using bzlmod
gazelle 0.35
python 3.9