https://pantsbuild.org/ logo
#general
Title
# general
c

chilly-holiday-77415

12/20/2022, 5:28 PM
I’m sure I’m missing something here, but I’ve been staring at the docs for too long and can’t see the obvious answer - I’m using
fastapi
which vendors
starlette
as a transitive dependency with a different package name - I’m using a poetry
pyproject.toml
which I guess may be the issue as
starlette
is listed in my lockfile but not in the
pyproject.toml
?
Copy code
17:14:25.85 [WARN] Pants cannot infer owners for the following imports in the target projects/api/main.py:api:

  * starlette.middleware.base.RequestResponseEndpoint (line: 13)
but the
fastapi
dependency is being pulled in:
Copy code
./pants dependencies  projects/api/main.py:api                                                                                    
//:poetry0#fastapi
//:poetry0#loguru
//:poetry0#mangum
projects/api/api_metadata.py:api
projects/api/router/all_routers.py
so this feels close but not quite there 🙂
s

sparse-lifeguard-95737

12/20/2022, 5:33 PM
yea, the
python-infer
subsystem only “sees” top-level `python_requirement`s, not their transitive deps. so you can either add starlette as an explicit top-level dependency to your
pyproject.toml
, or add the
no-infer-dep
comment to that line (I forget the exact comment, but I think the warning log should include the full text)
c

chilly-holiday-77415

12/20/2022, 5:40 PM
ah, I didn’t want to cop out and mute it but I guess that explains why it works even though it’s warning me about it 🙂
thanks for clarifying!
h

happy-kitchen-89482

12/20/2022, 6:27 PM
Yeah if you're directly importing it, Pants expects it to be in your targets, not just in your lockfile. Your targets define the universe of allowed direct requirements, from which lockfiles are generated...