Closed concernedrat closed 8 years ago
Hi @georgerb, great! There is a branch which contains an initial port to Python 3 available at: https://github.com/eomahony/Numberjack/tree/Python3 Maybe you can give that a try and let us know of any issues?
Ideally, we would like to have a single code base supporting both but we haven't had the resources to investigate this properly. We're using swig for the C++ interfaces, so I haven't investigated if we will run into any issues there etc. If you have any experience with this type of thing, it would be great to hear.
To unify the codebases Python 2.7.x provides the future package, this helps with the migration and maintains compatibility with previous versions, I will do my research with SWIG and let you.
I'm also interested in seeing Numberjack work for py3. I have a little experience wrapping C++ interfaces with SWIG, including supporting python2 and python3 with the same codebase: https://github.com/rdeits/swig-eigen-numpy and https://github.com/rdeits/swig-autodiff All my build system experience is in CMake, but your setup.py looks pretty readable. Essentially, the only thing you'll likely need to do is pass the -py3
flag to swig.
You also may come across the fact that python's division operators got renamed a bit in py3 (because of the change from integer division to float division for /
). In my SWIG interface file, I had to add the following in order to wrap operator / for a C++ class in python3:
#ifdef SWIGPYTHON3
%rename(__truediv__) *::operator/;
#endif
The SWIGPYTHON3
symbol is one that I manually define in my CMakeLists.txt when python3 is used.
Other than that, I think everything should just work (famous last words?).
I'll take a look at your branch and see what I can do.
Actually, it turns out that python's setup.py
appears to just do the right thing under the hood to support python2 and python3 with swig. I've got all the unit tests (except the one that fails on master) and all the examples running in python3 and python2 with the same codebase now: https://github.com/eomahony/Numberjack/pull/33/
Closing as python 2+3 is now in master. A new release will follow soon.
any movement on publishing the python3 version?
@dandroid88 Numberjack version 1.2.0 has been published on PyPI now. I was waiting to set up a test environment locally to test on both python 2 and 3.
Fantastic news and very appreciative :) Cheers!
Any plans on support Python 3.x? If not I will be glad to help you to port the project to Python 3.x