Skip to content

feat(mypy): proper decorator typing with ParamSpec #305

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

BobTheBuidler
Copy link

@BobTheBuidler BobTheBuidler commented Apr 30, 2025

What was wrong?

More modern versions of python support ParamSpec in the typing module. This PR implements proper decorator typing with ParamSpec in all python versions that support it, and falls back to the current behavior on python versions that don't.

Related to Issue # N/A
Closes # N/A

How was it fixed?

Conditional definitions based on whether or not typing module has ParamSpec defined

Todo:

  • Clean up commit history
  • Add or update documentation related to these changes
  • Add entry to the release notes

I did not update docs or release notes as I don't think its necessary for this type of change. Let me know if you disagree and I can do so.

Cute Animal Picture

Put a link to a cute animal picture inside the parenthesis-->

@BobTheBuidler
Copy link
Author

All tests will pass if you allow me to # type: ignore [misc] away these mypy errors, and typing will still work properly downstream.

@BobTheBuidler BobTheBuidler marked this pull request as ready for review April 30, 2025 23:45
@BobTheBuidler BobTheBuidler changed the title Paramspec feat(mypy): proper decorator typing with ParamSpec Apr 30, 2025
@BobTheBuidler
Copy link
Author

Alternatively, I'd like to suggest making typing_extensions a dependency so we can use ParamSpec appropriately on all python versions

On second thought, I think this comment applies to the entire eth-xxx stack and could greatly improve typing

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.

1 participant