falconry / falcon

The no-magic web data plane API and microservices framework for Python developers, with a focus on reliability, correctness, and performance at scale.
https://falcon.readthedocs.io/en/stable/
Apache License 2.0
9.51k stars 937 forks source link

feat(typing): add type hints to hooks #2183

Closed copalco closed 1 month ago

copalco commented 11 months ago

Summary of Changes

Replace this text with a high-level summary of the changes included in this PR.

Related Issues

Please reference here any issue #'s that are relevant to this PR, or simply enter "N/A" if this PR does not relate to any existing issues.

Pull Request Checklist

This is just a reminder about the most common mistakes. Please make sure that you tick all appropriate boxes. But please read our contribution guide at least once; it will save you a few review cycles!

If an item doesn't apply to your pull request, check it anyway to make it apparent that there's nothing to do.

If you have any questions to any of the points above, just submit and ask! This checklist is here to help you, not to deter you from contributing!

PR template inspired by the attrs project.

codecov[bot] commented 10 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 100.00%. Comparing base (edcd5f6) to head (efdf4dc). Report is 1 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #2183 +/- ## ========================================= Coverage 100.00% 100.00% ========================================= Files 63 63 Lines 7170 7178 +8 Branches 1260 1260 ========================================= + Hits 7170 7178 +8 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

CaselIT commented 1 month ago

this seems to include https://github.com/falconry/falcon/pull/2171. I'll get to this once the other one is merged (I hope to merge it soon)

CaselIT commented 1 month ago

Since we dropped 3.7 we can probably avoid having everything inside a type check block. Will do

CaselIT commented 1 month ago

Maybe it would be nice if it is importable without TYPE_CHECKING too? Should we document any aliases?

For the moment I mentioned in the v4 chance log that any type alias should be treated as private, since it can change between releases.

I think once we are adding typing we can do a bit of cleanup and maybe provide a public set to aliaes