zach401 / acnportal

Research tools for the Adaptive Charging Network
BSD 3-Clause "New" or "Revised" License
75 stars 32 forks source link

DOC: Minimum Python Version? #106

Open chrisyeh96 opened 2 years ago

chrisyeh96 commented 2 years ago

Is there any minimum Python version required for ACN portal? Clearly, Python 3.6 is necessary for using f-strings. But ideally, if you target Python 3.7+, then you can simplify a lot of the typing annotations. For example, you can do things like the following in Python 3.7+:

from __future__ import annotations

def f(x: dict[str, int] | None = None) -> dict | None:
    return x

I didn't see any minimum Python version specified in the docs, so if that can be added (and ideally Python 3.7+), then I could help add appropriate typing annotations.

sunash commented 2 years ago

Hi @chrisyeh96, I'm okay with a 3.7 minimum version. I think it would probably need to be a new release, though. @zach401 what do you think?

I'm personally not familiar with future.annotations; are there any major functional differences between that and the typing package? Namely, I assume mypy allows either?

chrisyeh96 commented 2 years ago

The __future__ package in the Python standard library contains experimental ideas, essentially for beta testing. It enables the following 3 main changes:

In short, it just makes the typing annotations look cleaner. The benefits are purely cosmetic.

(There are actually a few other nontrivial situations where from __future__ import annotations actually helps with, but they are rare, and I won't explain them here.)