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): type request module #2271

Closed CaselIT closed 1 month ago

CaselIT commented 1 month ago

Type sync and async request modules.

Also move the attribute docs next to the actual attribute declaration, to improve usability with editors.

Some additional odd and end typing improvements

Also incorporate #2205:

Co-authored-by: Dave Tapley <dave@tapley.com>
codecov[bot] commented 1 month ago

Codecov Report

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

Project coverage is 100.00%. Comparing base (df2debe) to head (9f8231b). Report is 1 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #2271 +/- ## ========================================= Coverage 100.00% 100.00% ========================================= Files 63 63 Lines 7249 7326 +77 Branches 1268 1275 +7 ========================================= + Hits 7249 7326 +77 ```

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

CaselIT commented 1 month ago

@vytas7 it's ready for review. We need to decide what to do with python 3.7

I vote to drop it. We can do best effort for 3.8 in 4.0, but let's keep the mention that it may be dropped in following 4.x releases

vytas7 commented 1 month ago

@vytas7 it's ready for review. We need to decide what to do with python 3.7

I vote to drop it. We can do best effort for 3.8 in 4.0, but let's keep the mention that it may be dropped in following 4.x releases

Yes, all that is already described in the upcoming release notes: Changes to Supported Platforms.

Re 3.7, cannot we just do Protocol = object in typing.py for 3.7, and things would just work? We could just write that typing is unsupported on 3.7. And then drop 3.7 and maybe 3.8 in Falcon 4.1.

CaselIT commented 1 month ago

Re 3.7, cannot we just do Protocol = object in typing.py for 3.7, and things would just work? We could just write that typing is unsupported on 3.7. And then drop 3.7 and maybe 3.8 in Falcon 4.1.

I'm not really sold on doing this. Since I don't think type checkers will like it. In my opinion we either do something like https://github.com/falconry/falcon/blob/7341f96eab52f98b16080f2f458fa5fd3799f4f5/falcon/_typing_extensions.py or we drop it. Doing the aliasing seems an hack

CaselIT commented 1 month ago

not sure what's up with coverage.

CaselIT commented 1 month ago

re missing, I've moved it to the typing module, so that we can decide with all the rest when we are done with the typing what to make public and not to