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

Use typing_extensions only on Python 3.7 and lower #504

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ptrcnull
Copy link

Protocol was added with PEP 544 to Python 3.8+

What do these changes do?

They remove a dependency on the package typing_extensions when it's not needed

Are there changes in behavior for the user?

No, it's a change directed at package maintainers for Linux distributions

Checklist

  • I think the code is well written
  • Unit tests for the changes exist
  • Documentation reflects the changes
  • Add a new news fragment into the CHANGES folder
    • name it <issue_id>.<type> (e.g. 588.bugfix)
    • if you don't have an issue_id change it to the pr id after creating the PR
    • ensure type is one of the following:
      • .feature: Signifying a new feature.
      • .bugfix: Signifying a bug fix.
      • .doc: Signifying a documentation improvement.
      • .removal: Signifying a deprecation or removal of public API.
      • .misc: A ticket has been closed, but it is not of interest to users.
    • Make sure to use full sentences with correct case and punctuation, for example: Fix issue with non-ascii contents in doctest text files.

Protocol was added with PEP 544 to Python 3.8+
# Python 3.8+
from typing import Protocol
except ImportError:
from typing_extensions import Protocol
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Files skipped (0):
[46](https://github.com/aio-libs/janus/actions/runs/4158352254/jobs/7329564730?pr=504#step:6:47)
mypy janus --disallow-untyped-calls --disallow-incomplete-defs --strict
[47](https://github.com/aio-libs/janus/actions/runs/4158352254/jobs/7329564730?pr=504#step:6:48)
janus/__init__.py:16: error: Incompatible import of "Protocol" (imported name has type "typing_extensions._SpecialForm", local name has type "<typing special form>")  [assignment]
[48](https://github.com/aio-libs/janus/actions/runs/4158352254/jobs/7329564730?pr=504#step:6:49)
Found 1 error in 1 file (checked 1 source file)
[49](https://github.com/aio-libs/janus/actions/runs/4158352254/jobs/7329564730?pr=504#step:6:50)
make: *** [Makefile:31: mypy] Error 1
[50](https://github.com/aio-libs/janus/actions/runs/4158352254/jobs/7329564730?pr=504#step:6:51)
Error: Process completed with exit code 2.

linter issue needs to be addressed.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, i have no clue how to fix that - obviously they're not gonna be the same type, but they have the same API

@jettify
Copy link
Member

jettify commented Mar 19, 2023

From other side py3.7 gonna hit EOL in several moth, we gonna drop support as well.

@g0hl1n
Copy link

g0hl1n commented Feb 29, 2024

From other side py3.7 gonna hit EOL in several moth, we gonna drop support as well.

Python 3.7 is EOL since 2023-06-27 (see endoflife.date or python.org).

Would it therefore be possible to drop the typing_extensions dependency now?
If yes, should this PR be adapted or a new one created?

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.

None yet

3 participants