-
Notifications
You must be signed in to change notification settings - Fork 59
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
Improve typing #70
base: master
Are you sure you want to change the base?
Improve typing #70
Conversation
Signed-off-by: Marek Pikuła <[email protected]>
Fixes bauerji#65 - make it pass mypy tests (i.e., improve type hinting) - add mypy test to CI - add py.typed to setup so that other packages recognize it's typed - enable async view function decoration (via ensure_sync() as noted on https://flask.palletsprojects.com/en/latest/async-await/#extensions) Signed-off-by: Marek Pikuła <[email protected]>
Signed-off-by: Marek Pikuła <[email protected]>
Signed-off-by: Marek Pikuła <[email protected]>
Signed-off-by: Marek Pikuła <[email protected]>
Signed-off-by: Marek Pikuła <[email protected]>
Signed-off-by: Marek Pikuła <[email protected]>
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Hi @bauerji, is there any chance to merge this PR? |
flask_pydantic/core.py
Outdated
def _get_type_generic(hint: Any): | ||
"""Extract type information from bound TypeVar or Type[TypeVar].""" | ||
if isinstance(hint, TypeVar): | ||
assert ( | ||
getattr(hint, "__bound__", None) is not None | ||
), "If using TypeVar, you need to specify bound model." | ||
return getattr(hint, "__bound__") | ||
|
||
args = get_args(hint) | ||
if len(args) > 0 and isinstance(args[0], TypeVar): | ||
assert ( | ||
getattr(args[0], "__bound__", None) is not None | ||
), "If using TypeVar, you need to specify bound model." | ||
return getattr(args[0], "__bound__") | ||
|
||
return hint |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please add tests to cover this? Also would be nice to mention that in docs 🙏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure thing 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Let me know if it's enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, any news regarding the review? Is there anything I could do to move forward this PR?
Signed-off-by: Marek Pikuła <[email protected]>
Signed-off-by: Marek Pikuła <[email protected]>
Signed-off-by: Marek Pikuła <[email protected]>
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Hi @bauerji, any news regarding this PR? I've made the changes you requested some time ago. Let me know what can I do to move this PR forward. If you give me a green light for the recent changes, I'll rebase this PR on the main branch. |
@bauerji I'm also interested in getting this merged. Could you let us know if there's something we can do to help? thank you |
@MarekPikula I resolved the conflicts between this branch and the current repo HEAD here: https://github.com/bauerji/flask-pydantic/compare/master...kouk:flask-pydantic:improve_typing?expand=1 |
Fixes #65
Typing:
py.typed
to setup so that other packages recognize it's typedGeneral
black
CI: