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

David Gobbi david.gobbi at gmail.com
Thu Aug 6 14:04:44 EDT 2015

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?).

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

Python 3.2 and higher should also work well, with some caveats:
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.

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

I'm particularly interested in hearing from people who are willing to help
with these modules: vtk.wx,  vtk.qt4, vtk.gtk

Of course if anyone wants to convert some examples or tests, shoot an email
to the list and I'll try to coordinate.  If you want to update the wiki
examples, then you can just log into the wiki and edit them.

 - David

On Wed, Aug 5, 2015 at 6:51 PM, Andrew Maclean <andrew.amaclean at gmail.com>

> Ok thanks. I'll check it out soon. Just testing my builds and various
> scripts
> On Thu, Aug 6, 2015 at 10:45 AM, David Gobbi <david.gobbi at gmail.com>
> wrote:
>> Thanks, Andrew.  I just pushed the CommonCore test updates to the branch.
>>  - David
>> On Wed, Aug 5, 2015 at 5:11 PM, Andrew Maclean <andrew.amaclean at gmail.com
>> > wrote:
>>> Hi David,
>>> Wonderful news.
>>> Definitely be glad to help.
>>> Setting up a Python 3.4 environment in Windows 10 on my laptop now.
>>> I'll be using Anaconda Python.
>>> Once this is done, I'll maintain both a python 2.7 and Python 3.4 build
>>> and see how things go.
>>> Regards
>>>    Andrew
>>> On Thu, Aug 6, 2015 at 1:44 AM, David Gobbi <david.gobbi at gmail.com>
>>> wrote:
>>>> So, here's a brief update on python 3 status:
>>>> The python-py3k merge branch compiles and runs with Python 3.2, 3.3,
>>>> 3.4 and also Python 2.5, 2.6, 2.7 (I tried all six).  So, yes, you can
>>>> build VTK against Python 3, and you can run VTK programs with Python 3.
>>>> I'll be doing a bit of cleanup of the next few days, but the current branch
>>>> is very close to what I plan to merge.
>>>> However: the test code in VTK is all written for Python 2, so right now
>>>> the Python 3 buildbot that Ben has set up is showing all red for the
>>>> testing.  Converting the tests will be a lot of work, especially because
>>>> the tests must continue to run with Python 2.6 and 2.7 (definitely not 2.5,
>>>> though).  Andrew, you mentioned that you might be able to provide some
>>>> assistance, I would be very grateful for anything you have to offer.
>>>> I've already begun converting the python tests in Common/Core, because
>>>> these test the core features of the wrappers.
>>>>  - David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150806/b302f485/attachment.html>

More information about the vtkusers mailing list