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

mypy option to error if there's a missing py.typed #16960

Closed
jamesbraza opened this issue Feb 29, 2024 · 1 comment
Closed

mypy option to error if there's a missing py.typed #16960

jamesbraza opened this issue Feb 29, 2024 · 1 comment
Labels

Comments

@jamesbraza
Copy link
Contributor

Feature

I often see people making packages, type checking them with mypy, and forgetting to include a py.typed file.

Pitch

Can we add a new option to mypy to error if someone has a package without a py.typed file? It would be nice if mypy could catch this common type of error (forgetting a py.typed file).

@emmatyping
Copy link
Collaborator

Unfortunately I don't think we can do this. If type checkers could tell if a package is missing a py.typed file, the file would not need to exist in the first place. The file exists to signal that a package should be used as a source of type information.

It is entirely reasonable to start using types internally in a package but not want them to be used externally.

As a stop-gap solution, you can use --follow-untyped-imports (recently merged, unreleased) for when a package is published without py.typed.

@emmatyping emmatyping closed this as not planned Won't fix, can't repro, duplicate, stale Dec 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants