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
Providing type hints for IDEs and linters #140
Comments
I agree - but I think it's best to wait until we drop 2.7 support so we don't have to use the 'comment' style type hints. Up to now - both flask and werkzeug are continuing to issue new feature releases that are still compatible with 2.7 |
Though to be fair the user base of this package is probably not using Python 2.7, so keeping Python 2.7 until the end of the year will probably save no-one. If it saves development time that could be used elsewhere I'd say it's worth it. |
This adds types to the Security constructor and init_app. This required major refactoring of how initialization happened since prior to this all arguments were added to kwargs (including default forms, config variables, etc) then set as attributes on the instance. Not easy to provide types for each one. We remove all that, remove the _SecurityState class and concept. Furthermore - in many places - we change from using _securyty.attr and use config_value("xxx"). Improve performance of config_value - no reason to create a dictonary every time - just query the key! Add typing to more tests and views to help verify the types make sense. Fix view responses - the types should be flask.ResponsValue - not Response Fix 'within' and 'grace' typing - then can take floats. closes: #140
This adds types to the Security constructor and init_app. This required major refactoring of how initialization happened since prior to this all arguments were added to kwargs (including default forms, config variables, etc) then set as attributes on the instance. Not easy to provide types for each one. We remove all that, remove the _SecurityState class and concept. Furthermore - in many places - we change from using _securyty.attr and use config_value("xxx"). Improve performance of config_value - no reason to create a dictonary every time - just query the key! Add typing to more tests and views to help verify the types make sense. Fix view responses - the types should be flask.ResponsValue - not Response Fix 'within' and 'grace' typing - then can take floats. closes: #140
This adds types to the Security constructor and init_app. This required major refactoring of how initialization happened since prior to this all arguments were added to kwargs (including default forms, config variables, etc) then set as attributes on the instance. Not easy to provide types for each one. We remove all that, remove the _SecurityState class and concept. Furthermore - in many places - we change from using _securyty.attr and use config_value("xxx"). Improve performance of config_value - no reason to create a dictonary every time - just query the key! Add typing to more tests and views to help verify the types make sense. Fix view responses - the types should be flask.ResponsValue - not Response Fix 'within' and 'grace' typing - then can take floats. closes: #140
It would be really nice if code could slowly start utilizing Python's type hints as specified by this PEP to possibly catch a few bugs but just to simplify development when using a good IDE.
The text was updated successfully, but these errors were encountered: