Skip to content

py.typed and type comments - #251

Draft
Avasam wants to merge 19 commits into
python-xlib:masterfrom
Avasam:type-comments
Draft

Avasam wants to merge 19 commits into
python-xlib:masterfrom
Avasam:type-comments

Conversation

@Avasam

@Avasam Avasam commented Nov 17, 2022 •

Copy link
Copy Markdown
Contributor

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

Avasam commented Nov 18, 2022

Copy link
Copy Markdown
Contributor Author

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

codecov-commenter commented Nov 19, 2022 •

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 43.14214% with 228 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.28%. Comparing base (4e8bbf8) to head (1c163a2).
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

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     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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