RussBaz / enforce

Python 3.5+ runtime type checking for integration testing and data validation
542 stars 21 forks source link

Problems with Python 3.6 #34

Closed wizzardx closed 7 years ago

wizzardx commented 7 years ago

This works fine with Python 3.5:

import enforce

from typing import List

@enforce.runtime_validation
def test() -> List[int]:
    return [1,2,3]

test()

But under Python 3.6 it has this error:

  File "test.py", line 1, in 
    import enforce
  File "/tmp/x/py36/venv/lib/python3.6/site-packages/enforce/__init__.py", line 1, in 
    from .decorators import runtime_validation
  File "/tmp/x/py36/venv/lib/python3.6/site-packages/enforce/decorators.py", line 9, in 
    from .enforcers import apply_enforcer, Parameters, GenericProxy
  File "/tmp/x/py36/venv/lib/python3.6/site-packages/enforce/enforcers.py", line 7, in 
    from .types import EnhancedTypeVar, is_type_of_type
  File "/tmp/x/py36/venv/lib/python3.6/site-packages/enforce/types.py", line 5, in 
    from typing import Optional, Union, UnionMeta, Any, TypeVar, Tuple, Generic
ImportError: cannot import name 'UnionMeta'
RussBaz commented 7 years ago

Python 3.5.3+ is now supported (including 3.6.0) in the dev branch. However, I have accidentally broken a backward compatibility with Python 3.5.0-3.5.2. I will try fixing it as soon as I manage to rollback to Python 3.5.2.

Thanks for waiting.