Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for multiple types validation in type + typing support #7

Closed
smarie opened this issue Sep 7, 2019 · 2 comments
Closed

Support for multiple types validation in type + typing support #7

smarie opened this issue Sep 7, 2019 · 2 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@smarie
Copy link
Owner

smarie commented Sep 7, 2019

No description provided.

@smarie smarie transferred this issue from smarie/python-mixture Sep 25, 2019
@smarie smarie added bug Something isn't working enhancement New feature or request labels Oct 8, 2019
@smarie
Copy link
Owner Author

smarie commented Oct 8, 2019

Several things need to be handled:

  • If we use a tuple in type_hint the TypeError does not properly formats: AttributeError: 'tuple' object has no attribute '__name__'

  • if we use a typing.Union, does it work ?

  • doc needs to be updated accordingly

@smarie smarie changed the title Support for multiple types validation in type Support for multiple types validation in type + typing support Oct 8, 2019
@smarie
Copy link
Owner Author

smarie commented Oct 8, 2019

The following type checkers exist:

  • typeguard: python 3.5+, seems compliant with python 3.7
  • pytypes: python 2+, still has issues covering python 3.7, maybe slower but more capable than typeguard (to be documented with a recent benchmark)
  • enforce for 3.5+, no commit since June 2017
  • typo, no commits since November 2016
  • ...

Some benchmarks were made by attrs but this is quite old already: python-attrs/attrs#301

In addition, typing_inspect provides an API for the typing module that is supposed to cover most version. A version compliant with python 3.5.3- is available in valid8 already.

@smarie smarie closed this as completed in 68d3a25 Oct 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant