View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0015554VTK(No Category)public2015-06-24 05:392015-08-28 18:17
Reporterhadimm 
Assigned ToBen Boeckel (Kitware) 
PrioritynormalSeverityminorReproducibilityhave not tried
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version6.0.0 
Target VersionFixed in Version 
Summary0015554: Python 3 compatibility
DescriptionFrom http://www.vtk.org/Wiki/VTK/Python_Wrapping_FAQ, [^] I can read "Python 3 support is planned, but there is no date set.".

And I didn't find any opened issue in the bug tracker.

Are you still planning to move to Python 3 ? If you do, do you have any release date ?

Many new python project starts with python 3 only compatibility from nowdays. So it becomes very hard if they want to include some VTK/Mayavi piece of code after the code base has been produced...

See also : https://github.com/enthought/mayavi/issues/84 [^]

Thank you
TagsNo tags attached.
ProjectTBD
Typefeature
Attached Files

 Relationships
has duplicate 0015526closedDavid Gobbi Compiling VTK 6.2.0 with Python Wrapper on Win8.1 with VS2015 RC1 

  Notes
(0034609)
Edson Tadeu M. Manoel (reporter)
2015-06-25 14:10

+1

VTK is the last major dependency holding people back from moving to Python 3 (therefore, holding people back from using modern things in Python and from using MSVC 2015).
(0034675)
Ben Boeckel (Kitware) (developer)
2015-07-07 15:31

There are plans for it, but no hard timeline for it.

As for more modern MSVC, using a system Python 2.7 with MSVC 2013 works fine (it's what some of our dashboards do). I imagine 2015 would be similar.
(0034691)
James Booth (reporter)
2015-07-08 06:20
edited on: 2015-07-08 06:22

+1

Would it possible for you to share a few more details on the current plans you have for tackling the issue Ben? It may be something we in the Python community could assist with, if only we had some guidance on what the key issues are.

The lack of Python 3 support is starting to make us think of moving away from using VTK in our project (https://github.com/menpo/ [^]).

I would argue that Python 3 support is a move you must undertake at some point to remain relevant in the scientific Python community. It's true that many are still using Python 2, but so many packages now support Python 3 and so many little advantages are now piling up (@ operator, advanced tuple unpacking, fixes to long standing issue like integer division, built with modern Windows compilers*) that there will come a point where peopl in the scientific community will come to think as Python 3 as the norm - surely VTK doesn't want to be caught flat-footed when that happens?

* It doesn't matter if VTK happens to work well with newer compilers, other Py2 projects don't, and there is no guarantee that they should. The community as a whole being able to drop support for Python 2 and with it VS2008 will be a big improvement for all of us. That can only happen after a wholesale move to Python 3, which packages like VTK are currently holding back.

(0034692)
hadimm (reporter)
2015-07-08 06:46

I would like to insist on the fact that the Python community can definitvely help you for the Python 3 port. We only need some guidance as James pointed it out.

In the meantime James, if you don't know yet, have a look at Vispy (https://github.com/vispy/vispy [^]) which one of the main goal is to bring easy 3D viz to the browser.
(0034694)
Ben Boeckel (Kitware) (developer)
2015-07-08 09:52

David Gobbi is the main developer of the wrapping code. The current approach to Python wrapping in VTK uses old-style classes. The new approach, I believe, will be creating a PyTypeObject for each VTK class. I'm not sure of the status of that currently.

However, the Python code itself (and CPython code directly in the repo) does need updating. It should support Python2 and Python3 at the same time (I wouldn't be surprised if six is necessary). I also forsee problems with Python3's str since VTK does not guarantee utf-8 anywhere (at least that I've ever seen), so bytes objects might be the way to go for some APIs.

If you'd like to help, merge requests on GitLab (https://gitlab.kitware.com/vtk/vtk [^]) to add dual Python2/3 support to the Python code would be appreciated. Feel free to mention me on the MR and I'll do a review of it.
(0034700)
David Gobbi (developer)
2015-07-08 13:07

Here's a brief status report. I have the wrappers compiling with new-style classes, but the new implementation still has several holes that need to be filled in. It'll be at least a week before I'm ready to post any code. This will be the first (and probably the most crucial) step towards Py3K compatibility.
(0034787)
David Gobbi (developer)
2015-07-16 11:11

More progress. I've created two merge requests related to this issue. These changes remove tons of cruft that was required for old versions of python. This weekend I'll start adding code to support Py3K.

Remove any conditional code for python older than 2.5:
https://gitlab.kitware.com/vtk/vtk/merge_requests/408 [^]

Convert python wrappers to new-style python classes:
https://gitlab.kitware.com/vtk/vtk/merge_requests/411 [^]
(0034788)
hadimm (reporter)
2015-07-16 12:00

Congrats David and thanks for the work !
(0034808)
David Gobbi (developer)
2015-07-20 11:07

Over the weekend, I fixed all the corner-cases in order to provide full backwards compatibility with the old wrappers. This means that I didn't have time for any actual Py3K code. Also, I made a new merge request, because the old one was becoming cluttered and hard to follow:

https://gitlab.kitware.com/vtk/vtk/merge_requests/436 [^]

One big change here is that VTK now has its own method descriptors, instead of using the PyMethodDescrObject. This is necessary in order to support methods where some signatures are static and others are not.
(0035100)
Ben Boeckel (Kitware) (developer)
2015-08-28 18:17

Python3 support has landed in master. It will be available in 7.0.

 Issue History
Date Modified Username Field Change
2015-06-24 05:39 hadimm New Issue
2015-06-25 14:10 Edson Tadeu M. Manoel Note Added: 0034609
2015-07-07 15:31 Ben Boeckel (Kitware) Note Added: 0034675
2015-07-07 15:40 Ben Boeckel (Kitware) Relationship added has duplicate 0015526
2015-07-08 06:20 James Booth Note Added: 0034691
2015-07-08 06:22 James Booth Note Edited: 0034691
2015-07-08 06:46 hadimm Note Added: 0034692
2015-07-08 09:52 Ben Boeckel (Kitware) Note Added: 0034694
2015-07-08 13:07 David Gobbi Note Added: 0034700
2015-07-16 11:11 David Gobbi Note Added: 0034787
2015-07-16 12:00 hadimm Note Added: 0034788
2015-07-20 11:07 David Gobbi Note Added: 0034808
2015-08-28 18:17 Ben Boeckel (Kitware) Note Added: 0035100
2015-08-28 18:17 Ben Boeckel (Kitware) Status backlog => closed
2015-08-28 18:17 Ben Boeckel (Kitware) Assigned To => Ben Boeckel (Kitware)
2015-08-28 18:17 Ben Boeckel (Kitware) Resolution open => fixed


Copyright © 2000 - 2018 MantisBT Team