Skip to content

Commit

Permalink
Drop support for Python 3.5, 3.6 versions (#1097)
Browse files Browse the repository at this point in the history
* Drop support for Python 3.5, 3.6 versions

* fix extras_require
  • Loading branch information
Laerte committed Nov 14, 2022
1 parent 417cccd commit 122037f
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 34 deletions.
6 changes: 0 additions & 6 deletions .github/workflows/main.yml
Expand Up @@ -17,12 +17,6 @@ jobs:
- python-version: 3.8
env:
TOXENV: flake8
- python-version: 3.5
env:
TOXENV: py
- python-version: 3.6
env:
TOXENV: py
- python-version: 3.7
env:
TOXENV: py
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Expand Up @@ -156,7 +156,7 @@ are executed, you can do so through the
Installation
------------

Dateparser supports Python >= 3.5. You can install it by doing:
Dateparser supports Python >= 3.7. You can install it by doing:

::

Expand Down
12 changes: 2 additions & 10 deletions dateparser/date.py
Expand Up @@ -303,12 +303,7 @@ def __setitem__(self, k, v):
setattr(self, k, v)

def __repr__(self):
if sys.version_info < (3, 6): # python 3.5 compatibility
properties_text = "date_obj={}, period={}, locale={}".format(
self.date_obj.__repr__(), self.period.__repr__(), self.locale.__repr__()
)
else:
properties_text = ', '.join('{}={}'.format(prop, val.__repr__()) for prop, val in self.__dict__.items())
properties_text = ', '.join('{}={}'.format(prop, val.__repr__()) for prop, val in self.__dict__.items())

return '{}({})'.format(
self.__class__.__name__, properties_text
Expand Down Expand Up @@ -465,10 +460,7 @@ def get_date_data(self, date_string, date_formats=None):

def get_date_tuple(self, *args, **kwargs):
date_data = self.get_date_data(*args, **kwargs)
if sys.version_info < (3, 6): # python 3.5 compatibility
fields = ['date_obj', 'period', 'locale']
else:
fields = date_data.__dict__.keys()
fields = date_data.__dict__.keys()
date_tuple = collections.namedtuple('DateData', fields)
return date_tuple(**date_data.__dict__)

Expand Down
5 changes: 1 addition & 4 deletions dateparser_cli/utils.py
Expand Up @@ -5,10 +5,7 @@
DEFAULT_DIR_NAME = 'dateparser_models'
DEFAULT_UNIX_CACHE_DIR = '~/.cache'

if sys.version_info < (3, 6): # python 3.5 compatibility
DEFAULT_WINDOWS_CACHE_DIR = os.path.join(str(Path.home()), "AppData", "Roaming")
else:
DEFAULT_WINDOWS_CACHE_DIR = os.path.join(Path.home(), "AppData", "Roaming")
DEFAULT_WINDOWS_CACHE_DIR = os.path.join(Path.home(), "AppData", "Roaming")


if sys.platform.startswith('win'):
Expand Down
7 changes: 2 additions & 5 deletions setup.py
Expand Up @@ -34,23 +34,20 @@
'console_scripts': ['dateparser-download = dateparser_cli.cli:entrance'],
},
extras_require={
'calendars:python_version<"3.6"': ['convertdate'],
'calendars:python_version>="3.6"': ['hijri-converter', 'convertdate'],
'calendars': ['hijri-converter', 'convertdate'],
'fasttext': ['fasttext'],
'langdetect': ['langdetect'],
},
license="BSD",
zip_safe=False,
keywords='dateparser',
python_requires='>=3.5',
python_requires='>=3.7',
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Natural Language :: English',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
Expand Down
9 changes: 1 addition & 8 deletions tests/test_hijri.py
Expand Up @@ -6,16 +6,9 @@

from tests import BaseTestCase

is_python_supported = sys.version_info >= (3, 6)
from dateparser.calendars.hijri import HijriCalendar

try:
from dateparser.calendars.hijri import HijriCalendar
except ImportError:
if is_python_supported:
raise


@unittest.skipUnless(is_python_supported, "hijri-converter doesn't support Python<3.6")
class TestHijriParser(BaseTestCase):

def setUp(self):
Expand Down

0 comments on commit 122037f

Please sign in to comment.