Skip to content

Fix imports of typing_extensions#5374

Merged
webknjaz merged 11 commits into3.8from
typing-import
Mar 15, 2021
Merged

Fix imports of typing_extensions#5374
webknjaz merged 11 commits into3.8from
typing-import

Conversation

@Dreamsorcerer
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member Author

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

@lgtm-com
Copy link
Copy Markdown
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
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