-
Notifications
You must be signed in to change notification settings - Fork 232
Add more stub packages for type checking of 3rd party packages #7021
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
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7021 +/- ##
==========================================
+ Coverage 79.25% 79.25% +0.01%
==========================================
Files 566 566
Lines 43776 43779 +3
==========================================
+ Hits 34690 34693 +3
Misses 9086 9086 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| ) -> str: | ||
| """Get summary for archive initialisation""" | ||
| parameters = [['Path', str(outfile)], ['Version', archive_version], ['Compression', compression]] | ||
| parameters: list[list[Any]] = [['Path', str(outfile)], ['Version', archive_version], ['Compression', compression]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without this annotation mypy infers type list[object] which then fails a type check as we pass this parameter to tabulate.
| 'sqlalchemy[mypy]~=2.0', | ||
| 'tomli', | ||
| 'types-PyYAML' | ||
| 'types-click-spinner~=0.1.8', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @danielhollas, always love more typing! 😍 Just one question before I approve: could you motivate the choice of these version specifications?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The version of the stub package need to match the version of the package itself. So these specifications are just copied over.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @danielhollas! LGTM 🚀 . Maybe add the motivation for the package versions to the commit message, so poor sods like me can learn from it. 😉
447ba22 to
dc40477
Compare
|
Thanks @mbercx! I've added some notes to pyproject.toml |
The added `types-*` packages are maintained in typeshed per PEP561, see: https://github.com/python/typeshed
dc40477 to
0891442
Compare
Some python packages do not contain types, but they have separate "stub" packages that provide type information for them. It is much better to install these stub packages to have a stronger type-checking of code that uses these libraries.