InteliSeness & Debugging does't work with python namespace splitting #6821
Labels
awaiting-maintainer
Awaiting review from Bazel team on issues
product: PyCharm
PyCharm plugin
type: bug
Description of the bug:
Hi all,
The bazel pycharm plugin fails to pickup the correct imports when namespace splitting is used in a python monorepo and where
incompatible_default_to_explicit_init_py
is set. This impacts both debugging and intelisense.Suppose I have two python subpackages occupying the base namespace
my_package.aaa.bbb
and each of these subpackages occupy their own distinct bazel target//lib/packageZ
&//lib/packageY
1) InteliSense Example
In
codeY.py
you will see the following working:but this will fail:
2) pytest Debug Example
Suppose I have a test file called
test_myfunc.py
withinlib/packageY/src/tests/
.Running
//lib/packageY:test
will work. Clicking on the "run icon" on one of test tests intest_myfunc.py
will invoke//lib/packageY:test
and that will also work. Things fail when a debug run is attempted.Running debug within the file will produce the following error:
When
lib/packageY/BUILD
is something like this:Which category does this issue belong to?
PyCharm
What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
See the description above.
Which Intellij IDE are you using? Please provide the specific version.
pycharm 2024.2.3 Profesional Edition
What programming languages and tools are you using? Please provide specific versions.
bazel==7.3.1, rules_python==0.36.0
What Bazel plugin version are you using?
2024.09.10.0.1-api-version-242
Have you found anything relevant by searching the web?
I think these items might be related:
imports
rule attribute onpy...
rules #6599Any other information, logs, or outputs that you want to share?
Toolchain Usage
I saw in an old github issue #4745 that an old version of the plugin struggled with python toolchains. In case it matters, I use a multi_toolchain.
bazelrc config within my repo
The text was updated successfully, but these errors were encountered: