-
Notifications
You must be signed in to change notification settings - Fork 109
Only use typing-extensions if necessary #563
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
Only use typing-extensions if necessary #563
Conversation
Reviewer's Guide by SourceryThis pull request refactors the import logic for type annotations so that the usage of typing-extensions is conditional based on the Python version. The changes conditionally import Self and TypeAlias from either typing or typing-extensions depending on the Python version, reducing unnecessary dependencies when running on newer Python versions. No diagrams generated as the changes look simple and do not need a visual representation. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
Hey @ppentchev - I've reviewed your changes - here's some feedback:
Overall Comments:
- Consider adding a comment explaining why the version check is different for
Self
andTypeAlias
. - It might be cleaner to define a helper function to handle the conditional import of
Self
andTypeAlias
.
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
d6798ec
to
0655497
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #563 +/- ##
=======================================
Coverage 88.84% 88.84%
=======================================
Files 36 36
Lines 4080 4080
Branches 376 376
=======================================
Hits 3625 3625
Misses 310 310
Partials 145 145 ☔ View full report in Codecov by Sentry. |
@ppentchev Can you give this a rebase? (there may be some conflics) |
TypeAlias was included in the typing module in Python 3.10. Self was included in the typing module in Python 3.11.
0655497
to
0eda710
Compare
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.
LGTM
@ppentchev Thank you! Released v0.44.1 (Release, PyPI) If you try again, is anything different? |
As discussed in #562 - a second PR that contains the change that makes the use of typing-extensions conditional on the Python version.
Thanks for your work on libtmux and tmuxp!
Summary by Sourcery
Enhancements:
typing.Self
if Python version is greater than or equal to 3.11, otherwise import it fromtyping_extensions
.