[vtkusers] VTK Python3 support
Berk Geveci
berk.geveci at kitware.com
Tue Mar 10 07:55:02 EDT 2015
Hi Arnd,
Your assessment sounds in the right ballpark. I don't foresee more issues.
In fact, most of the Python code in VTK is in the testing suite. I'd hope
that any errors there would be caught easily. The huge majority of
non-testing Python code is in Wrapping/Python/vtk, which is something like
40 files. I volunteer taking care of most of those files. I am pretty sure
that we can find volunteers to fix the tests. So upgrading the Python files
is really not that hard. Wrapping is the main challenge.
Best,
-berk
On Tue, Mar 10, 2015 at 3:45 AM, Arnd Baecker <arnd.baecker at web.de> wrote:
> As a follow-up concerning the conversion of the .py files:
> I have run the current 6.2 release through pylint
> with --py3k option.
>
> Excluding everything from the ThirdParty directory
> (which for example contains Twisted 14.0.0 which
> is not yet ported to Python 3)
> this is only approx 780 python files.
>
> One gets a total of 3130 violations spread over 745 files.
>
> Out of these there are:
> - 2325 violations W1618
> (missing `from __future__ import absolute_import`)
> Adding this line actually might not be necessary, it just indicates
> that this behaviour is the default on python 3.
> - 552 violations E1601
> print statement.
> This can be easily solved using
> from __future__ import print_function
> and converting all print-statements to print(...)
> - 53 violations E1604
> syntax change in raise
>
> So this leaves some further 200 violations spread over 72 files.
> These have to be looked at individually.
> Several warn about the change in division
> (which can be solved using ``from __future__ import division``
> and using // instead of the current usage of /.
>
> Overall that part seems doable with reasonable effort
> (But maybe I am seeing things too optimistic
> or I am overlooking something ...).
> In the end this would mean that all examples and tests
> could (in principle) be run both on python 2 and python 3
> without any further code changes.
> Moreover, ThirdParty already contains SixPython
> which could be used if there are changes like range vs. xrange etc.
>
> Are there automatic tests runs
> a) for the python code?
> b) to determine code-coverage for VTK
> (including the python side)?
> This would help to prevent any regression
> during the above steps.
>
> Concerning the first two points of David:
>
>> 1) VTK wrapping still uses old-style classes. I've been meaning to fix
>> this.
>> 2) Basic compile issues and cross-compatibility for py3 and py2 -
>> we received a patch that fixes some of these issues.
>>
> I have no clue how much work this is...
>
> Best, Arnd
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150310/e1e005a0/attachment.html>
More information about the vtkusers
mailing list