imapclient
imapclient copied to clipboard
Add Type Annotations
When using tools such as mypy or type checking in vscode, type annotations would be useful.
Missing type annotations can also lead to errors when using strict type checking.
I'm definitely open to adding these. It's just a matter of someone finding the time.
Language support for type annotations starts at Python 3.5. Adding this directly into the codebase might not be easy to do while we are still supporting 2.7 and 3.4. I know of two alternatives:
- Use comment based type hints. This is usually frowned upon though, as far as I know.
- Create a type stub library for imapclient. Some popular libraries do that too. For example https://pypi.org/project/types-requests/.
Python 2 support will go away Real Soon Now but I'm not sure when we can realistically stop supporting Python 3.4. Some research is required into Linux distros etc that still ship Python 3.4.
A type stub library might be the easiest place to start.
First thing, I would love to have type-hints available! 👍
Python 2 support will go away Real Soon Now but I'm not sure when we can realistically stop supporting Python 3.4. Some research is required into Linux distros etc that still ship Python 3.4.
According to: https://endoflife.date/python
Python 2.7 was end of life on 1-Jan-2020 (over two years ago) Python 3.4 was end of life on 18-Mar-2019 (over three years ago) Python 3.5 was end of life on 13-Sep-202 (over one year ago) Python 3.6 was end of life on 23-Dec-2021 (over five months ago)
I think libraries should keep moving forward and people who are using end-of-life versions of Python can also use end-of-life versions of libraries. Which means it is okay to drop support for the old versions of Python moving forward, and users can always install the previous versions of imapclient in order to support their old version.
IMAPClient no longer supports Python 2 and 3.6 is the minimum supported version so PRs which add type annotations would be very welcome now ;-)
IMAPClient no longer supports Python 2 and 3.6 is the minimum supported version so PRs which add type annotations would be very welcome now ;-)
I'll try to get some time and start working on this in bits and pieces. But if anyone else wants to work on it feel free. My technique is to try to do multiple PRs where they add type-hints to one or two files at a time. That way it isn't so hard to review.
That sounds like a really sensible approach.
IMAPClient no longer supports Python 2 and 3.6 is the minimum supported version so PRs which add type annotations would be very welcome now ;-)
Note that we've just removed Python 3.7 as a support version.
Note that we've just removed Python 3.7 as a support version.
I think you meant Python 3.6 was removed. From #513 we dropped Python 3.6. But happy to also drop Python 3.7 at some point as it is also end-of-life.
Yes sorry, I meant 3.6
In regards to concerns over usage of the package in older versions of python you can keep track of recent downloads via https://pypistats.org/packages/imapclient