chilly-tailor-75063
01/09/2023, 5:21 PM./pants lint ::
it reports a bunch of E0401: Unable to import
errors for my own custom modules.bitter-ability-32190
01/09/2023, 5:22 PM./pants dependencies <myfile.py>
and verifying Pants' view of the world is what you expecthappy-kitchen-89482
01/09/2023, 5:22 PM./pants roots
and seeing if your source roots are what you expect them to bechilly-tailor-75063
01/09/2023, 5:26 PM./pants roots
project/app
tests
and ./pants dependencies project/app/v1/models/schedules.py
(one of my modules:
project:poetry#fastapi
project:poetry#fastapi-utils
project:poetry#sqlmodel
I think this is what I expect….bitter-ability-32190
01/09/2023, 5:26 PMchilly-tailor-75063
01/09/2023, 5:27 PMbitter-ability-32190
01/09/2023, 5:27 PMchilly-tailor-75063
01/09/2023, 5:27 PMbitter-ability-32190
01/09/2023, 5:28 PMerror
so that Pants hard errors if you have `import`s it can't find the owner ofchilly-tailor-75063
01/09/2023, 5:30 PM************* Module project.app.v1.models.schedules
project/app/v1/models/schedules.py:7:0: E0401: Unable to import 'app.v1.models.shared' (import-error)
project/app/v1/models/schedules.py:8:0: E0401: Unable to import 'app.v1.models.users' (import-error)
The path is the same as the ** Module lineenough-analyst-54434
01/09/2023, 5:30 PMproject
not project/app
? What is the structure under porject/app
?bitter-ability-32190
01/09/2023, 5:32 PMPYTHONPATH
chilly-tailor-75063
01/09/2023, 5:32 PMproject
I have the Dockerfile, poetry.log, pyproject.toml. Under project/app
I have the actual project code (FastAPI app)from app.v1.models.shared import blah, blah, blah
bitter-ability-32190
01/09/2023, 5:35 PMproject
. That or you should import using import v1.models...
Otherwise your code layount and source roots dont agree.chilly-tailor-75063
01/09/2023, 5:37 PMpants.toml
to have this as my [source]
[source]
root_patterns = [
"project",
"tests",
]
and ./pans lint ::
runs now…
This is interesting to me because I’ve talked with people here before (probably you and Benjy) and have been back and forth about what to set source roots as.bitter-ability-32190
01/09/2023, 5:38 PMchilly-tailor-75063
01/09/2023, 5:42 PMbitter-ability-32190
01/09/2023, 5:42 PMchilly-tailor-75063
01/09/2023, 5:44 PMbitter-ability-32190
01/09/2023, 5:47 PMchilly-tailor-75063
01/09/2023, 5:47 PM