BTrack
BTrack copied to clipboard
Update Python bindings to support Python 3 (tested on Python 3.7)
First off, this is a great project! Thanks for making it open source.
I played around with it a bit, and I'd like to make a PR to update the python binding to support 3.X, as Python 2 is deprecated as of this year.
The main changes required were porting some C Python extensions over. Specifically, the Py_InitModule
constructor has been replaced. Now I create a PyModuleDef
structure and then pass a reference to it to PyModule_Create
.
Additionally, I had to change the entry point of the compilation, by explicitly converting the application argument from char
to wchar_t
.
Other minor changes include:
- updating the
.gitignore
to ignore precompiled python files. - updating the README and INSTALL markdown files.
- adding a
requirements.txt
file forpip
. - updating the
example.py
(scikits.audiolab.wavread
is also deprecated). - minor formatting, as per the PEP8 standard.
Thanks, confirmed this is working for Python 3.8 as well.
Have you considered making it support both, by using ifdefs? E.g.
#if PY_MAJOR_VERSION >= 3
http://python3porting.com/cextensions.html