Page 2 of 5

Re: Python3 migration

Posted: Fri Nov 22, 2019 10:02 am
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.

Re: Python3 migration

Posted: Wed Jan 08, 2020 11:41 pm
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?

Re: Python3 migration

Posted: Thu Jan 09, 2020 4:11 am
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.

Re: Python3 migration

Posted: Sat Jan 11, 2020 9:42 am
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.

Re: Python3 migration

Posted: Sat Jan 11, 2020 10:27 am
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

Re: Python3 migration

Posted: Sat Jan 11, 2020 11:22 am
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

Re: Python3 migration

Posted: Sat Jan 11, 2020 11:28 am
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.

Re: Python3 migration

Posted: Sun Jan 12, 2020 10:39 am
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?

Re: Python3 migration

Posted: Sun Jan 12, 2020 10:49 am
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.

Re: Python3 migration

Posted: Sun Jan 12, 2020 11:15 am
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.

Re: Python3 migration

Posted: Sun Jan 12, 2020 11:35 am
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?

Re: Python3 migration

Posted: Sun Jan 12, 2020 11:43 am
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.

Re: Python3 migration

Posted: Tue Jan 14, 2020 8:12 am
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).

Re: Python3 migration

Posted: Tue Jan 14, 2020 8:27 am
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

Re: Python3 migration

Posted: Tue Jan 14, 2020 9:13 am
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.