Open kiukchung opened 2 years ago
Sounds like a reasonable request. Sending a patch shortly.
Awesome, I can confirm mypy is able to get type hints for torchdata from my project. Will depend on the nightly until a dot release. Any ideas on when 0.4.2 will be released?
@kiukchung
I am sorry that I have to revert the PR until we fix the wrong typing in torchdata
. See: https://github.com/pytorch/data/issues/782
And, in terms of the official release, it should be happen in the a 1/2 months aligned with PyTorch Core.
🚀 The feature
From what I can tell torchdata actually had type stubs but mypy won't pick it up because it is missing the
py.typed
marker file (see: https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-library-stubs-or-py-typed-marker)The ask is to add
py.typed
to the package data similar to how torch does it so that projects using torchdata can have mypy recognize torchdata modules type hints.Motivation, pitch
My project uses torchdata and also uses mypy for static type checking. Since mypy does not pick up torchdata's type stubs I get an error as:
Alternatives
I could add a
ignore-missing-imports
in mymypy.ini
file:But that means that all the torchdata related types will be typed as
Any
, hence not letting me enable checks likedisallow_subclassing_any=True
if I'm writing my own custom datapipe that subclassestorchdata.datapipes.iter.IterDataPipe
.Additional context
No response