r/programming • • Aug 25 '26

EVE Online: The Move to Python 3 Begins!

https://www.eveonline.com/news/view/the-move-to-python-3-begins
802 Upvotes

290 comments sorted by

View all comments

Show parent comment

88

u/FlukyS Aug 25 '26 edited Aug 25 '26

I've done dozens of migrations from 2.6 and 2.7 to 3, it isn't hard really, it is just whack a mole. What I'd say though most of the changes I've ever done was just straight up rewriting things that were horrible before but just weren't touched more than just syntax differences or whatever. People made a big deal about requiring for instance print to have brackets but if your service had a million print statements then you are already going to be much happier spending time moving to use logging or maybe pruning unnecessary stuff. Strings in Python3 in particular are much nicer with fstrings, templating...etc and the debugging in the newest versions of Python are a dream.

EDIT: Just for examples of stuff I've had to do, almost every 2.* migration I've done has involved completely rewriting networking endpoints either from urllib to requests or stuff like Twisted to FastAPI or before that aiohttp. Syntax is easy, the library migrations are usually hard breaks because it is easier just to start fresh.

25

u/def-pri-pub Aug 25 '26

The first company I worked at full time (in late 2010's) we were trying to migrate the code base from Python 2.x to 3.x. I don't think it went much of anywhere because the big bottle neck for us at the time was Twisted, which IIRC didn't have 3.x support and all of our code was based off of Twisted.

27

u/FlukyS Aug 25 '26

Yeah the answer was just get rid of Twisted for every project I've worked on. Twisted itself isn't close to the style of modern Python in general so moving to other tools is a good shout regardless.

23

u/jayroger Aug 25 '26 edited Aug 25 '26

The syntax changes were the easiest part, same with library renames and changes. The really hard part was the str/unicode -> bytes/str migration. But I'm very glad that we collectively bit the bullet, because it also meants that after the migration the continuous Unicode encoding/decoding errors were gone and the new data types make much more sense.

8

u/FlukyS Aug 25 '26

Well that's the whack a mole side of the port but usually the easiest part. The harder part is tool selection, migrating to the new build tools, rewrites of stuff when you can improve things with newer libraries or whatever. It depends on the codebase really

14

u/jmickeyd Aug 25 '26

The problem is they're not just doing a 2 -> 3 migration. They use a heavily modified internal fork of 2 that they've added coroutines to. Presumably they migrate that to native await/async, which is a much larger task.

3

u/FlukyS Aug 25 '26

Well newer Python has better multiprocessing support and different interpreters and stuff. It would be much easier to do what they are doing with that in theory.

6

u/Memitim Aug 25 '26

LOL, too real. The actual work in migrations is the extra crap you end up doing after seeing old code and then immediately looking around to see if anyone saw it before you can scrub it from existence and replace with code that shouldn't be hidden away in a closet next to an aging portrait and the Ark of the Covenant.

1

u/Brian Aug 25 '26

I'd say there are further difficulties in this case, as they're likely heavily using stackless's tasklet/channels model. Either they'll need to port all that code to modern async, or create some kind of adapter layer implementing it on top of it.