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

Providing type hints for IDEs and linters #140

Closed
TaaviE opened this issue Jul 27, 2019 · 2 comments · Fixed by #502
Closed

Providing type hints for IDEs and linters #140

TaaviE opened this issue Jul 27, 2019 · 2 comments · Fixed by #502

Comments

@TaaviE
Copy link

TaaviE commented Jul 27, 2019

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.

@jwag956
Copy link
Member

jwag956 commented Jul 27, 2019

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.
My guess is by end of year folks like flask and werkzeug will do that - once they do, I will as well - then we can start on that process.

Up to now - both flask and werkzeug are continuing to issue new feature releases that are still compatible with 2.7

@TaaviE
Copy link
Author

TaaviE commented Jul 27, 2019

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.

jwag956 added a commit that referenced this issue Jul 11, 2021
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
@jwag956 jwag956 mentioned this issue Jul 11, 2021
jwag956 added a commit that referenced this issue Jul 11, 2021
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
jwag956 added a commit that referenced this issue Jul 11, 2021
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants