Refinement of type annotations to reflect move to Python>=3.7 #683
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR #577 introduced type annotations, but had to do some fiddly bits to work around some of the limitations to type annotations in Python 3.6, such as the unavailability of
__future__.annotations
. Eel has since dropped support for Python 3.6.Typing refinements
TypedDict
solution to_start_args
/OptionsDictT
. This allowed for further type narrowing and better typing checks (with at least one type mismatch caught and fixed in the process), as well as passing the advantages of reporting typing issues with start_args back to users in a more insightful manner._start_args
/OptionsDictT
, I have also moved the defaults into the definition ofeel.start()
, so that users will get proper type hints and function signatures covering all the possible start args.Additional improvements
whichcraft
in favour ofshutil.which()
, since this is part of the standard library with all supported Python versions now (updated in ba08df0 -> 7f6d51e).eel.start()
was augmented with a proper docstring to document each of the arguments.eel.start()
with a proper docstring seemed odd, I've added proper docstrings to the other publicly exposed functions, too.