pyjanitor
pyjanitor copied to clipboard
Update Python to be minimum 3.9
This PR updates our minimum Python version to be 3.9.
Key changes:
- We matrix Python version testing across 3.9, and 3.10 (current stable version and two before).
- We note everywhere relevant that the minimum Python version should be 3.9.
@Zeroto521 I just realized this PR might overlap with your other PR #1143. I'll just use the PR to test some syntax things needed to make Python >=3.8 work. After that, we can discard my PR, and you can pick-and-choose whatever changes seem to make sense into your PR.
🚀 Deployed on https://deploy-preview-1157--pyjanitor.netlify.app
Codecov Report
Merging #1157 (57c901b) into dev (78d4297) will increase coverage by
0.00%
. The diff coverage isn/a
.
:exclamation: Current head 57c901b differs from pull request most recent head f1eb10f. Consider uploading reports for the commit f1eb10f to get more accurate results
@@ Coverage Diff @@
## dev #1157 +/- ##
=======================================
Coverage 97.34% 97.34%
=======================================
Files 77 77
Lines 3240 3244 +4
=======================================
+ Hits 3154 3158 +4
Misses 86 86
Directly requires py3.9. Would that be a little bit aggressive? pandas main branch still requires py3.8. I'm okay to deprecate py3.6 and py3.7.
Good question, @Zeroto521. Type annotations in Python 3.9 are more flexible, i.e. we can use built-in tuple
or list
as types like this:
def func(df, arg1: tuple[int]):
pass
We can drop down to Python 3.8 if we fix the types to be:
from typing import Tuple # (and/or List)
def func(df, arg1: Tuple[int]):
pass
Py3.7+ with __future__
also has that feature.
from __future__ import annotations
int_array: list[int] = list(range(3))
None_or_bool: bool | None = True # equals to `Optional[bool]`
I also suggest using asottile's pyupgrade
to upgrade whatever syntax we can to the minimum version we are supporting. I also suggest sticking to py38 for now instead of jumping straight to py39. py37 EOL is coming this year.
Less manual work :)
@thatlittleboy I'm in favour of more automation! 😺
Lemme take care of that in a bit.
This PR is going stale. I'm going to close it and re-do it with minimum py38, as per @Zeroto521's and @thatlittleboy's suggestions.