[Kratos] preparing for python3

Riccardo Rossi rrossi en cimne.upc.edu
Jue Mayo 9 10:00:54 CEST 2013


Dear All,

          i am writing this email since there is an incoming change that
will potentially affect us during the next 2 years.

As many of you already know, the development of the "2" serios of python
came to a stop and the 2.7 is the only actively mantained python version.

I have been trying to do some local tests and the kratos is relatively fit
for migration to python3, in the sense that it can compile and link the
python 3 (i tried 3.3) libraries and it is possible to run correctly the
examples after migrating the python code to the version 3.

the most pervasive change is the syntax of the "print"

we usually write

print "variable"

in the future this will need to be

print("variable")

The Python library provides an automatic migration tool which makes the
change for us, so once we decide to base on newer python it is easy to do
such migration.
Unfortunately the syntax with the () is only compatible with python version
> 2.5 so
we will be able to migrate all the codebase only if we accept to drop
support for 2.5.

my proposal is to start requiring python2.6 for compilation (which is
forward compatible to python 3) STARTING FROM SEPTEMBER THIS YEAR. This
would coincide with the End Of Life for Red Hat RHEL5 which is still based
on 2.5.


an importan point however is that python 3 code DOES NOT ALLOW to mix
tabs and spaces within a single file, so to be sure that your code works
you shall
ensure that this error is corrected. Note that mixing TABS and SPACES is a
very bad habit since it is NOT portable, so it is actually a good feature
that the python prevents you to do so.
In order to make the transition more smooth, i would like everyone to take
the habit of
writing

python -tt

instead of

python

when launching a script. This will automatically warn about wrong mixtures
of tabs and spaces. This way in september once the codebase will be
migrated to python3 the transtition shall be much more smooth.


if you have any comment/proposal on the proposed migration strategy please
speak up... this is a very important change to which we shall prepare!

thank you
Riccardo









-- 

Dr. Riccardo Rossi, Civil Engineer

Member of Kratos Team

International Center for Numerical Methods in Engineering - CIMNE
Campus Norte, Edificio C1

c/ Gran Capitán s/n

08034 Barcelona, España

Tel:        (+34) 93 401 56 96

Fax:       (+34) 93.401.6517
web:       www.cimne.com
------------ próxima parte ------------
Se ha borrado un adjunto en formato HTML...
URL: http://listas.cimne.upc.edu/pipermail/kratos/attachments/20130509/3868d0e6/attachment-0001.htm 


Más información sobre la lista de distribución Kratos