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

Improve typing around callbacks with dynamic keyword-arguments #176

Merged
merged 45 commits into from
Jan 31, 2023

Conversation

FasterSpeeding
Copy link
Owner

@FasterSpeeding FasterSpeeding commented Jan 2, 2022

Summary

This uses ParamSpec and Concatenate to partially type signatures which have a set number of positional arguments they must always accept but may by accepting further keyword arguments dynamically (either from DI or command arguments).

Checklist

  • I have run nox and all the pipelines have passed.
  • I have made unittests according to the code I have added/modified/deleted.

Related issues

@FasterSpeeding FasterSpeeding changed the title Improve typing around dependency injection using callbacks Improve typing around callbacks with dynamic keyword-arguments Jan 2, 2022
@FasterSpeeding FasterSpeeding force-pushed the task/better-callbacks branch 5 times, most recently from c9e1556 to 0c64eb5 Compare January 9, 2022 23:34
@FasterSpeeding
Copy link
Owner Author

FasterSpeeding commented Jan 10, 2022

TODO:

  • update the relevant doc strings to have more detail on the relevant callback's signature
  • typing extensions bug
  • pyright bugs

@FasterSpeeding FasterSpeeding force-pushed the task/better-callbacks branch 4 times, most recently from 3ba0ed8 to 840aa84 Compare January 13, 2022 17:51
@FasterSpeeding
Copy link
Owner Author

Probably gonna want to keep the old public-facing type hints but possibly keep them out of the __all__s?

@FasterSpeeding
Copy link
Owner Author

Check usages of hook sigs and CheckSig

@FasterSpeeding FasterSpeeding force-pushed the task/better-callbacks branch 2 times, most recently from 014a6ea to 837ec23 Compare August 20, 2022 00:25
@FasterSpeeding FasterSpeeding force-pushed the task/better-callbacks branch 2 times, most recently from 8f77254 to a6c0d66 Compare January 22, 2023 22:24
@github-actions
Copy link
Contributor

github-actions bot commented Jan 22, 2023

PR Preview Action ddfa7dc4b5f8fa02675fe5da02ae15c9722367f0
Preview removed because the pull request was closed.
2023-01-31 05:25 UTC

@FasterSpeeding
Copy link
Owner Author

FasterSpeeding commented Jan 23, 2023

This can't work on 3.9 thx to python/typing_extensions#48 so prob gonna drop support for 3.9 all together found a hack around

@FasterSpeeding FasterSpeeding marked this pull request as ready for review January 23, 2023 04:13
@FasterSpeeding FasterSpeeding mentioned this pull request Jan 23, 2023
2 tasks
tanjun/annotations.py Outdated Show resolved Hide resolved
@FasterSpeeding FasterSpeeding force-pushed the task/better-callbacks branch 2 times, most recently from a2d89de to fc198dd Compare January 25, 2023 08:04
tanjun/abc.py Outdated Show resolved Hide resolved
@FasterSpeeding FasterSpeeding merged commit 942b8b4 into master Jan 31, 2023
@FasterSpeeding FasterSpeeding deleted the task/better-callbacks branch January 31, 2023 05:24
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

1 participant