This is weird and concerning. In the plugin repo, ...
# development
h
This is weird and concerning. In the plugin repo, when adding a new test and trying to run via `./pants test`:
Copy code
pants-plugins/examples/bash/lint/shellcheck/rules_test.py:12: in <module>
    from pants.core.goals.lint import LintResult, LintResults
E   ModuleNotFoundError: No module named 'pants.core'
I can’t reproduce in Toolchain. And the plugin works when running via
./pants lint
. There are no import errors for the production code
a
this is for the same pants release used at toolchain?
h
This is for the example Bash repo. I’ll push in a moment
a
thanks!!
h
Thanks for taking a look! I suspected it’s an issue with
__init__.py
because Pytest handles those weirdly. But, we include those all in the dist. And what’s weird is that the same problematic import works for a Toolchain test, which also runs via the wheel
pantsbuild.pants.testutil
rather than running from sources
h
This feels like a namespace package issue of some kind.
Although I can't think why, there should be only one source of the
pants
package.
h
Note that we don’t actually set
namespace_packages
in the wheel. It gets overridden to be empty accidentally
Oh, hm. We don’t use
__init__.py
in our example plugin repo. That’s probably the issue 😕 Gr, nope. Makes no difference
Yeah I think it is a bad interaction with
pants.pantsbuild.testutil
and
pantsbuild.pants
. If I remove
testutil
, then the transitive imports of
pants.core
are fine Yeah. Toolchain “working” was a red herring. Toolchain fails too if I include an import from
pants.pantsbuild.testutil
Oh. I think I broke this when removing the namespace package declaration with
__init__.py
in Pants in 2.0.0.dev2. 1.30 and 2.0.0.dev1 works fine when running
pex pantsbuild.pants pantsbuild.pants.testutil