slashmili / python-jalali

Jalali calendar binding for Python based on Python's datetime module
http://pypi.python.org/pypi/jdatetime/
Other
343 stars 49 forks source link

Drop Python < 3.7 support #117

Closed hramezani closed 2 years ago

hramezani commented 2 years ago

We got an issue in django-jalali that needs adding fold attribute to jdatetime.datetime. (fold has been added in python 3.6) fold is a keyword-only argument and Python 2.7 doesn't support keyword-only argument. So, we have to create multiple constructors for this class(one for python<3.5 and one for python >=3.6) or get in *kwargs which is not compatible with cpython implementation

we have to raise AttributeError when the fold is called in python < 3.6:

Python 2.7.18 (default, Jul 14 2021, 08:11:37) 
[GCC 10.2.1 20210110] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from datetime import datetime
>>> dt = datetime.today()
>>> dt.fold
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'datetime.datetime' object has no attribute 'fold'

The python version checking has to be done in __init__, replace, fold attribute and also in tests.

I think we can drop the older python version now.

What do you think @slashmili @farzadghanei

slashmili commented 2 years ago

well if you think so. I've lost track of python versions 😬

The only thing I suggest is to bump the version to 4.0 and drop the support for older pythons.