How are type-stubs supposed to be found/included? ...
# development
b
How are type-stubs supposed to be found/included? With a requirements with
toml
and
types-toml
, the
peek
shows that
types-toml
has a
null
types_stubs_modules
. Is that expected? I don't see it anywhere when running
check
on a file with a
toml
dependency. Additionally, if I set
types_stubs_modules
myself, still nada
I don't see this behavior on
main
, in the Pants repo, it seems
Ohhhhh I think this is a bug (or rather, a feature we ought to get right)
pytest
depends on
toml
, but we don't see that. So we don't include
types-toml
in the PEX. If I tell Pants that
pytest
depends on
toml
, it doesn't bring along the type stubs however.
CC @happy-kitchen-89482
h
@hundreds-father-404 is the expert on this
h
pytest depends on toml, but we don't see that. So we don't include types-toml in the PEX.
Yep, pants has no notion of transitive depencencies declared via python packaging metadata
b
Yeah that part I can stomach. But I think we might want to have
toml
depend on
types-toml
instead of them being siblings. OR, when we run
check
we go hunting for
toml
type stubs if toml is requested. I think with tagged dependencies option 1 is cleaner
h
but the issue is that
pytest
doesn't directly depend on
toml
in Pants's view of deps, right? If you run
pants dependencies
, toml won't show up. So that wouldn't make a difference if
types-toml
was a dep of
toml
b
Correct that's the "core" issue. And I get it. But what surprises me was that by declaring a dep between pytest and toml, I didn't get types-toml as well
Put another way, I was surprised that inferring a depending on types-toml came from the import, and not from a dependency on toml.
(I'll also say I've been wondering if we could have a plugin that dumps the dependency graph into BUILD.pants, a la Gazelle, to help those who have very long inference times. You can still use inference, but it'd be to validate the metadata, instead of being fed to the engine)
h
That might make sense to have
types-toml
be a dependant automatically of
toml
👍 1
I'll also say I've been wondering if we could have a plugin that dumps the dependency graph into BUILD.pants,
Ha, I was originally a proponent of buildgen rather than dep inference. Benjy and Stu convinced me out of it. This is best as a dedicated thread
👍 1
h
With the rust parser, are very long inference times still a thing?
b
Long might be subjective. Longer than 0 🙂 Also, if there's more in the repo than Python (or other dep inferers)