Skip to content

Commit

Permalink
Require typing_extensions for py<3.8 only
Browse files Browse the repository at this point in the history
All the names imported from typing_extensions are available already
in Python 3.8, so there is no need to use the additional dependency
there.  Furthermore, typing_extensions currently do not support
Python 3.9, effectively blocking yarl from doing so.  To solve this,
use external typing_extensions only for py<3.8, and just use builtin
typing in 3.8+.
  • Loading branch information
mgorny committed Jul 27, 2020
1 parent b73957c commit 5ffe92c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGES/484.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Do not require typing_extensions on Python 3.8 and newer.
2 changes: 1 addition & 1 deletion requirements/test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ pytest-cov>=2.3.1
pytest==5.4.3
multidict==4.7.6
idna==2.10
typing_extensions==3.7.4.2
typing_extensions==3.7.4.2;python_version<"3.8"
-e .
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
except IndexError:
raise RuntimeError("Unable to determine version.")

install_requires = ["multidict>=4.0", "idna>=2.0", "typing_extensions>=3.7.4"]
install_requires = ["multidict>=4.0", "idna>=2.0",
"typing_extensions>=3.7.4;python_version<\"3.8\""]


def read(name):
Expand Down
7 changes: 6 additions & 1 deletion yarl/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
from typing import overload, Any, Tuple, Optional, Mapping, Union, Sequence, Type
from typing_extensions import TypedDict, Final, final
import multidict
from functools import _CacheInfo
import sys

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

_QueryVariable = Union[str, int]
_Query = Union[
Expand Down

0 comments on commit 5ffe92c

Please sign in to comment.