python3 status

175 views
Skip to first unread message

Frédéric Chapoton

unread,
Oct 13, 2017, 11:56:11 AM10/13/17
to sage-devel
Hello,

I have reached this point with the ugly python3 experimental branch "public/python3-experiment-8.1.b7":


┌────────────────────────────────────────────────────────────────────┐
SageMath version 8.1.beta7, Release Date: 2017-10-03              
Type "notebook()" for the browser-based notebook interface.        
Type "help()" for help.                                            
└────────────────────────────────────────────────────────────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
Warning: this is a prerelease version, and it may be unstable.    
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
sage
: 3*3
9
sage
: parent(_)
Integer Ring


Cool, no ? Or maybe nobody cares ?

Many things are still not working. The cmp problem has been much reduced, but still not fully fixed. On our way is a large-scale unicode problem, and maybe another large scale hash problem.

Frederic

John H Palmieri

unread,
Oct 13, 2017, 12:02:15 PM10/13/17
to sage-devel
That's great! Thank you for all of your work on this.

  John

Nils Bruin

unread,
Oct 13, 2017, 12:26:41 PM10/13/17
to sage-devel
On Friday, October 13, 2017 at 5:56:11 PM UTC+2, Frédéric Chapoton wrote:
Hello,

I have reached this point with the ugly python3 experimental branch "public/python3-experiment-8.1.b7":


┌────────────────────────────────────────────────────────────────────┐
SageMath version 8.1.beta7, Release Date: 2017-10-03              
Type "notebook()" for the browser-based notebook interface.        
Type "help()" for help.                                            
└────────────────────────────────────────────────────────────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
Warning: this is a prerelease version, and it may be unstable.    
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
sage
: 3*3
9
sage
: parent(_)
Integer Ring


Cool, no ? Or maybe nobody cares ?

It's definitely the former and not the latter. This is very cool and a lot of people care (or will, or should).
Once this branch gains traction, I imagine you may have to edit the "warning" banner and replace "may be" with "is" for a while.

Andrew

unread,
Oct 13, 2017, 12:38:40 PM10/13/17
to sage-devel
Definitely cool! Thanks for all of your work on this!
Andrew

Jori Mäntysalo

unread,
Oct 13, 2017, 1:49:01 PM10/13/17
to sage-devel
On Fri, 13 Oct 2017, Frédéric Chapoton wrote:

> Cool, no ? Or maybe nobody cares ?

Cool, yes!

--
Jori Mäntysalo

Dima Pasechnik

unread,
Oct 13, 2017, 2:47:51 PM10/13/17
to sage-devel
Given http://www.python3statement.org/ lists a number of crucial Sage dependencies to drop py2 on or before 2020, there is little choice. :-)
In fact, I think we should get Sage added to that list too, and get to work on py3 in the earnest.

Julien Puydt

unread,
Oct 13, 2017, 3:19:11 PM10/13/17
to sage-...@googlegroups.com
Hi,

Le 13/10/2017 à 17:56, Frédéric Chapoton a écrit :
> Cool, no ? Or maybe nobody cares ?

Extremely cool!

> Many things are still not working. The cmp problem has been much
> reduced, but still not fully fixed. On our way is a large-scale unicode
> problem, and maybe another large scale hash problem.

Why are unicode and hash problems?

Snark on #sagemath

John Cremona

unread,
Oct 14, 2017, 5:51:01 AM10/14/17
to SAGE devel
How can we be sure that new code witten by people (like me) who are
not python2/3 experts does not regress?

Also, I can see that projects which build on top of Sage will one day
have to make sure that their code is all python3-compliant (I am
thinking of the LMFDB). What's the simplest way of testing that now,
to see where the issues will lie?

John

On 13 October 2017 at 20:19, 'Julien Puydt' via sage-devel
> --
> You received this message because you are subscribed to the Google Groups "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+...@googlegroups.com.
> To post to this group, send email to sage-...@googlegroups.com.
> Visit this group at https://groups.google.com/group/sage-devel.
> For more options, visit https://groups.google.com/d/optout.

Frédéric Chapoton

unread,
Oct 15, 2017, 3:00:06 AM10/15/17
to sage-devel
There is no simple and perfect way to really test that fully now.

Some things that can be done right now in the code of packages :

* check that print is used in a python3 compatible way
* check that cmp() is not used
* check that .iteritems, .iterkeys are not used

An useful diagnostic tool is "2to3" ; another one is "pep8" (to find deprecated syntax, for example syntax of raise).
Another way is to try to launch your module using "python -3".

The best way forward is to move as quickly as possible to a working python3+sage. We still have for example to make sage doctest system work with python3.

Frederic

Kwankyu Lee

unread,
Oct 15, 2017, 4:53:25 AM10/15/17
to sage-devel


On Saturday, October 14, 2017 at 6:51:01 PM UTC+9, John Cremona wrote:
How can we be sure that new code witten by people (like me) who are
not python2/3 experts does not regress?

This would help. While coding on Sage, I refer to Python 3 reference manual :-)

Volker Braun

unread,
Oct 15, 2017, 6:57:01 PM10/15/17
to sage-devel
There are a few guards in place
* Doctests don't accept print statements any more
* There is a unit test that checks that code is syntactically Py3 

Thats not enough to catch .iteritems, for example, but we'll get better test coverage over time.

Jeroen Demeyer

unread,
Oct 16, 2017, 5:26:50 AM10/16/17
to sage-...@googlegroups.com
On 2017-10-14 11:50, John Cremona wrote:
> How can we be sure that new code witten by people (like me) who are
> not python2/3 experts does not regress?

I think it's also important to mention that Cython is quite different
from plain Python in this regard. Cython generally tries to be
compatible with both Python 2 and Python 3. This means that some Python
2 only code like xrange() or dict.iteritems() works in Cython with
Python 3. Also, some Python 3 only code works on Python 2. For example,
keyword-only arguments, f-strings, new super(), yield from.

Erik Bray

unread,
Oct 16, 2017, 11:05:44 AM10/16/17
to sage-devel
Very cool. I still hope to help out more with this, especially the
string problems which I'm practiced at dealing with. I was starting
to several weeks ago when I tried to reproduce the Python 3 issues
from scratch, but then got side-tracked, and then went on a long trip,
so now I'll need to start over again on a Python 3 build.
Reply all
Reply to author
Forward
0 new messages