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

chilly-holiday-77415

01/25/2023, 11:16 AM
and a probably-simple question -
Copy code
11:11:33.65 [WARN] Pants cannot infer owners for the following imports in the target <..>/stepfn.py:

  * mypy_boto3_stepfunctions.client.SFNClient (line: 7)
I’m using type stubs mapping here, which makes mypy happy but still emits the above warning - but I can’t also use
module_mapping
- how should I avoid that warning? Everything works at runtime, but I’d rather not go and comment each import line if there’s a better way 🙂
Copy code
type_stubs_module_mapping={
        "boto3-stubs": ["boto3"],
    },
e

enough-analyst-54434

01/25/2023, 11:20 AM
I googled the module name (mypy_boto3_stepfunctions) and landed here but you don't mention it: https://pypi.org/project/mypy-boto3-stepfunctions/
I'm ignorant of this space, but ... maybe relevant?
c

chilly-holiday-77415

01/25/2023, 11:32 AM
it’s such a strange project in terms of naming, I’ll re-walk through from the start and try and figure out if I’m missing an obvious thing 🙂
e

enough-analyst-54434

01/25/2023, 11:35 AM
Are you using the extra they document?
The page I linked explains using
boto3-stubs[stepfunctions]
for mypy setup.
c

chilly-holiday-77415

01/25/2023, 11:42 AM
from poetry’s pyproject.toml -
boto3-stubs = {extras = ["secretsmanager", "stepfunctions", "s3"], version = "*"}
e

enough-analyst-54434

01/25/2023, 11:45 AM
Ok, and how do you integrate Poetry with pants? Do you
poetry export
a lockfile you configure with Pants or do you just use
poetry_requirements
with no lockfile?
I think this may be another instance of https://pantsbuild.slack.com/archives/C046T6T9U/p1674594297840689?thread_ts=1674592256.471189&amp;cid=C046T6T9U although in a different area (dep inference here, parametrized resolves there). That thread has not settled with a filed issue or further research yet.
r

refined-addition-53644

01/25/2023, 11:59 AM
So for stepfunctions, it should be
Copy code
"boto3-stubs": ["mypy_boto3_stepfunctions"]
c

chilly-holiday-77415

01/25/2023, 11:59 AM
I’m pretty close to dropping poetry - so I’m using a
poetry_requirements()
source, but a pants lockfile
r

refined-addition-53644

01/25/2023, 12:02 PM
Copy code
poetry_requirements(
    module_mapping={
        "boto3-stubs": ["mypy_boto3_stepfunctions"]  
    },
)
c

chilly-holiday-77415

01/25/2023, 12:09 PM
I’m sure I moved away from module_mappings to declaring them as type stub module mappings for a reason, but I can’t remember that issue - and going back to module mappings does pass typecheck and tests so maybe I just shouldn’t have changed that in the first place 😅
3 Views