aloof-angle-91616
09/21/2020, 2:50 PMbillowy-motherboard-58443
09/21/2020, 2:50 PMbillowy-motherboard-58443
09/21/2020, 2:51 PMNo module found: 'real-ns'
billowy-motherboard-58443
09/21/2020, 2:51 PMaloof-angle-91616
09/21/2020, 2:53 PM"/"
is the right pattern to add, i think that adding /real-ns
to patterns would make it detect packages so that you would need from bar.common.model.security import xxx
aloof-angle-91616
09/21/2020, 2:54 PMbillowy-motherboard-58443
09/21/2020, 2:54 PM[source]
# The Python source root is the repo root. See <https://www.pantsbuild.org/docs/source-roots>.
root_patterns = ["/"]
aloof-angle-91616
09/21/2020, 2:55 PMaloof-angle-91616
09/21/2020, 2:56 PMbillowy-motherboard-58443
09/21/2020, 2:56 PM["/", "/real-ns"]
I get the E ModuleNotFoundError: No module named 'real-ns'
aloof-angle-91616
09/21/2020, 2:57 PM./pants filedeps real-ns/bar/bar/common/model/security
in order to see if it picks up the desired files as per https://www.pantsbuild.org/docs/project-introspection#filedeps---find-which-files-a-target-ownsbillowy-motherboard-58443
09/21/2020, 2:57 PMbillowy-motherboard-58443
09/21/2020, 2:57 PMaloof-angle-91616
09/21/2020, 2:59 PM__init__.py
files, it looks like you need a separate option (https://www.pantsbuild.org/docs/python-backend):
[python-infer]
inits = true
aloof-angle-91616
09/21/2020, 2:59 PMbillowy-motherboard-58443
09/21/2020, 2:59 PM./pants filedeps ns/bar
=>
ns/bar/BUILD
ns/bar/__init__.py
billowy-motherboard-58443
09/21/2020, 3:00 PMns/bar/common
billowy-motherboard-58443
09/21/2020, 3:00 PMResolveError: "common" was not found in namespace "ns/bar/common". Did you mean one of:
billowy-motherboard-58443
09/21/2020, 3:00 PMaloof-angle-91616
09/21/2020, 3:02 PMns/bar/common
?billowy-motherboard-58443
09/21/2020, 3:02 PM15:02:00 [ERROR] Invalid scope [python-infer] in /src/gh-pants-test/pants.toml
????aloof-angle-91616
09/21/2020, 3:02 PMbillowy-motherboard-58443
09/21/2020, 3:03 PMbillowy-motherboard-58443
09/21/2020, 3:03 PMns/bar
(yet)aloof-angle-91616
09/21/2020, 3:03 PMbillowy-motherboard-58443
09/21/2020, 3:04 PMaloof-angle-91616
09/21/2020, 3:04 PM**/*.py
as the sources
in ns/bar/BUILD
aloof-angle-91616
09/21/2020, 3:05 PMpython_library(
sources=['*.py'],
)
it will only pick up python files in the current directory. to make it see through recursive subdirectories, you would want:
python_library(
sources=['**/*.py'],
)
aloof-angle-91616
09/21/2020, 3:05 PMbillowy-motherboard-58443
09/21/2020, 3:05 PMns/bar/BUILD
?