Skip to content

Commit e668c4d

Browse files
committed
Make it a PyPI package.
1 parent 327e411 commit e668c4d

File tree

3 files changed

+54
-8
lines changed

3 files changed

+54
-8
lines changed

MANIFEST.in

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
include pydensecrf/eigen.pxd
2+
include pydensecrf/eigen.pyx
3+
include pydensecrf/densecrf.pxd
4+
include pydensecrf/densecrf.pyx
5+
recursive-include pydensecrf/densecrf *

README.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ and provide a link to this repository as a footnote or a citation.
1616
Installation
1717
============
1818

19-
You can install this using `pip` by executing:
19+
The package is on PyPI, so simply run `pip install pydensecrf` to install it.
20+
21+
If you want the newest and freshest version, you can install it by executing:
2022

2123
```
2224
pip install git+https://github.com/lucasb-eyer/pydensecrf.git
@@ -235,3 +237,18 @@ Common Problems
235237
---------------------------------
236238

237239
If while importing pydensecrf you get an error about some undefined symbols (for example `.../pydensecrf/densecrf.so: undefined symbol: _ZTINSt8ios_base7failureB5cxx11E`), you most likely are inadvertently mixing different compilers or toolchains. Try to see what's going on using tools like `ldd`. If you're using Anaconda, [running `conda install libgcc` might be a solution](https://github.com/lucasb-eyer/pydensecrf/issues/28).
240+
241+
Maintaining
242+
===========
243+
244+
These are instructions for maintainers about how to release new versions. (Mainly instructions for myself.)
245+
246+
```
247+
# Go increment the version in setup.py
248+
> python setup.py build_ext
249+
> python setup.py sdist
250+
> twine upload dist/pydensecrf-VERSION_NUM.tar.gz
251+
```
252+
253+
And that's it. At some point, it would be cool to automate this on [TravisCI](https://docs.travis-ci.com/user/deployment/pypi/), but not worth it yet.
254+
At that point, looking into [creating "manylinux" wheels](https://github.com/pypa/python-manylinux-demo) might be nice, too.

setup.py

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,43 @@
11
# coding: UTF-8
2-
from distutils.core import setup
3-
from Cython.Build import cythonize
2+
from setuptools import setup
43

54
# TODO:
65
# - Wrap learning.
76
# - Make LabelCompatibility, UnaryEnergy, PairwisePotential extensible? (Maybe overkill?)
87

8+
9+
# If Cython is available, build using Cython.
10+
# Otherwise, use the pre-built (by someone who has Cython, i.e. me) wrapper `.cpp` files.
11+
try:
12+
from Cython.Build import cythonize
13+
ext_modules = cythonize(['pydensecrf/eigen.pyx', 'pydensecrf/densecrf.pyx'])
14+
except ImportError:
15+
from setuptools.extension import Extension
16+
ext_modules = [
17+
Extension("pydensecrf/eigen", ["pydensecrf/eigen.cpp", "pydensecrf/eigen_impl.cpp"], language="c++", include_dirs=["pydensecrf/densecrf/include"]),
18+
Extension("pydensecrf/densecrf", ["pydensecrf/densecrf.cpp", "pydensecrf/densecrf/src/densecrf.cpp", "pydensecrf/densecrf/src/unary.cpp", "pydensecrf/densecrf/src/pairwise.cpp", "pydensecrf/densecrf/src/permutohedral.cpp", "pydensecrf/densecrf/src/optimization.cpp", "pydensecrf/densecrf/src/objective.cpp", "pydensecrf/densecrf/src/labelcompatibility.cpp", "pydensecrf/densecrf/src/util.cpp", "pydensecrf/densecrf/external/liblbfgs/lib/lbfgs.c"], language="c++", include_dirs=["pydensecrf/densecrf/include", "pydensecrf/densecrf/external/liblbfgs/include"]),
19+
]
20+
921
setup(
1022
name="pydensecrf",
11-
version="0.1",
12-
description="A python interface to Philipp Krähenbühl's fully-connected CRF code.",
23+
version="1.0rc2",
24+
description="A python interface to Philipp Krähenbühl's fully-connected (dense) CRF code.",
25+
long_description="See the README.md at http://github.com/lucasb-eyer/pydensecrf",
1326
author="Lucas Beyer",
1427
author_email="[email protected]",
1528
url="http://github.com/lucasb-eyer/pydensecrf",
16-
ext_modules=cythonize(['pydensecrf/eigen.pyx', 'pydensecrf/densecrf.pyx']),
17-
packages=["pydensecrf"]
29+
ext_modules=ext_modules,
30+
packages=["pydensecrf"],
31+
setup_requires=['cython>=0.22'],
32+
classifiers=[
33+
"Intended Audience :: Developers",
34+
"License :: OSI Approved :: MIT License",
35+
"Development Status :: 5 - Production/Stable",
36+
"Programming Language :: C++",
37+
"Programming Language :: Python",
38+
"Operating System :: POSIX :: Linux",
39+
"Topic :: Software Development :: Libraries",
40+
"Topic :: Scientific/Engineering :: Image Recognition",
41+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
42+
],
1843
)
19-

0 commit comments

Comments
 (0)