RussBaz / enforce

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

not compatible with python 3.7 #71

Open etam opened 6 years ago

etam commented 6 years ago
  [...]
  File ".../lib/python3.7/site-packages/enforce/__init__.py", line 1, in <module>
    from .decorators import runtime_validation
  File ".../lib/python3.7/site-packages/enforce/decorators.py", line 11, in <module>
    from .enforcers import apply_enforcer, Parameters, GenericProxy
  File ".../lib/python3.7/site-packages/enforce/enforcers.py", line 10, in <module>
    from .validator import init_validator, Validator
  File ".../lib/python3.7/site-packages/enforce/validator.py", line 4, in <module>
    from .parsers import get_parser
  File ".../lib/python3.7/site-packages/enforce/parsers.py", line 225, in <module>
    typing.TupleMeta: _parse_tuple,
AttributeError: module 'typing' has no attribute 'TupleMeta'

python/cpython@d911e40e788fb679723d78b6ea11cabf46caed5a made some Lib/typing.py internal refactoring

fogg4444 commented 6 years ago

following

ghost commented 5 years ago

They have fixed this in the issue you are reference, have you applied updates to enforce?

tf42src commented 5 years ago

Same here:

pip install git+https://github.com/RussBaz/enforce.git@dev
pip freeze | grep enforce
enforce==0.3.5
python --version
Python 3.7.0
future: <Task finished coro=<RabbitMQ._process_message() done, defined at /../rabbitmq.py:71> exception=AttributeError("module 'typing' has no attribute 'TupleMeta'")>
NoneType: None
Twista commented 5 years ago

Hey,

is there any plan to make this 3.7 compatible?

thanks :)

RussBaz commented 5 years ago

Well, I have a patch ready that will make it run on 3.7 but it will faill the tests as the structure of python typing internals is quuite different now from how it used to be. The most realistic approach is to rewrite without caring for earlier versions of python. At the moment, making it work on all versions is a serious pain.

I will release the patch some time later this month but I cannot guarantee that I will be able to make it work with 3.7+ any time soon without help.

The sheer number of corner cases which I did not know about when I wrote the first script has made the current codebase quite freightening. Without a huge number of tests it would have been impossibe.

d33tah commented 4 years ago

@RussBaz

Hi! Any updates on the issue?

crypdick commented 4 years ago

@d33tah might be worth looking into typeguard while the fix is in the works

SamuelMarks commented 4 years ago

I just started working on a new fork: https://github.com/SamuelMarks/enforce

Early days, but open to collaborators

(just worked on minor fixes, black, and replacing CI with GitHub Actions thus far)

[also can offer this back if @RussBaz wants]

sg-s commented 2 years ago

any update on this?

Masterxilo commented 2 days ago

any update on this?