From 9757a119c1d435313518af0f5cd4ca443205b687 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mi=C5=A1o=20Belica?= Date: Sun, 1 Nov 2020 11:42:46 +0100 Subject: [PATCH] Drop official support for Python 2.7 --- .travis.yml | 13 +++---------- CHANGELOG.md | 1 + CONTRIBUTING.md | 6 +++--- README.md | 2 +- setup.cfg | 3 --- setup.py | 1 + sumy/_compat.py | 11 ----------- sumy/models/tf.py | 3 ++- sumy/summarizers/edmundson_key.py | 2 +- sumy/summarizers/lex_rank.py | 3 +-- 10 files changed, 13 insertions(+), 32 deletions(-) diff --git a/.travis.yml b/.travis.yml index c9f54cb9..5d3f5e1e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,15 +4,6 @@ cache: pip matrix: include: - - name: "Python 2.7 on Linux" - python: 2.7 - install: - - pip install -U pip wheel setuptools - - python setup.py install - # use "JPype1==0.7.1" (for kolnpy) because of Python 2 support - - pip install numpy tinysegmenter jieba "JPype1==0.7.1" konlpy - - python -c "import nltk; nltk.download('punkt')" - - pip install -U pytest codecov pytest-cov - name: "Python 3.5 on Linux" python: 3.5 - name: "Python 3.6 on Linux" @@ -22,9 +13,11 @@ matrix: - name: "Python 3.8 on Linux" dist: xenial python: 3.8 + - name: "Python 3.9 on Linux" + python: 3.9 # https://github.com/travis-ci/travis-ci/issues/2219#issuecomment-41804942 # https://snarky.ca/how-to-use-your-project-travis-to-help-test-python-itself/ - - name: "Python 3.9 Nightly on Linux" + - name: "Python 3.10 Nightly on Linux" dist: bionic python: nightly - name: "Pypy 3 on Linux" diff --git a/CHANGELOG.md b/CHANGELOG.md index a9f83245..abc95882 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## 0.9.0 (???) - Added support for Hebrew language [#150](https://github.com/miso-belica/sumy/issues/150). +- Dropped official support for Python 2.7. It should still work if you install Python 2 compatible dependencies. ## 0.8.1 (2019-05-19) - Open files for `PlaintextParser` in UTF-8 encoding [#123](https://github.com/miso-belica/sumy/pull/123) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index fbc950fb..f85a9a18 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -14,9 +14,9 @@ with your code. Nothing is written in stone but please try to respect them. 4. Please **respect the code style**. I don't want to set specific strict rules here because I think it's possible to respect style from all the code around. For example you will not use `'` for strings when you see that the code uses `"` ... -5. Make sure you have Python 2.7 or 3.5+ installed. Also Python 3.4 and maybe older versions work but since it reached - end-of-life you could have difficulties with the transitive dependencies that dropped the support already. - Then, install all the required dependencies and run the tests: +5. Make sure you have Python 3.5+ installed. Also, **Python 2.7/3.4** and maybe older versions work but since + they reached end-of-life you could have difficulties with the transitive dependencies that dropped the support + already. Then, install all the required dependencies and run the tests: ```sh $ pip install . diff --git a/README.md b/README.md index d8228406..27861571 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ There is a [good chance](docs/index.md#Tokenizer) it is. But if not it is [not t ## Installation -Make sure you have [Python](http://www.python.org/) 2.7/3.5+ and +Make sure you have [Python](http://www.python.org/) 3.5+ and [pip](https://crate.io/packages/pip/) ([Windows](http://docs.python-guide.org/en/latest/starting/install/win/), [Linux](http://docs.python-guide.org/en/latest/starting/install/linux/)) diff --git a/setup.cfg b/setup.cfg index 45c5c8ce..6bf880ab 100644 --- a/setup.cfg +++ b/setup.cfg @@ -7,9 +7,6 @@ tag = false [bumpversion:file:sumy/__init__.py] -[tool:pytest] -addopts = --quiet --tb=short --color=yes --cov=sumy --cov-report=term-missing --no-cov-on-fail - [pep8] max-line-length = 160 diff --git a/setup.py b/setup.py index 62a9645f..060889b2 100644 --- a/setup.py +++ b/setup.py @@ -105,6 +105,7 @@ "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", "Programming Language :: Python :: Implementation :: CPython", ], ) diff --git a/sumy/_compat.py b/sumy/_compat.py index c3ec98b5..11a01362 100644 --- a/sumy/_compat.py +++ b/sumy/_compat.py @@ -24,17 +24,6 @@ from itertools import filterfalse as ffilter -try: - from collections import Counter -except ImportError: - # Python < 2.7 - from itertools import groupby - - def Counter(iterable): - iterable = sorted(iterable) - return dict((key, len(tuple(group))) for key, group in groupby(iterable)) - - def unicode_compatible(cls): """ Decorator for unicode compatible classes. Method ``__unicode__`` diff --git a/sumy/models/tf.py b/sumy/models/tf.py index 1f73bf0a..9abfb561 100644 --- a/sumy/models/tf.py +++ b/sumy/models/tf.py @@ -5,9 +5,10 @@ import math +from collections import Counter from pprint import pformat from collections import Sequence -from .._compat import to_unicode, unicode, string_types, Counter +from .._compat import to_unicode, unicode, string_types class TfDocumentModel(object): diff --git a/sumy/summarizers/edmundson_key.py b/sumy/summarizers/edmundson_key.py index 772de9e4..75efeb95 100644 --- a/sumy/summarizers/edmundson_key.py +++ b/sumy/summarizers/edmundson_key.py @@ -3,7 +3,7 @@ from __future__ import absolute_import from __future__ import division, print_function, unicode_literals -from .._compat import Counter +from collections import Counter from ._summarizer import AbstractSummarizer diff --git a/sumy/summarizers/lex_rank.py b/sumy/summarizers/lex_rank.py index 9afa52d6..c6d230a5 100644 --- a/sumy/summarizers/lex_rank.py +++ b/sumy/summarizers/lex_rank.py @@ -9,9 +9,8 @@ import numpy except ImportError: numpy = None - +from collections import Counter from ._summarizer import AbstractSummarizer -from .._compat import Counter class LexRankSummarizer(AbstractSummarizer):