Porting to python3

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
triplus
Posts: 8605
Joined: Mon Dec 12, 2011 4:45 pm

Re: Porting to python3

Postby triplus » Thu Mar 15, 2018 9:33 pm

Is the initial strategy to achieve Py2/Py3 compatible FreeCAD still realistic and does it still make the most sense?
User avatar
kkremitzki
Posts: 1679
Joined: Thu Mar 03, 2016 9:52 pm
Location: Texas

Re: Porting to python3

Postby kkremitzki » Thu Mar 15, 2018 11:58 pm

Python 2 EOL is in like 20 months so I think the sooner we're "all 3", the better.
Like my FreeCAD work? I'd appreciate any level of support via Patreon, Liberapay, or PayPal! Read more about what I do at my blog.
looo
Posts: 2749
Joined: Mon Nov 11, 2013 5:29 pm

Re: Porting to python3

Postby looo » Sat Mar 17, 2018 6:02 am

as nobody wants to do work twice, I wouldn‘t support both versions. I find myself using py2 incompatible syntax in other projects quite often, allthough I know it's not going to work with py2. mainly this are:

- * operator for unpacking works not only for arguments.
- @ operatot for numpy array matrx multiplication


so once we switch, we will have the opposite problem like we have now.
triplus
Posts: 8605
Joined: Mon Dec 12, 2011 4:45 pm

Re: Porting to python3

Postby triplus » Sat Mar 17, 2018 8:00 pm

Therefore how will we approach to resolve this chicken or the egg dilemma? Continue to be frustrated for the next 2 years. Trying to fulfill the idea of maintaining full Py2/Py3 compatibility. Or do something else? Or both?
looo
Posts: 2749
Joined: Mon Nov 11, 2013 5:29 pm

Re: Porting to python3

Postby looo » Sat Mar 17, 2018 9:04 pm

I once said, that we should move as early as possible. This was about 2 years ago :D Many py3 incompatible lines have been produced in the meantime. Macros won't work after updating to py3. Porting them should be quite simple, but it's simple frustrating to deal with this issues....

I guess a simple statement to not support py2 for the next release /release cycle will fix this issue. I know that is painful, but it doesn't get much better if we wait until 2020 or die with py2...
abdullah
Posts: 3174
Joined: Sun May 04, 2014 3:16 pm

Re: Porting to python3

Postby abdullah » Sun Mar 18, 2018 10:17 am

looo wrote:
Sat Mar 17, 2018 9:04 pm
I guess a simple statement to not support py2 for the next release /release cycle will fix this issue. I know that is painful, but it doesn't get much better if we wait until 2020 or die with py2...
My two cents:

I think we should go this way. Make into the Roadmap of v0.18 only supporting py3. The reasons are:
1. Py2 and Py3 compatibility sinks effort and developer time.
2. With the release of v0.17 it ends the introduction of py3 incompatible code. It should be a requirement that anything merged into v0.18 is py3 compatible.
3. v0.17, once released, will be short-living, as we plan to release v0.18 around the end of this year. This will allow to have two reasonably similar versions from a functionality point of view, one supporting python2 (v0.17), the other python3 (v0.18). I think this is a perfect bridge (at least when faced with the egg/chicken problem) to disrupt users as little as possible, while allowing to create awareness and move all other tools, 3rd party WB and macros that have not been adapted during v0.18 development cycle (hopefully very little of them), during v0.19 development cycle. This should allow to bring all python tools together for the release of v0.19, in time for the 2020 shutdown.

Probably 3rd party python tools will need either to adapt to have two branches, one for py2 (addonmanager of v0.17 pointing there) and another for py3( addonmanager of v0.18 pointing there). Hopefully the development of such tools for py3 will gain moment from the decision of the Roadmap for v0.18.
triplus
Posts: 8605
Joined: Mon Dec 12, 2011 4:45 pm

Re: Porting to python3

Postby triplus » Sun Mar 18, 2018 7:22 pm

Not sure to be honest. If such switch will happen in FreeCAD 0.18 development cycle. I somehow doubt that. Therefore Py2/Py3 compatibility cruft will likely just continue to build up?
looo
Posts: 2749
Joined: Mon Nov 11, 2013 5:29 pm

Re: Porting to python3

Postby looo » Sun Mar 18, 2018 8:07 pm

triplus wrote:Not sure to be honest. If such switch will happen in FreeCAD 0.18 development cycle. I somehow doubt that. Therefore Py2/Py3 compatibility cruft will likely just continue to build up?
Image
yorik wrote:
wmayer wrote:
please give us some insights about your plans regarding py3.
User avatar
NormandC
Posts: 18534
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Porting to python3

Postby NormandC » Sun Mar 18, 2018 8:33 pm

abdullah wrote:
Sun Mar 18, 2018 10:17 am
3. v0.17, once released, will be short-living, as we plan to release v0.18 around the end of this year.
Sorry, but :lol:

When was the last time that two releases of FreeCAD were spaced less than 9 months apart? Years ago, when the project was much smaller. It's been 2 1/2 months since Werner talked of a 0.17 release. If 0.18 is to be released by year's end, and if a 2-3 months period is required to preparare for a release, that leaves 6-7 months of development.
wmayer
Site Admin
Posts: 14645
Joined: Thu Feb 19, 2009 10:32 am

Re: Porting to python3

Postby wmayer » Mon Mar 19, 2018 12:20 pm

please give us some insights about your plans regarding py3.
From my point of view we should finish the Py3 port ASAP when starting with v0.18 development. I would then make Py3 the default version but keep Py2 specific code for a while.