Skip to content

py.typed and type comments #251

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

Draft
wants to merge 19 commits into
base: master
Choose a base branch
from
Draft

Conversation

Avasam
Copy link
Contributor

@Avasam Avasam commented Nov 17, 2022

Added type comments as per PEP 561 to type all public API while staying Python 2 compatible. (type definitions only need to be compatible with non EOL python versions. Using type comments instead of inline-types allows the code to still run on Python 2)

Added a py.typed marker to let type checkers know that this package provides its own types. And to not look for external type-stubs.

Some dynamic types (like Struct, Request, Event, ...) are naturally incomplete, but this was more than enough for my needs. And would add a lot of complexity to support.

For this to be as accurate as possible, the following should also be looked at:

@Avasam Avasam marked this pull request as draft November 18, 2022 21:16
@Avasam
Copy link
Contributor Author

Avasam commented Nov 18, 2022

As draft until all previous are also closed

@Avasam Avasam force-pushed the type-comments branch 2 times, most recently from 83ce322 to 70aa021 Compare November 18, 2022 22:39
@codecov-commenter
Copy link

codecov-commenter commented Nov 19, 2022

Codecov Report

Merging #251 (1c163a2) into master (4e8bbf8) will decrease coverage by 2.92%.
The diff coverage is 43.14%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #251      +/-   ##
==========================================
- Coverage   78.21%   75.28%   -2.93%     
==========================================
  Files          42       42              
  Lines        4705     5054     +349     
==========================================
+ Hits         3680     3805     +125     
- Misses       1025     1249     +224     

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants