diff --git a/.travis.yml b/.travis.yml index 7b1fc19..cf35028 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,16 +5,18 @@ os: - linux # Travis does not support Python on OSX or Windows. Should we migrate to a different CI service? python: - - 3.5 - - 3.6 - - 3.7-dev # TODO: Replace with plain "3.7" when supported by Travis -# - 3.8-dev # TODO: Compatibility issues with MyPy, see https://travis-ci.org/UAVCAN/pydsdl/jobs/519988157 + - '3.5.3' # Oldest supported version + - '3.5' + - '3.6' + - '3.7-dev' # TODO: Replace with plain "3.7" when supported by Travis +# - '3.8-dev' # TODO: Compatibility issues with MyPy, see https://travis-ci.org/UAVCAN/pydsdl/jobs/519988157 before_script: - pip install -r requirements.txt - pip install coveralls # Intentionally removed from requirements.txt because it's only useful in the CI environment script: + - python --version - ./test.sh - coveralls # Publish the coverage stats online. - git clone https://github.com/UAVCAN/dsdl --branch=uavcan-v1.0 dsdl-test # TODO: Switch to master once v1.0 is merged diff --git a/pydsdl/__init__.py b/pydsdl/__init__.py index ac2ae30..9d7074c 100644 --- a/pydsdl/__init__.py +++ b/pydsdl/__init__.py @@ -6,11 +6,33 @@ import os as _os import sys as _sys -if _sys.version_info[:2] < (3, 5): # pragma: no cover - print('A newer version of Python is required', file=_sys.stderr) +# The original intent was to support Python 3.5 and newer; however, we have discovered a bug in the static typing +# library in Python 3.5.2 which makes the library quite unusable: when importing, the typing module would throw +# "TypeError: This Callable type is already parameterized." from the expression module. The problem does not appear +# in Python 3.5.3 or any newer versions; it is fixed in the upstream here: https://github.com/python/typing/pull/308. +# This is how you can reproduce it in REPL; first, the correct behavior that can be observed in Python 3.5.3+: +# >>> import typing +# >>> T = typing.TypeVar('T') +# >>> G = typing.Callable[[], T] +# >>> G[int] +# typing.Callable[[], int] +# And this is what you get in Python 3.5.2-: +# >>> import typing +# >>> T = typing.TypeVar('T') +# >>> G = typing.Callable[[], T] +# >>> G[int] +# Traceback (most recent call last): +# File "", line 1, in +# File "/usr/lib/python3.5/typing.py", line 815, in __getitem__ +# raise TypeError("This Callable type is already parameterized.") +# TypeError: This Callable type is already parameterized. +_min_supported_python_version = 3, 5, 3 +if _sys.version_info[:3] < _min_supported_python_version: # pragma: no cover + print('This package requires a Python version', '.'.join(map(str, _min_supported_python_version)), 'or newer', + file=_sys.stderr) _sys.exit(1) -__version__ = 0, 7, 3 +__version__ = 0, 8, 0 __license__ = 'MIT' # Our unorthodox approach to dependency management requires us to apply certain workarounds.