Skip to content

Commit

Permalink
Drop official support for Python 2.7
Browse files Browse the repository at this point in the history
  • Loading branch information
miso-belica committed Nov 1, 2020
1 parent 06b7aa5 commit 9757a11
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 32 deletions.
13 changes: 3 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 .
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/))
Expand Down
3 changes: 0 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
],
)
11 changes: 0 additions & 11 deletions sumy/_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__``
Expand Down
3 changes: 2 additions & 1 deletion sumy/models/tf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion sumy/summarizers/edmundson_key.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
3 changes: 1 addition & 2 deletions sumy/summarizers/lex_rank.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 9757a11

Please sign in to comment.