Python3 migration

Programmers discuss here anything related to FreeOrion programming. Primarily for the developers to discuss.

Moderator: Committer

Message
Author
o01eg
Programmer
Posts: 1998
Joined: Sat Dec 10, 2011 5:46 am

Re: Python3 migration

#16 Post by o01eg »

I've opened PR https://github.com/freeorion/freeorion/pull/2653

AI doesn't think but can send orders and with dirty hack unit tests are passed.
Gentoo Linux x64, gcc-11.2, boost-1.78.0
Ubuntu Server 22.04 x64, gcc-12, boost-1.74.0
Welcome to the slow multiplayer game at freeorion-lt.dedyn.io.Version 2024-01-30.0dd6806.
Donations're welcome:BTC:bc1q007qldm6eppqcukewtfkfcj0naut9njj7audnm

User avatar
adrian_broher
Programmer
Posts: 1156
Joined: Fri Mar 01, 2013 9:52 am
Location: Germany

Re: Python3 migration

#17 Post by adrian_broher »

o01eg wrote: Wed Aug 07, 2019 3:36 am SDK not yet moved. It still should be tagged.
What prevents you from doing a release so far?
Resident code gremlin
Attached patches are released under GPL 2.0 or later.
Git author: Marcel Metz

o01eg
Programmer
Posts: 1998
Joined: Sat Dec 10, 2011 5:46 am

Re: Python3 migration

#18 Post by o01eg »

adrian_broher wrote: Wed Jan 08, 2020 11:41 pm
o01eg wrote: Wed Aug 07, 2019 3:36 am SDK not yet moved. It still should be tagged.
What prevents you from doing a release so far?
Vezzra makes releases. I suppose he is going to make FreeOrion release first.
Gentoo Linux x64, gcc-11.2, boost-1.78.0
Ubuntu Server 22.04 x64, gcc-12, boost-1.74.0
Welcome to the slow multiplayer game at freeorion-lt.dedyn.io.Version 2024-01-30.0dd6806.
Donations're welcome:BTC:bc1q007qldm6eppqcukewtfkfcj0naut9njj7audnm

User avatar
Cjkjvfnby
AI Contributor
Posts: 539
Joined: Tue Jun 24, 2014 9:55 pm

Re: Python3 migration

#19 Post by Cjkjvfnby »

I want to join the python3 migration.

Can someone provie me a python3 build for windows?

My throughts about: https://github.com/freeorion/freeorion/pull/2653
I want to split it to smaller PRs.
Do as much I can to make python2 code compatiable with python3 (print, iteritems, etc.).
This will reduce diff and simplify feature branch maintance.
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

o01eg
Programmer
Posts: 1998
Joined: Sat Dec 10, 2011 5:46 am

Re: Python3 migration

#20 Post by o01eg »

Cjkjvfnby wrote: Sat Jan 11, 2020 9:42 am I want to join the python3 migration.

Can someone provie me a python3 build for windows?
I didn't work on this on Windows later so I don't have one. You can try to build it with latest SDK: https://ci.appveyor.com/project/freeorion/freeorion-sdk
Cjkjvfnby wrote: Sat Jan 11, 2020 9:42 am My throughts about: https://github.com/freeorion/freeorion/pull/2653
I want to split it to smaller PRs.
I've already extracted some little things about python which don't leave game in a broken state and they are merged already, but switching from python2 to 3 is big either way.
Cjkjvfnby wrote: Sat Jan 11, 2020 9:42 am Do as much I can to make python2 code compatiable with python3 (print, iteritems, etc.).
This will reduce diff and simplify feature branch maintance.
It would be nice if you could extract some compatible changes into master without switching to python3
Gentoo Linux x64, gcc-11.2, boost-1.78.0
Ubuntu Server 22.04 x64, gcc-12, boost-1.74.0
Welcome to the slow multiplayer game at freeorion-lt.dedyn.io.Version 2024-01-30.0dd6806.
Donations're welcome:BTC:bc1q007qldm6eppqcukewtfkfcj0naut9njj7audnm

User avatar
Cjkjvfnby
AI Contributor
Posts: 539
Joined: Tue Jun 24, 2014 9:55 pm

Re: Python3 migration

#21 Post by Cjkjvfnby »

I will add https://six.readthedocs.io/ library to the code.

Workflow:
  • copy library file to the project code
  • use it to archive compatibility
  • remove it and all usage after the migration is done
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

o01eg
Programmer
Posts: 1998
Joined: Sat Dec 10, 2011 5:46 am

Re: Python3 migration

#22 Post by o01eg »

Cjkjvfnby wrote: Sat Jan 11, 2020 11:22 am I will add https://six.readthedocs.io/ library to the code.

Workflow:
  • copy library file to the project code
  • use it to archive compatibility
  • remove it and all usage after the migration is done
Do we need to maintain Python2 compatibility? If so C++ code must be altered to support both version as well.
Gentoo Linux x64, gcc-11.2, boost-1.78.0
Ubuntu Server 22.04 x64, gcc-12, boost-1.74.0
Welcome to the slow multiplayer game at freeorion-lt.dedyn.io.Version 2024-01-30.0dd6806.
Donations're welcome:BTC:bc1q007qldm6eppqcukewtfkfcj0naut9njj7audnm

User avatar
Cjkjvfnby
AI Contributor
Posts: 539
Joined: Tue Jun 24, 2014 9:55 pm

Re: Python3 migration

#23 Post by Cjkjvfnby »

o01eg wrote: Sat Jan 11, 2020 11:28 am Do we need to maintain Python2 compatibility? If so C++ code must be altered to support both version as well.
It depends how fast we want to add python3.

How far we from merging https://github.com/freeorion/freeorion/pull/2653?

Can you produce a list of steps what should be done? Is it just press merge or we need more actions?

We have 2 python libraries inside a game: one for AI and one for universe generation and turn events.
Do we plan to port them simultaneously of can do it in separate steps?
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

o01eg
Programmer
Posts: 1998
Joined: Sat Dec 10, 2011 5:46 am

Re: Python3 migration

#24 Post by o01eg »

Cjkjvfnby wrote: Sun Jan 12, 2020 10:39 am
o01eg wrote: Sat Jan 11, 2020 11:28 am Do we need to maintain Python2 compatibility? If so C++ code must be altered to support both version as well.
It depends how fast we want to add python3.

How far we from merging https://github.com/freeorion/freeorion/pull/2653?

Can you produce a list of steps what should be done? Is it just press merge or we need more actions?
There WIP list I maintains in PR description:
  • First of all I'm waiting your PR and AI unit tests to be merged.
  • Do something with ReadOnlyDict. Maybe we don't need it at all.
  • Port charts script you found.
  • And release SDK so python3 version can be built and tested with CI.
Cjkjvfnby wrote: Sun Jan 12, 2020 10:39 am We have 2 python libraries inside a game: one for AI and one for universe generation and turn events.
Do we plan to port them simultaneously of can do it in separate steps?
They are use many common code so I think it should be ported simultaneously.
Gentoo Linux x64, gcc-11.2, boost-1.78.0
Ubuntu Server 22.04 x64, gcc-12, boost-1.74.0
Welcome to the slow multiplayer game at freeorion-lt.dedyn.io.Version 2024-01-30.0dd6806.
Donations're welcome:BTC:bc1q007qldm6eppqcukewtfkfcj0naut9njj7audnm

User avatar
Cjkjvfnby
AI Contributor
Posts: 539
Joined: Tue Jun 24, 2014 9:55 pm

Re: Python3 migration

#25 Post by Cjkjvfnby »

o01eg wrote: Sun Jan 12, 2020 10:49 am There WIP list I maintains in PR description:
  • First of all I'm waiting your PR and AI unit tests to be merged.
  • Do something with ReadOnlyDict. Maybe we don't need it at all.
  • Port charts script you found.
  • And release SDK so python3 version can be built and tested with CI.
Charts is a standalone script, let's exclude it from migration scope. It can be migrated when It will be needed.
I will look into ReadOnlyDicts problem.
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

User avatar
Vezzra
Release Manager, Design
Posts: 6090
Joined: Wed Nov 16, 2011 12:56 pm
Location: Sol III

Re: Python3 migration

#26 Post by Vezzra »

o01eg wrote: Thu Jan 09, 2020 4:11 amVezzra makes releases. I suppose he is going to make FreeOrion release first.
Well, actually I've been doing the releases of the game, not the (cmake powered) SDKs, those have been maintained by Marcel (adrian_broher). He withdrew from the project some time ago, so I did plan to try to take care of SDK releases after 0.4.9 is out, however, seeing as he seems to be back, I'd prefer to leave that to him.

If that's ok with him - Marcel?

User avatar
Vezzra
Release Manager, Design
Posts: 6090
Joined: Wed Nov 16, 2011 12:56 pm
Location: Sol III

Re: Python3 migration

#27 Post by Vezzra »

o01eg wrote: Sun Jan 12, 2020 10:49 am
Cjkjvfnby wrote: Sun Jan 12, 2020 10:39 am We have 2 python libraries inside a game: one for AI and one for universe generation and turn events.
Do we plan to port them simultaneously of can do it in separate steps?
They are use many common code so I think it should be ported simultaneously.
Yep. Which means the entire universe generation and turn event Python scripts must be made Python3 compliant like the AI scripts.

And it absolutely needs to be done within the next release cycle, as Python2 support is fading out. So, whatever else is going on the next release cycle, migration to Python3 must be given topmost priority.

User avatar
adrian_broher
Programmer
Posts: 1156
Joined: Fri Mar 01, 2013 9:52 am
Location: Germany

Re: Python3 migration

#28 Post by adrian_broher »

Vezzra wrote: Sun Jan 12, 2020 11:35 am If that's ok with him - Marcel?
Lolnotin1kyears. :3

But the release mechanism is idiot proof. Update the release versions in the cmake file, create an annotated tag and wait until the build was successful (assuming any of you didn't fuck up the setup).
Resident code gremlin
Attached patches are released under GPL 2.0 or later.
Git author: Marcel Metz

User avatar
adrian_broher
Programmer
Posts: 1156
Joined: Fri Mar 01, 2013 9:52 am
Location: Germany

Re: Python3 migration

#29 Post by adrian_broher »

Vezzra wrote: Sun Jan 12, 2020 11:43 am And it absolutely needs to be done within the next release cycle, as Python2 support is fading out.
FYI the majority of Linux Platforms are dropping Python2 with their next release. MacOS will drop support with 10.16.

Some FO related bugs:

https://bugzilla.redhat.com/show_bug.cgi?id=1787241
https://bugs.debian.org/cgi-bin/bugrepo ... bug=936557
Resident code gremlin
Attached patches are released under GPL 2.0 or later.
Git author: Marcel Metz

o01eg
Programmer
Posts: 1998
Joined: Sat Dec 10, 2011 5:46 am

Re: Python3 migration

#30 Post by o01eg »

adrian_broher wrote: Tue Jan 14, 2020 8:27 am
Vezzra wrote: Sun Jan 12, 2020 11:43 am And it absolutely needs to be done within the next release cycle, as Python2 support is fading out.
FYI the majority of Linux Platforms are dropping Python2 with their next release. MacOS will drop support with 10.16.

Some FO related bugs:

https://bugzilla.redhat.com/show_bug.cgi?id=1787241
https://bugs.debian.org/cgi-bin/bugrepo ... bug=936557
Considering https://fedorapeople.org/groups/schedul ... tasks.html looks like freeorion will be missed in Fedora 32.
Gentoo Linux x64, gcc-11.2, boost-1.78.0
Ubuntu Server 22.04 x64, gcc-12, boost-1.74.0
Welcome to the slow multiplayer game at freeorion-lt.dedyn.io.Version 2024-01-30.0dd6806.
Donations're welcome:BTC:bc1q007qldm6eppqcukewtfkfcj0naut9njj7audnm

Post Reply