[vtk-developers] VTK-py3k is ready for testing

Ben Boeckel ben.boeckel at kitware.com
Thu Aug 6 14:40:34 EDT 2015


On Thu, Aug 06, 2015 at 12:04:44 -0600, David Gobbi wrote:
> I'm planning to merge the py3k branch later today (around 4pm or so ET).
> This is going to cause some test failures on any dashboards that are still
> running python 2.5 (do any of these still exist?).

Not on buildbot at least :) .

> Backwards compatibility for Python 2.6 and 2.7 should be excellent. They
> saw only to major changes:
> 1) The wrappers use new-style classes, i.e. every VTK class is wrapped as a
> type object.  So type(vtkDataArray()) is vtkDataArray, unlike before when
> type(vtkDataArray()) was 'vtkobject'.
> 2) The wrappers support the new n-dimensional buffer interface, so
> numpy.asarray(vtk_array) creates a zero-copy numpy array from a VTK data
> array.
> 
> Python 3.2 and higher should also work well, with some caveats:

When I set up Windows buildbots with Python3, I'll try to use 3.2 there
since most of the Linux distributions are 3.3+ already. What is OS X
using these days for Python3?

> 1) VTK is still set up to use python 2 by default, so when configuring VTK
> with cmake, you must provide the paths to the python 3 executable, the
> python 3 include dir, and the python 3 library.
> 2) Most of the python tests and examples will only run with python 2.
> 3) Most of VTK's python utility modules (e.g. vtk.tk) will only run with
> python 2.
> 4) The wrappers will encode python strings to utf8 bytes before passing it
> to VTK.

Yay!

> Obviously, converting the utility modules and tests to python 3 will be a
> lot of work.  And keeping support for python 2 is a must ... all code must
> run with python 2.6, 2.7, and 3.2+.

Note that the `six` module is already in ThirdParty. We will probably
want to add dependencies where needed to ensure it is brought in
properly (or just depend on it from vtkPythonCore).

We will also need to find versions of:

  - Twisted
  - Autobahn
  - ZopeInterface
  - mpi4py

which support both versions (or make a py3 variant) for ThirdParty.
ParaView will need a usable of pygments as well, so while we're
searching, that should be on the shopping list as well.

Thanks for the Python3 goodness! :)

--Ben


More information about the vtk-developers mailing list