setup.py
from setuptools import setup
setup(
setup_requires=['pytest-runner'],
install_requires=[
'typing',
"pytest"
]
)
test_test.py
import subprocess
subprocess.check_call(["python", "-c", "import typing"])
$ docker run --rm -it -w /pwd -v $(pwd):/pwd python:3.7 python setup.py pytest
running pytest
Searching for pytest
Best match: pytest 3.6.3
Processing pytest-3.6.3-py3.7.egg
Using /pwd/.eggs/pytest-3.6.3-py3.7.egg
Searching for typing
Best match: typing 3.6.4
Processing typing-3.6.4-py3.7.egg
Using /pwd/.eggs/typing-3.6.4-py3.7.egg
Searching for six>=1.10.0
Best match: six 1.11.0
Processing six-1.11.0-py3.7.egg
Using /pwd/.eggs/six-1.11.0-py3.7.egg
Searching for py>=1.5.0
Best match: py 1.5.4
Processing py-1.5.4-py3.7.egg
Using /pwd/.eggs/py-1.5.4-py3.7.egg
Searching for pluggy<0.7,>=0.5
Best match: pluggy 0.6.0
Processing pluggy-0.6.0-py3.7.egg
Using /pwd/.eggs/pluggy-0.6.0-py3.7.egg
Searching for more-itertools>=4.0.0
Best match: more-itertools 4.2.0
Processing more_itertools-4.2.0-py3.7.egg
Using /pwd/.eggs/more_itertools-4.2.0-py3.7.egg
Searching for attrs>=17.4.0
Best match: attrs 18.1.0
Processing attrs-18.1.0-py3.7.egg
Using /pwd/.eggs/attrs-18.1.0-py3.7.egg
Searching for atomicwrites>=1.0
Best match: atomicwrites 1.1.5
Processing atomicwrites-1.1.5-py3.7.egg
Using /pwd/.eggs/atomicwrites-1.1.5-py3.7.egg
running egg_info
writing UNKNOWN.egg-info/PKG-INFO
writing dependency_links to UNKNOWN.egg-info/dependency_links.txt
writing requirements to UNKNOWN.egg-info/requires.txt
writing top-level names to UNKNOWN.egg-info/top_level.txt
reading manifest file 'UNKNOWN.egg-info/SOURCES.txt'
writing manifest file 'UNKNOWN.egg-info/SOURCES.txt'
running build_ext
============================================ test session starts ============================================
platform linux -- Python 3.7.0, pytest-3.6.3, py-1.5.4, pluggy-0.6.0
rootdir: /pwd, inifile:
collected 0 items / 1 errors
================================================== ERRORS ===================================================
____________________________________ ERROR collecting tests/test_test.py ____________________________________
tests/test_test.py:3: in <module>
subprocess.check_call(["python", "-c", "import typing"])
/usr/local/lib/python3.7/subprocess.py:328: in check_call
raise CalledProcessError(retcode, cmd)
E subprocess.CalledProcessError: Command '['python', '-c', 'import typing']' returned non-zero exit status 1.
---------------------------------------------- Captured stderr ----------------------------------------------
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/pwd/.eggs/typing-3.6.4-py3.7.egg/typing.py", line 1347, in <module>
class Callable(extra=collections_abc.Callable, metaclass=CallableMeta):
File "/pwd/.eggs/typing-3.6.4-py3.7.egg/typing.py", line 1003, in __new__
self._abc_registry = extra._abc_registry
AttributeError: type object 'Callable' has no attribute '_abc_registry'
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
========================================== 1 error in 0.59 seconds ==========================================
I've used docker, to make this error more reproducible but this errors outside docker as well
You don't need to install the backport on 3.7, because typing is in the standard library since 3.5. I suspect you need a requirement like 'typing; python_version < '3.5'.
@JelleZijlstra, that would work, thanks. It would be nice if this worked using this backport anyway, if this backport is installed by a package not under my control.
Also, if it is not suggested for people to install this backport under newer versions of python, should there be a warning on installation of this package with newer versions of python?
Most helpful comment
You don't need to install the backport on 3.7, because typing is in the standard library since 3.5. I suspect you need a requirement like
'typing; python_version < '3.5'.