Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request: adding py.typed for type checkers #2258

Open
jamesbraza opened this issue Jan 13, 2025 · 2 comments
Open

Request: adding py.typed for type checkers #2258

jamesbraza opened this issue Jan 13, 2025 · 2 comments
Assignees
Labels
better engineering Tasks which help improve eng productivity e.g. building tools, cleaning up code, writing docs triaged This issue has been assigned an owner and appropriate label

Comments

@jamesbraza
Copy link

Currently with torchtune==0.5.0 and mypy=1.14.1 I get import-untyped:

error: Skipping analyzing "torchtune": module is installed, but missing library stubs or py.typed marker  [import-untyped]
    from torchtune import generation
    ^
error: Skipping analyzing "torchtune.data": module is installed, but missing library stubs or py.typed marker  [import-untyped]
    from torchtune.data import Message as TorchTuneMessage
    ^

It would be nice to add a py.typed to torchtune so type checkers like mypy can inspect torchtune.

@krammnic
Copy link
Contributor

Interesting point about mypy! @joecummings Actually, probably there are several points related to modern python related techniques(uv for example) that might improve our CI/CD. Is this really relevant for us?

@joecummings joecummings added better engineering Tasks which help improve eng productivity e.g. building tools, cleaning up code, writing docs triaged This issue has been assigned an owner and appropriate label labels Jan 14, 2025
@joecummings joecummings self-assigned this Jan 14, 2025
@joecummings
Copy link
Contributor

torchtune tries to be as complete as possible in it's typing but we aren't perfect, hence why we are hesitant to provide a py.typed file ATM. We're working on this and any type-hints you see missing in our code, we'd love to accept a PR!

I'm definitely interested in looking into modernizing our Python stack as much as possible, but since we are PyTorch we have to support all the way down to Python 3.9 until all of PyTorch upgrades.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
better engineering Tasks which help improve eng productivity e.g. building tools, cleaning up code, writing docs triaged This issue has been assigned an owner and appropriate label
Projects
None yet
Development

No branches or pull requests

3 participants