upstash / redis-py

HTTP based Python Redis Client for Serverless and Edge Functions
https://docs.upstash.com/redis
MIT License
29 stars 3 forks source link

Python version #3

Closed chronark closed 1 year ago

chronark commented 1 year ago
  • The minimum supported Python version of 3.11 is too recent. Most of the ecosystem have support for Python 3.8 and even for 3.7. Given that we are very close to the end-of-life of Python 3.7, I believe we can set to minimum Python version to 3.8.
chronark commented 1 year ago

As I understood, this will break the types cc @TudorZgimbau

TudorZgimbau commented 1 year ago

Most of the ecosystem have support for Python 3.8 and even for 3.7.

Most of the serverless ecosystem has support for 3.9 and above, and it's our primary target.

The minimum supported Python version of 3.11 is too recent.

We also support 3.10, but this is probably related to the branch confusion.

I believe we can set to minimum Python version to 3.8.

3.8 I doubt and don't see a good reason to. With 3.9 however, we would have to change most of the typing syntax the SDK uses. We have already dropped some types to be compatible with 3.10 and I thought that it's not a bad thing that we have used modern syntax, especially since this is a relatively new project.

We should also think about the users we are targeting. Correct me if I'm wrong, but upgrading from 3.9 to 3.10 in a serverless environment seems way more doable than us taking the technical debt of upgrading the SDK to use modern typing later.

And I do not exclude the idea of producing a 3.9-compatible version, especially if an enterprise client is blocked by that. It just must be worth the time to produce and maintain two separate versions in parallel, if you don't want to simply downgrade (which I wouldn't recommend).

mdumandag commented 1 year ago

What is exactly stopping us from supporting Python 3.8? If it is just for things like str | int instead of typing.Union[str, int], or list[str] instead of typing.List[str], as this is a library, I would certainly give up on these nicer syntaxes for the potential of supporting more Python versions.

If there are fundemental things you use that are only available in Python 3.10+, we might consider what you suggested.

TudorZgimbau commented 1 year ago

I quickly read through the changelogs and there might be some typing problems with generics in the standard collection and union types for dict, both related to 3.9. I haven't tested this yet, but I'd say only 3.9 and above is doable.

mdumandag commented 1 year ago

Can you post couple of such problems so that I can also take a look as well?

TudorZgimbau commented 1 year ago

Nvm this sorry, I checked those PEP's in detail and things seem ok. Some manual testing might be beneficial tho.

TudorZgimbau commented 1 year ago

Closed by https://github.com/upstash/redis-python/pull/19.