GithubHelp home page GithubHelp logo

Python 3 Compatibility about numberjack HOT 8 CLOSED

eomahony avatar eomahony commented on August 10, 2024
Python 3 Compatibility

from numberjack.

Comments (8)

9thbit avatar 9thbit commented on August 10, 2024

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.

from numberjack.

concernedrat avatar concernedrat commented on August 10, 2024

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.

from numberjack.

rdeits avatar rdeits commented on August 10, 2024

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.

from numberjack.

rdeits avatar rdeits commented on August 10, 2024

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: #33

from numberjack.

9thbit avatar 9thbit commented on August 10, 2024

Closing as python 2+3 is now in master. A new release will follow soon.

from numberjack.

dandroid88 avatar dandroid88 commented on August 10, 2024

any movement on publishing the python3 version?

from numberjack.

9thbit avatar 9thbit commented on August 10, 2024

@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.

from numberjack.

dandroid88 avatar dandroid88 commented on August 10, 2024

Fantastic news and very appreciative :) Cheers!

from numberjack.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.