elegant-eve-2254
11/12/2023, 4:06 AM.
├── auth
│ ├── __init__.py
│ └── flask_auth.py
└── events_service
├── __init__.py
└── app.py
The error is:
Pants cannot infer owners for the following imports in the target event_service/app.py:
* auth.token_auth (line: 4)
This package from auth/__init__.py
:
from .flask_auth import token_auth
It looks like packages defined in ``__init__.py`` files is not detected.broad-processor-92400
11/12/2023, 4:08 AMpants.toml
?elegant-eve-2254
11/12/2023, 4:11 AM> pants roots
auth
event_service
./pants.toml
[source]
root_patterns = [
"/auth",
"/event_service",
]
elegant-eve-2254
11/12/2023, 4:14 AMfrom auth import token_auth
to
from auth.flask_auth import token
elegant-eve-2254
11/12/2023, 4:15 AMpants dependencies event_service/app.py
succeeded.
Reverting my app.py change leaves it in a working state.elegant-eve-2254
11/12/2023, 4:15 AMbroad-processor-92400
11/12/2023, 4:16 AMimport flask_auth
as referring to flask_auth.py
, because it's an immediate child of a source root.
It looks like it should be from auth import flask_token
, i.e. "auth" is the package name. Thus, I think a root_pattern = ["/"]
might be what you need.elegant-eve-2254
11/12/2023, 4:17 AMelegant-eve-2254
11/12/2023, 4:17 AMelegant-eve-2254
11/12/2023, 4:18 AMsource root defines a directory that holds packages, not the packages themselvesGreat explanation