Add setup.py and release script for pypi
Hi @cjlin1, this PR is to add setup.py and release script for python bindings so that we can get them easily from pypi. The motivation behind this is:
- python-libsvm from ubuntu package list does not link to the active python environment (tried several times on different containers, and only linked to python 2.7). After inspecting the install script, the content of
/var/lib/dpkg/info/python-libsvm.listis this:
/.
/usr
/usr/share
/usr/share/pyshared
/usr/share/pyshared/svmutil.py
/usr/share/pyshared/svm.py
/usr/share/doc
/usr/share/doc/python-libsvm
/usr/share/doc/python-libsvm/copyright
/usr/share/doc/python-libsvm/README.gz
/usr/lib
/usr/lib/python2.7
/usr/lib/python2.7/dist-packages
/usr/share/doc/python-libsvm/changelog.Debian.gz
/usr/lib/python2.7/dist-packages/svmutil.py
/usr/lib/python2.7/dist-packages/svm.py
Though you can manually link libsvm binding to your active python environment simply by appending to sys as such:
>>> import sys
>>> sys.path.append('/usr/share/pyshared')
-
Package to fix similar problem is out there (e.g https://github.com/Salinger/libsvm-python), but would be nice that this binding is rather streamlined with this project and always updated to the current version. Had an issue over here (https://github.com/bukalapak/pybrisque/issues/4) because the binding version isn't compatible with the shared library (apparently it's fine using libsvm 3.21 distributed on Ubuntu 18.04 with python binding 3.14 on that particular project). If the binding is available on pypi for every version, we can easily match it with the shared library from distribution.
-
Having this binding on pypi would fix another problem on some situation: e.g in pybrisque (https://github.com/bukalapak/pybrisque/blob/master/setup.py), we want libsvm's python binding to be installed right away when user installs pybrisque, but since it's not on pypi, we had to do it using dependency-links. But since process-dependency-links is obsolete in pip >= 19, we couldn't do this anymore. Of course we can alway ask users to install the binding separately, but the former is just easier to the user.
I've put a test package from this PR here https://test.pypi.org/project/libsvm/, you can try to install with this command: pip install -i https://test.pypi.org/simple/ libsvm
Thank you. Cheers
In case it is too much hassle for you to provide the binding on pypi, I am happy to keep my fork up to date with the upstream and release the package on pypi..