Open Ryang20718 opened 2 months ago
This is aligned to how python itself would work. The best way to structure your project would be to have:
<root>/<name-of-the-project>/time
So that then you can import it as:
from <name-of-the-project> import time
problem is i'm not trying to import from my module, but rather the native time library. @aignas This example works in a native venv and also in our bazel 6.5 & rules_python 0.31 so we're trying to understand what changed in the uprev to 7
I think that the problem might by sys.path
ordering where the standard lib is added last and example/time.py
is overriding that value. What is the location of the MODULE.bazel
file? is it in example
directory? You will have to move it somewhere else as there is no way we can work around this if that is true.
currently we've disabled bzlmod with --noenable_bzlmod
. our MODULE.bazel
file lives in the at the same level as the example dir (root level of the repo)
so it looks like
repo
🐞 bug report
with rules_python 0.31.0 and bazel 7.1.2, there seems to be an issue with naming certain directories with certain names. Wondering if this is expected?
Description
There is a namespace collision with certain directories
🔬 Minimal Reproduction
Build file example/time/BUILD
example/time/__init__.py
example/time/py_test.py
bazel test //example/time:all --noincompatible_default_to_explicit_init_py will result in an import error
🔥 Exception or Error
🌍 Your Environment
Operating System:
ubuntu 20.04
Output of
bazel version
:7.1.2 Rules_python version:
0.31.0