Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop support for python < 3.6. Fix tests #59

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@ branches:

matrix:
include:
- python: 2.7
env: TOXENV=py27
- python: 3.4
env: TOXENV=py34
- python: 3.5
env: TOXENV=py35
- python: 3.6
env: TOXENV=py36-legacy
- python: 3.6
env: TOXENV=py36
- python: 3.7
env: TOXENV=py37
- python: 3.8
env: TOXENV=py38
- python: 3.9
env: TOXENV=py39

addons:
apt:
Expand Down
6 changes: 6 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Changes
=======

0.3.7 (2020-12-29)
------------------

* declare Python 3.7, 3.8 and 3.9 support.
* drop support for Python < 3.6.

0.3.6 (2017-06-22)
------------------

Expand Down
2 changes: 1 addition & 1 deletion docs/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Make sure scikit-learn_ is installed, then run

pip install sklearn-crfsuite

sklearn-crfsuite requires Python 2.7+ or 3.3+.
sklearn-crfsuite requires Python 3.6+.


.. _scikit-learn: http://scikit-learn.org/
2 changes: 0 additions & 2 deletions requirements-rtd.txt

This file was deleted.

4 changes: 0 additions & 4 deletions requirements.txt

This file was deleted.

2 changes: 0 additions & 2 deletions setup.cfg

This file was deleted.

18 changes: 9 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

setup(
name='sklearn-crfsuite',
version='0.3.6',
version='0.3.7',
author='Mikhail Korobov',
author_email='[email protected]',
license='MIT license',
Expand All @@ -12,23 +12,23 @@
url='https://github.com/TeamHG-Memex/sklearn-crfsuite',
zip_safe=False,
packages=['sklearn_crfsuite'],
python_requires='>=3.6',
install_requires=[
"tqdm >= 2.0",
"six",
"tabulate",
"python-crfsuite >= 0.8.3"
"python-crfsuite >= 0.9.6",
"scikit-learn >= 0.20",
"tabulate >= 0.8.3",
"tqdm >= 4.29.0",
],
classifiers=[
'Development Status :: 3 - Alpha',
'License :: OSI Approved :: MIT License',
'Intended Audience :: Developers',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'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',
],
)
1 change: 0 additions & 1 deletion sklearn_crfsuite/_fileresource.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import os
import tempfile

Expand Down
6 changes: 0 additions & 6 deletions sklearn_crfsuite/compat.py

This file was deleted.

14 changes: 7 additions & 7 deletions sklearn_crfsuite/estimator.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import

from six.moves import zip
from tqdm import tqdm
import pycrfsuite
from sklearn.base import BaseEstimator
from tqdm import tqdm

from sklearn_crfsuite._fileresource import FileResource
from sklearn_crfsuite.trainer import LinePerIterationTrainer
from sklearn_crfsuite.compat import BaseEstimator


class CRF(BaseEstimator):
Expand Down Expand Up @@ -264,14 +261,17 @@ def __init__(self,
self.variance = variance
self.gamma = gamma

self.verbose = verbose
self.model_filename = model_filename
self.keep_tempfiles = keep_tempfiles
self.trainer_cls = trainer_cls

self.modelfile = FileResource(
filename=model_filename,
keep_tempfiles=keep_tempfiles,
suffix=".crfsuite",
prefix="model"
)
self.verbose = verbose
self.trainer_cls = trainer_cls
self.training_log_ = None

self._tagger = None
Expand Down
3 changes: 1 addition & 2 deletions sklearn_crfsuite/metrics.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division
from functools import wraps

from sklearn_crfsuite.utils import flatten
Expand Down Expand Up @@ -56,7 +55,7 @@ def flat_fbeta_score(y_true, y_pred, beta, **kwargs):
Return F-beta score for sequence items.
"""
from sklearn import metrics
return metrics.fbeta_score(y_true, y_pred, beta, **kwargs)
return metrics.fbeta_score(y_true, y_pred, beta=beta, **kwargs)


@_flattens_y
Expand Down
1 change: 0 additions & 1 deletion sklearn_crfsuite/scorers.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@

from sklearn_crfsuite import metrics


flat_accuracy = make_scorer(metrics.flat_accuracy_score)
sequence_accuracy = make_scorer(metrics.sequence_accuracy_score)
1 change: 0 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import pytest


Expand Down
3 changes: 1 addition & 2 deletions tests/test_crf.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@

from sklearn_crfsuite import CRF


ALGORITHMS = ["lbfgs", "l2sgd", "pa", "ap", "arow"]
ALGORITHMS = ["lbfgs", "l2sgd", "pa", "ap", "arow"]


@pytest.mark.parametrize("algorithm", ALGORITHMS)
Expand Down
3 changes: 0 additions & 3 deletions tests/test_metrics.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division

import pytest

from sklearn_crfsuite import metrics


y1 = [["x", "z", "y"], ["x", "x"]]
y2 = [["y", "z", "y"], ["x", "y"]]

Expand Down
17 changes: 11 additions & 6 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
[tox]
envlist = py27,py34,py35,py36
envlist = py36-legacy,py36,py37,py38,py39

[testenv]
usedevelop = True
deps=
pytest
pytest-cov
numpy

commands=
pip install -U wheel pip
pip install scipy
pip install scikit-learn
pip install -e .
py.test --doctest-modules --cov=sklearn_crfsuite --cov-report= {posargs: sklearn_crfsuite tests}

[testenv:py36-legacy]
deps=
pytest
pytest-cov
tqdm == 4.29.0
tabulate == 0.8.3
scikit-learn == 0.20
python-crfsuite == 0.9.6