-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
fix: adding py.typed file as marker for mypy #7008
base: main
Are you sure you want to change the base?
fix: adding py.typed file as marker for mypy #7008
Conversation
|
The pyright docs also make it clear that a package that does type hinting (it doesn't need to be fully typed, or even correctly typed), should have a py.typed file in the root module directory. This PR makes sense. |
|
Our typing seems very rudimentary to me, so I wonder if doing this will lead to more chaos than it solves. Out of curiosity I checked the situation with scipy, and they still don't have a |
@michaelosthege, could you explain what this is for? It seems to be unused. Lines 53 to 61 in 05b557f
|
@lucianopaz I think it's included due to setuptools-scm. I verified that it's included in both sdist and wheels. |
Ah, no, we're not using setuptools-scm. In any case I verified that it's included. |
The Meanwhile, PyTensor has the |
Thanks a lot @michaelosthege for the context! Seems like you already have some experience with I'm assuming that users who are using pymc as a library may see a bunch of new type errors, but the main userbase is probably people writing notebooks who just want their IDEs to give type hints, so the benefits will greatly outweigh the downsides. Does this seem like an accurate assessment? |
I'll have to try this myself in one project with a rather involved model. If you check the mypy logs, we still have a bunch (>100?) errors that get ignored and many of those are due to 95 % of user interaction with the PyMC API goes through the distribution API (which totally breaks mypy and IDEs) and another 4 % is via @thomasaarholt did you try a real-world project with |
What is this PR about?
This PR add a new file
py.typed
at the root of the module to fix this issueThe goal is to allow mypy analyze
Checklist
Major / Breaking Changes
New features
Bugfixes
my_file.py:1: error: Skipping analyzing “pymc”: module is installed, but missing library stubs or py.typed marker [import-untyped]
Documentation
Maintenance
📚 Documentation preview 📚: https://pymc--7008.org.readthedocs.build/en/7008/