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

Add Type Annotations #463

Open
JeremyMoeglich opened this issue Dec 31, 2021 · 11 comments
Open

Add Type Annotations #463

JeremyMoeglich opened this issue Dec 31, 2021 · 11 comments

Comments

@JeremyMoeglich
Copy link

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.

@mjs
Copy link
Owner

mjs commented Jan 25, 2022

I'm definitely open to adding these. It's just a matter of someone finding the time.

@BoniLindsley
Copy link
Contributor

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/.

@mjs
Copy link
Owner

mjs commented Jan 25, 2022

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.

@JohnVillalovos
Copy link
Contributor

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.

@mjs
Copy link
Owner

mjs commented Aug 16, 2023

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 ;-)

@JohnVillalovos
Copy link
Contributor

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.

@mjs
Copy link
Owner

mjs commented Aug 19, 2023

That sounds like a really sensible approach.

@mjs
Copy link
Owner

mjs commented Aug 19, 2023

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.

@JohnVillalovos
Copy link
Contributor

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.

JohnVillalovos added a commit to JohnVillalovos/imapclient that referenced this issue Aug 20, 2023
JohnVillalovos added a commit to JohnVillalovos/imapclient that referenced this issue Aug 20, 2023
@mjs
Copy link
Owner

mjs commented Aug 20, 2023

Yes sorry, I meant 3.6

@nhairs
Copy link

nhairs commented Jan 2, 2024

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

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

No branches or pull requests

5 participants