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

feat(typing): type util package #2170

Merged
merged 13 commits into from
Aug 21, 2023
Merged

feat(typing): type util package #2170

merged 13 commits into from
Aug 21, 2023

Conversation

copalco
Copy link
Contributor

@copalco copalco commented Aug 16, 2023

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.

  • Applied changes to both WSGI and ASGI code paths and interfaces (where applicable).
  • Added tests for changed code.
  • Prefixed code comments with GitHub nick and an appropriate prefix.
  • Coding style is consistent with the rest of the framework.
  • Updated documentation for changed code.
    • Added docstrings for any new classes, functions, or modules.
    • Updated docstrings for any modifications to existing code.
    • Updated both WSGI and ASGI docs (where applicable).
    • Added references to new classes, functions, or modules to the relevant RST file under docs/.
    • Updated all relevant supporting documentation files under docs/.
    • A copyright notice is included at the top of any new modules (using your own name or the name of your organization).
    • Changed/added classes/methods/functions have appropriate versionadded, versionchanged, or deprecated directives.
  • Changes (and possible deprecations) have towncrier news fragments under docs/_newsfragments/, with the file name format {issue_number}.{fragment_type}.rst. (Run towncrier --draft to ensure it renders correctly.)

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
Copy link

codecov bot commented Aug 16, 2023

Codecov Report

Merging #2170 (8f3478a) into master (f00722a) will not change coverage.
The diff coverage is 100.00%.

❗ Current head 8f3478a differs from pull request most recent head a8b18a4. Consider uploading reports for the commit a8b18a4 to get more accurate results

@@            Coverage Diff            @@
##            master     #2170   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           62        62           
  Lines         6833      6875   +42     
  Branches      1098      1098           
=========================================
+ Hits          6833      6875   +42     
Files Changed Coverage Δ
falcon/util/__init__.py 100.00% <100.00%> (ø)
falcon/util/deprecation.py 100.00% <100.00%> (ø)
falcon/util/misc.py 100.00% <100.00%> (ø)
falcon/util/reader.py 100.00% <100.00%> (ø)
falcon/util/structures.py 100.00% <100.00%> (ø)
falcon/util/sync.py 100.00% <100.00%> (ø)
falcon/util/uri.py 100.00% <100.00%> (ø)

@vytas7 vytas7 changed the title Type util package feat(typing): type util package Aug 16, 2023
vytas7
vytas7 previously approved these changes Aug 16, 2023
Copy link
Member

@vytas7 vytas7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks a ton!

@vytas7 vytas7 requested review from kgriffs and CaselIT August 16, 2023 18:33
Copy link
Member

@CaselIT CaselIT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work, I've left a few comments.

Also sometimes to denote a callable Callable[..., Any] is used while in other places Callable is used. I'm not sure if they are equivalent, but it may make sense to unify them

falcon/util/deprecation.py Show resolved Hide resolved
falcon/util/misc.py Outdated Show resolved Hide resolved
falcon/util/reader.py Outdated Show resolved Hide resolved
falcon/util/structures.py Outdated Show resolved Hide resolved
falcon/util/sync.py Outdated Show resolved Hide resolved
falcon/util/sync.py Outdated Show resolved Hide resolved
falcon/util/uri.py Show resolved Hide resolved
@CaselIT
Copy link
Member

CaselIT commented Aug 16, 2023

Also another question.
Does it make sense to add future-annotation to all modules that have typing?
Personally I think it makes sense, and it should also limit the performance impact of adding typing on the import of a module.
@vytas7 do you have a preference here?

@vytas7
Copy link
Member

vytas7 commented Aug 16, 2023

What do you mean by performance impact @CaselIT? Annotations shouldn't affect code perf once they are parsed... or do you mean import times?

And re future-annotations, if you mean from __future__ import annotations, I'm not very opinionated; but AFAICT I can only see the positives since we don't (ab)use annotations for anything else than providing type hints. So effectively we would need to import less stuff just for typing?

@CaselIT
Copy link
Member

CaselIT commented Aug 17, 2023

Yes I meant the import time of a module

@vytas7 vytas7 requested a review from CaselIT August 19, 2023 18:44
Copy link
Member

@CaselIT CaselIT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks. looks ok for me

@vytas7 vytas7 merged commit 32207fe into falconry:master Aug 21, 2023
35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants