summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBas van Beek <b.f.van.beek@vu.nl>2021-08-30 15:07:45 +0200
committerBas van Beek <b.f.van.beek@vu.nl>2021-08-30 15:29:21 +0200
commitadd26eb860dc1ee85c00d4c93a3ebf728b98448b (patch)
treec9300d9037323e194095fc2a2b814a509a8f650c
parent355336119136f620c27f1adcc26074eb9528c159 (diff)
downloadnumpy-add26eb860dc1ee85c00d4c93a3ebf728b98448b.tar.gz
BLD: Drop typing extension as an (optional) runtime dependency
It might return in the future, but as of the moment we don't need it anymore
-rw-r--r--environment.yml3
-rw-r--r--numpy/typing/__init__.py7
-rw-r--r--numpy/typing/tests/test_typing_extensions.py35
-rw-r--r--test_requirements.txt2
4 files changed, 1 insertions, 46 deletions
diff --git a/environment.yml b/environment.yml
index 5fb7d292d..188e29a4f 100644
--- a/environment.yml
+++ b/environment.yml
@@ -17,9 +17,8 @@ dependencies:
- pytest-cov
- pytest-xdist
- hypothesis
- # For type annotations
+ # For type annotations
- mypy=0.902
- - typing_extensions
# For building docs
- sphinx=4.1.1
- numpydoc=1.1.0
diff --git a/numpy/typing/__init__.py b/numpy/typing/__init__.py
index bfa7982c0..d60ddb5bb 100644
--- a/numpy/typing/__init__.py
+++ b/numpy/typing/__init__.py
@@ -5,13 +5,6 @@ Typing (:mod:`numpy.typing`)
.. versionadded:: 1.20
-.. warning::
-
- Some of the types in this module rely on features only present in
- the standard library in Python 3.8 and greater. If you want to use
- these types in earlier versions of Python, you should install the
- typing-extensions_ package.
-
Large parts of the NumPy API have PEP-484-style type annotations. In
addition a number of type aliases are available to users, most prominently
the two below:
diff --git a/numpy/typing/tests/test_typing_extensions.py b/numpy/typing/tests/test_typing_extensions.py
deleted file mode 100644
index f59f222fb..000000000
--- a/numpy/typing/tests/test_typing_extensions.py
+++ /dev/null
@@ -1,35 +0,0 @@
-"""Tests for the optional typing-extensions dependency."""
-
-import sys
-import textwrap
-import subprocess
-
-CODE = textwrap.dedent(r"""
- import sys
- import importlib
-
- assert "typing_extensions" not in sys.modules
- assert "numpy.typing" not in sys.modules
-
- # Importing `typing_extensions` will now raise an `ImportError`
- sys.modules["typing_extensions"] = None
- assert importlib.import_module("numpy.typing")
-""")
-
-
-def test_no_typing_extensions() -> None:
- """Import `numpy.typing` in the absence of typing-extensions.
-
- Notes
- -----
- Ideally, we'd just run the normal typing tests in an environment where
- typing-extensions is not installed, but unfortunatelly this is currently
- impossible as it is an indirect hard dependency of pytest.
-
- """
- p = subprocess.run([sys.executable, '-c', CODE], capture_output=True)
- if p.returncode:
- raise AssertionError(
- f"Non-zero return code: {p.returncode!r}\n\n{p.stderr.decode()}"
- )
-
diff --git a/test_requirements.txt b/test_requirements.txt
index e2dcdaed3..ee47af8f0 100644
--- a/test_requirements.txt
+++ b/test_requirements.txt
@@ -10,6 +10,4 @@ pickle5; python_version == '3.7' and platform_python_implementation != 'PyPy'
cffi
# For testing types. Notes on the restrictions:
# - Mypy relies on C API features not present in PyPy
-# - There is no point in installing typing_extensions without mypy
mypy==0.910; platform_python_implementation != "PyPy"
-typing_extensions==3.10.0.0; platform_python_implementation != "PyPy"