Skip to content
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 imports of typing_extensions #5374

Merged
merged 11 commits into from
Mar 15, 2021
Merged

Fix imports of typing_extensions #5374

merged 11 commits into from
Mar 15, 2021

Conversation

Dreamsorcerer
Copy link
Member

@Dreamsorcerer Dreamsorcerer commented Dec 29, 2020

Fixes #5107

@psf-chronographer psf-chronographer bot added the bot:chronographer:provided There is a change note present in this PR label Dec 29, 2020
@Dreamsorcerer Dreamsorcerer changed the base branch from master to 3.8 December 29, 2020 21:45
@derlih
Copy link
Contributor

derlih commented Dec 30, 2020

@Dreamsorcerer
may be it is better to move all of this kind of importing

if sys.version_info >= (3, 8):
    from typing import Final
else:
    from typing_extensions import Final

to typedefs.py and then import it from there. What do you think?

@Dreamsorcerer
Copy link
Member Author

to typedefs.py and then import it from there. What do you think?

I'm not overly opposed to it, but I think it could make maintenance slightly more difficult. e.g. When we drop support for Python 3.7, I can currently grep for "3, 8" or "typing_extensions" to find every place that should be updated. I don't really want to leave the code importing from typedefs when it's no longer needed.

@derlih
Copy link
Contributor

derlih commented Jan 3, 2021

Then it could be still present in typedefs.py but without version checking.
I mean to find all occurrences is not a big problem. Just run the tests or mypy.

@Dreamsorcerer
Copy link
Member Author

Yep, OK, we'll do it that way.

@lgtm-com
Copy link
Contributor

lgtm-com bot commented Mar 14, 2021

This pull request introduces 1 alert when merging ff09e43 into 726f44e - view on LGTM.com

new alerts:

  • 1 for Unused import

@webknjaz webknjaz merged commit 2300f54 into 3.8 Mar 15, 2021
@webknjaz webknjaz deleted the typing-import branch March 15, 2021 00:34
bmwiedemann pushed a commit to bmwiedemann/openSUSE that referenced this pull request May 18, 2021
https://build.opensuse.org/request/show/893032
by user mcepl + dimstar_suse
- Add stdlib-typing_extensions.patch to avoid necessity for BR
  python-typing_extensions (gh#aio-libs/aiohttp#5374).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot:chronographer:provided There is a change note present in this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ModuleNotFoundError: No module named 'typing_extensions'
3 participants