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

Refinement of type annotations to reflect move to Python>=3.7 #683

Merged
merged 2 commits into from
Nov 19, 2024

Conversation

thatfloflo
Copy link
Contributor

@thatfloflo thatfloflo commented Apr 5, 2023

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

  • This PR generally brings the type annotations up to the feature set of Python 3.7 and tidies them in places.
  • Additionally it now introduces a 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.
  • In the process of the work to _start_args / OptionsDictT, I have also moved the defaults into the definition of eel.start(), so that users will get proper type hints and function signatures covering all the possible start args.

Additional improvements

  • Dropped dependency on whichcraft in favour of shutil.which(), since this is part of the standard library with all supported Python versions now (updated in ba08df0 -> 7f6d51e).
  • To preserve the information on the _start_args that was present in comments in the source, eel.start() was augmented with a proper docstring to document each of the arguments.
  • Because having only eel.start() with a proper docstring seemed odd, I've added proper docstrings to the other publicly exposed functions, too.
  • All new docstrings are in reStructuredText so that they will be readily compatible with Sphinx autodoc, should Sphinx documentation be produced in the future.

@thatfloflo thatfloflo force-pushed the typing-improvements branch 4 times, most recently from 831eaf7 to 23b6f3e Compare April 25, 2023 18:23
@samuelhwilliams
Copy link
Collaborator

This is a really excellent improvement @thatfloflo - and I'm only sorry that this repo has had a significant lack of attention/maintenance.

I still can't personally commit a lot of time to maintaining this, but maybe you can chat with @ChrisKnott and consider getting maintainer rights.

@thatfloflo
Copy link
Contributor Author

Thanks @samuelhwilliams, I think I could find some time to help with maintaining this. In terms of getting in touch with @ChrisKnott (just because he seems not to have been active on GitHub recently), do you think there's a point sending a message to the email given at PyPI (python-eel at protonmail), or does that just end up with you?

Also thanks for all the work you have put in! I think everybody appreciates that and we all understand that sometimes there just isn't enough spare time (and energy) after everything that ought to come first in life :)

@samuelhwilliams
Copy link
Collaborator

Possibly worth replying in this thread, which should at least ping him 👀 #718 (comment)

@samuelhwilliams samuelhwilliams merged commit 7c3f6ad into python-eel:main Nov 19, 2024
39 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.

2 participants