Skip to content

Commit 549afde

Browse files
committed
Merge branch 'master' of github.com:ahegel/python-crfsuite into float-embeddings
2 parents cf2203a + d900971 commit 549afde

24 files changed

+6466
-3797
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ MANIFEST
99
.ipynb_checkpoints
1010
conll2002-esp.crfsuite
1111
*.egg-info/
12+
.cache

.manylinux-cython.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env bash
2+
# Passes the right version of cython into update_cpp.sh for manylinux builds
3+
4+
shopt -s expand_aliases
5+
alias cython="${BIN}/cython"
6+
source ./update_cpp.sh

.manylinux-install.sh

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/usr/bin/env bash
2+
3+
# Kill the build if anything errors
4+
set -e -x
5+
6+
# Compile wheels
7+
for PYBIN in /opt/python/*/bin; do
8+
if [[ "${PYBIN}" == *"cp27"* ]] || \
9+
[[ "${PYBIN}" == *"cp35"* ]] || \
10+
[[ "${PYBIN}" == *"cp36"* ]] || \
11+
[[ "${PYBIN}" == *"cp37"* ]] || \
12+
[[ "${PYBIN}" == *"cp38"* ]];
13+
then
14+
"${PYBIN}/pip" install tox
15+
"${PYBIN}/pip" install -U cython
16+
export PATH="${PYBIN}:$PATH"
17+
(cd /io/ && export BIN="${PYBIN}" && bash ./.manylinux-cython.sh && "${PYBIN}/tox" -e manylinux)
18+
"${PYBIN}/pip" install -e /io/
19+
"${PYBIN}/pip" wheel /io/ -w wheelhouse/
20+
fi
21+
done
22+
23+
# Bundle external shared libraries into the wheels
24+
for whl in wheelhouse/*.whl; do
25+
auditwheel repair "$whl" -w /io/wheelhouse/
26+
done
27+
28+
# Install new wheels and test
29+
for PYBIN in /opt/python/*/bin; do
30+
if [[ "${PYBIN}" == *"cp27"* ]] || \
31+
[[ "${PYBIN}" == *"cp35"* ]] || \
32+
[[ "${PYBIN}" == *"cp36"* ]] || \
33+
[[ "${PYBIN}" == *"cp37"* ]] || \
34+
[[ "${PYBIN}" == *"cp38"* ]];
35+
then
36+
"${PYBIN}/pip" uninstall -y python-crfsuite
37+
"${PYBIN}/pip" install python-crfsuite --no-index -f /io/wheelhouse
38+
"${PYBIN}/pip" install pytest
39+
"${PYBIN}/pytest" /io/tests --doctest-modules
40+
fi
41+
done
42+
43+
# If everything works, upload wheels to PyPi
44+
travis=$( cat /io/.travis_tag )
45+
SAMPLE_PYBIN="/opt/python/cp37-cp37m/bin"
46+
if [[ $travis ]]; then
47+
"${SAMPLE_PYBIN}/pip" install twine;
48+
"${SAMPLE_PYBIN}/twine" upload --config-file /io/.pypirc /io/wheelhouse/*.whl;
49+
fi

.travis.yml

Lines changed: 104 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,109 @@
11
language: python
2-
python: 3.5
3-
sudo: false
4-
env:
5-
- TOXENV=py26
6-
- TOXENV=py27
7-
- TOXENV=py33
8-
- TOXENV=py34
9-
- TOXENV=py35
2+
matrix:
3+
include:
4+
- os: linux
5+
python: 3.8
6+
env: TOXENV=py38
7+
- os: linux
8+
python: 3.7
9+
env: TOXENV=py37
10+
- os: linux
11+
python: 3.6
12+
env: TOXENV=py36
13+
- os: linux
14+
python: 3.5
15+
env: TOXENV=py35
16+
- os: linux
17+
python: 2.7
18+
env: TOXENV=py27
19+
- os: osx
20+
language: generic
21+
env:
22+
- PYTHON='3.8.2'
23+
- TOXENV=py38
24+
- os: osx
25+
language: generic
26+
env:
27+
- PYTHON='3.7.7'
28+
- TOXENV=py37
29+
- os: osx
30+
language: generic
31+
env:
32+
- PYTHON='3.6.2'
33+
- TOXENV=py36
34+
- os: osx
35+
language: generic
36+
env:
37+
- PYTHON='2.7.13'
38+
- TOXENV=py27
39+
- sudo: required
40+
services:
41+
- docker
42+
env: DOCKER_IMAGE=quay.io/pypa/manylinux1_x86_64
43+
- sudo: required
44+
services:
45+
- docker
46+
env: DOCKER_IMAGE=quay.io/pypa/manylinux1_i686
47+
PRE_CMD=linux32
48+
49+
branches:
50+
only:
51+
- master
52+
- /^\d\.[\d.]+$/
53+
54+
before_install:
55+
- |
56+
if [[ $PYTHON && "$TRAVIS_OS_NAME" == "osx" ]]; then
57+
brew update;
58+
brew install openssl readline;
59+
brew outdated pyenv || brew upgrade pyenv;
60+
brew install pyenv-virtualenv;
61+
pyenv install $PYTHON;
62+
export PYENV_VERSION=$PYTHON;
63+
export PATH="/Users/travis/.pyenv/shims:${PATH}";
64+
pyenv-virtualenv venv;
65+
source venv/bin/activate;
66+
python --version;
67+
fi;
68+
echo [distutils] > ~/.pypirc;
69+
echo index-servers=pypi >> ~/.pypirc;
70+
echo [pypi] >> ~/.pypirc;
71+
echo username=kmike >> ~/.pypirc;
72+
echo password=$PYPIPASSWORD >> ~/.pypirc;
73+
touch .travis_tag;
74+
if [[ $DOCKER_IMAGE ]]; then
75+
echo $TRAVIS_TAG > .travis_tag;
76+
cat ~/.pypirc > .pypirc;
77+
fi;
78+
1079
install:
11-
- pip install tox
12-
- pip install -U cython
80+
- |
81+
if [[ $DOCKER_IMAGE ]]; then
82+
docker pull $DOCKER_IMAGE &&
83+
docker run --rm -v `pwd`:/io $DOCKER_IMAGE $PRE_CMD /io/.manylinux-install.sh;
84+
exit;
85+
else
86+
pip install --upgrade pip;
87+
pip install -r requirements-doc.txt;
88+
pip install tox;
89+
pip install -U cython;
90+
fi;
91+
1392
script:
1493
- ./update_cpp.sh
1594
- tox
95+
96+
after_success:
97+
- pip install wheel twine
98+
- if [[ $TRAVIS_TAG && "$TRAVIS_OS_NAME" == "osx" ]]; then
99+
python -W ignore setup.py bdist_wheel;
100+
twine upload dist/*;
101+
fi;
102+
- if [[ $TRAVIS_TAG && "$TRAVIS_OS_NAME" == "linux" ]]; then
103+
python -W ignore setup.py sdist;
104+
twine upload dist/*;
105+
fi;
106+
107+
env:
108+
global:
109+
- secure: HQDMJlzbWMSuA2YANijtacm9croR5e9BTSKq08QDp1Fc33BGLjDWXeKPOcZSx3LR9AdCN9CLA2NQn3hQ8wViibrCmn5kUFdzIDxpFgPrq5fvOTU43Kf8o/DbDZxK2Loqw7LwskwxTpJZOnp2gwF6kNJiC4hygI9HID8qqs9l480=

CHANGES.rst

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,66 @@
11
Changes
22
=======
33

4+
0.9.7 (2020-03-15)
5+
------------------
6+
7+
* Python 3.4 is no longer supported (it may work, but CI is disabled)
8+
* Python 3.8 support
9+
* fixed installation issues on OS X (thanks @kvinwang)
10+
* make it easier for distributions to have a reproducible build
11+
(thanks @bmwiedemann)
12+
13+
0.9.6 (2018-08-01)
14+
------------------
15+
16+
* Python 3.7 support (thanks @fgregg, @danmacnaughtan and @fuhrysteve).
17+
* Python 3.3 support is dropped.
18+
* new Tagger.open_inmemory method which allows to load tagger data
19+
without having a file on-disk (thanks @lucywang000).
20+
* license information is added to setup.py (thanks @nils-werner).
21+
22+
0.9.5 (2017-09-05)
23+
------------------
24+
25+
* Python 3.6 wheels for Windows (thanks @fgregg).
26+
27+
0.9.4 (2017-09-04)
28+
------------------
29+
30+
* Packaging fix (thanks @fgregg).
31+
32+
0.9.3 (2017-09-03)
33+
------------------
34+
35+
* Fixed compatibility with Python 3.5+ on Windows (thanks @fgregg);
36+
* CRFSuite C++ library is updated to latest version, this fixes several
37+
memory leaks and improves performance (thanks @fgregg);
38+
* extension is rebuilt with Cython 0.26.1.
39+
40+
0.9.2 (2017-05-04)
41+
------------------
42+
43+
* binary wheels for OS X and Linux (thanks @jeancochrane).
44+
45+
0.9.1 (2016-12-19)
46+
------------------
47+
48+
This is a release without changes in functionality.
49+
50+
* Repository is moved to https://github.com/scrapinghub/python-crfsuite;
51+
* We're now providing Windows wheels for Python 2.7, 3.3. and 3.4.
52+
53+
0.9 (2016-12-08)
54+
----------------
55+
56+
* Python 2.6 support is dropped;
57+
* CRFSuite C++ library is updated to a more recent commit;
58+
* improved Windows support (thanks @fgregg);
59+
* fixed building with gcc < 5.0.0 (thanks @kantan2015);
60+
* extension is rebuilt with Cython 0.25.1; this improves PyPy compatibility
61+
(but we're not quite there yet).
62+
* docs: trainer.logparser example is added to the notebook (thanks @samgalen).
63+
464
0.8.4 (2015-11-25)
565
------------------
666

LICENSE.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2014-2017 ScrapingHub Inc. and contributors.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
include LICENSE.txt
12
include README.rst
23
include CHANGES.rst
34
include update_cpp.sh
4-
include include/inttypes.h
55

66
recursive-include crfsuite *
77
recursive-include liblbfgs *

README.rst

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,40 @@
22
python-crfsuite
33
===============
44

5-
.. image:: https://travis-ci.org/tpeng/python-crfsuite.svg?branch=master
6-
:target: https://travis-ci.org/tpeng/python-crfsuite
5+
.. image:: https://travis-ci.org/scrapinghub/python-crfsuite.svg?branch=master
6+
:target: https://travis-ci.org/scrapinghub/python-crfsuite
77

8-
.. image:: https://ci.appveyor.com/api/projects/status/github/tpeng/python-crfsuite?branch=master&svg=true
9-
:target: https://ci.appveyor.com/project/kmike/python-crfsuite
8+
.. image:: https://ci.appveyor.com/api/projects/status/uaq4sw8tc0oojr4v?svg=true
9+
:target: https://ci.appveyor.com/project/kmike/python-crfsuite-mhi5h
10+
11+
.. image:: https://img.shields.io/pypi/v/python-crfsuite.svg?style=flat-square
12+
:target: https://pypi.python.org/pypi/python-crfsuite
13+
:alt: pypi Version
14+
15+
.. image:: https://anaconda.org/conda-forge/python-crfsuite/badges/version.svg
16+
:target: https://anaconda.org/conda-forge/python-crfsuite
17+
:alt: conda Version
1018

1119
python-crfsuite is a python binding to CRFsuite_.
1220

1321
Installation
1422
============
1523

16-
::
24+
Using ``pip``::
1725

1826
pip install python-crfsuite
1927

28+
Using ``conda``::
29+
30+
conda install -c conda-forge python-crfsuite
31+
2032
Usage
2133
=====
2234

2335
See docs_ and an example_.
2436

2537
.. _docs: http://python-crfsuite.rtfd.org/
26-
.. _example: http://nbviewer.ipython.org/github/tpeng/python-crfsuite/blob/master/examples/CoNLL%202002.ipynb
38+
.. _example: https://github.com/scrapinghub/python-crfsuite/blob/master/examples/CoNLL%202002.ipynb
2739

2840
See Also
2941
========
@@ -36,12 +48,12 @@ API similar to scikit-learn.
3648
Contributing
3749
============
3850

39-
* Source code: https://github.com/tpeng/python-crfsuite
40-
* Issue tracker: https://github.com/tpeng/python-crfsuite/issues
51+
* Source code: https://github.com/scrapinghub/python-crfsuite
52+
* Issue tracker: https://github.com/scrapinghub/python-crfsuite/issues
4153

4254
Feel free to submit ideas, bugs reports, pull requests or regular patches.
4355

44-
In order to run tests, install Cython_ (> 0.20.1) and tox_, then type
56+
In order to run tests, install Cython_ (> 0.24.1) and tox_, then type
4557

4658
::
4759

@@ -54,14 +66,17 @@ Please don't commit generated cpp files in the same commit as other files.
5466
.. _Cython: http://cython.org/
5567
.. _tox: http://tox.testrun.org
5668

57-
Authors
58-
=======
69+
Authors and Contributors
70+
========================
5971

60-
* Terry Peng <pengtaoo@gmail.com>
61-
* Mikhail Korobov <kmike84@gmail.com>
72+
Original authors are Terry Peng <pengtaoo@gmail.com> and
73+
Mikhail Korobov <kmike84@gmail.com>. Many other people contributed;
74+
some of them can be found at github Contributors_ page.
6275

6376
Bundled CRFSuite_ C/C++ library is by Naoaki Okazaki & contributors.
6477

78+
.. _Contributors: https://github.com/scrapinghub/python-crfsuite/graphs/contributors
79+
6580
License
6681
=======
6782

@@ -73,10 +88,13 @@ CRFsuite_ library is licensed under BSD license.
7388
Alternatives
7489
============
7590

76-
* https://github.com/jakevdp/pyCRFsuite - uses C API instead of C++ API;
77-
allows to use scipy sparse matrices as an input.
7891
* https://github.com/chokkan/crfsuite/tree/master/swig/python - official
7992
Python wrapper, exposes C++ API using SWIG.
93+
* https://github.com/jakevdp/pyCRFsuite - uses C API instead of C++ API;
94+
allows to use scipy sparse matrices as an input. At the time of writing
95+
it is unmaintained.
96+
* https://github.com/bosondata/crfsuite-rs - uses a Rust wrapper with CFFI instead of C++ API;
97+
allows to tag with GIL released for better performance.
8098

8199
This package (python-crfsuite) wraps CRFsuite C++ API using Cython.
82100
It is faster than official SWIG wrapper and has a simpler codebase than

0 commit comments

Comments
 (0)