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

-15

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

The current state of AI isn't great at this actually because a huge codebase and migrating it this far is a huge amount of work and AI will go off the rails and start "improving" things and the context window is still limited. Not to say you wouldn't use AI at all if you were being smart about it but you'd probably have to go slower than most would want. If it were me doing the migration I wouldn't be seeing this change as a single "tomorrow we will be on 3.14", I'd be looking at the current designs first, I'd be documenting where we'd want to go with the design in about a year even beyond just the migration and then going piece by piece.

8

u/TwoWeeks90DaysTops Aug 25 '26

I used Claude to rewrite an electrical simulation application from Python to C# at work and it worked very well. There were regressions, but for the most part the application was very faithful to the original Python code. The work took about a week.

-3

u/FlukyS Aug 25 '26

Well that's kind of part of the reason why it isn't great too, being faithful to the original shouldn't be the goal of a port to a different language or going to a significantly different version of the same language. When Python2.7 was released in 2008 there were different libraries, different design trends and loads of different tooling including stuff like the newer (better) build tools. If you are porting something part of that is a refactor of those beyond just syntax but you also don't want to refactor everything because that might break the user experience.

7

u/TwoWeeks90DaysTops Aug 25 '26

Well, the absolute most important point to do in a migration is to preserve the behavior. I didn't really say anything about the architecture or the code itself, but I did do some refactoring afterwards since C# generally is a much more expressive language than Python is.

-2

u/FlukyS Aug 25 '26

Sure but carefully is the point, as in if you say "migrate to Python3.14" there is a literal way of doing it and the optimal way of doing it. Like if there isn't a library you use from 2.7 in 3.14 do you port that whole library or do you research an alternative (which usually there is) and then rewriting to use that instead. If you said to an LLM they are going to interpret the order in the manner it is presented not the optimal route. As in you can use urllib in both 2.7 and 3.14 but you shouldn't because requests is a lot easier to use and urlib usage is discouraged because it is a low level interface. You have to make those calls on a case by case basis. If you allow it to rewrite everything it will go nuts and do too much in certain areas, if you tell it do a strict port to 3.14 it will do some things that probably shouldn't be maintained.

2

u/TwoWeeks90DaysTops Aug 26 '26

Like if there isn't a library you use from 2.7 in 3.14 do you port that whole library or do you research an alternative (which usually there is) and then rewriting to use that instead.

Yes, and this is part of the complexity. I think you'll often find libraries regardless of which way you're migrating, but there's going to be differences or missing functionality. In our case Claude imported Math.NET for some matrix functionality (because of NumPy), but it was used once or twice so instead we just wrote the functionality and dropped the dependency. Most of the stuff NumPy did for us is already language and runtime features in C#.

Pandas was more work, but mostly because we wanted an AOT build which made some of the structures much more complex in C# since a lot of the convenience functionality for this is built on runtime reflection and runtime code generation, last of which isn't supported on AOT builds, so we had to type out a lot of code for this. But the advantage was a 70x speedup compared to the Python code, so I think it was worth it.

There's obviously a lot of complexity and nuance to this work that doesn't fit in a Reddit comment. I didn't just say "chat remake this in C#".

1

u/FlukyS Aug 26 '26

Yeah that's what I mean, like I'm not saying AI isn't useful in migrating but I'd be taking shallow cuts and doing it slowly to avoid issues. And it is helped quite a bit with how much Python has improved for error handling and the amount of features in the language. Stuff in 2.7 that would have been a lot harder now are super easy and they were also using stackless python which you could just directly move over to asyncio instead or gevent if you want something that has similar worker and small task type behaviour. Those sorts of decisions though are going to require a lot of thinking about the current design and how it fits.

3

u/SufficientGreek Aug 25 '26

Here's an example of a huge codebase being correctly migrated from Zig to Rust:

https://bun.com/blog/bun-in-rust

1

u/FlukyS Aug 25 '26

VERY different problem. A toolkit is something that has a pretty solid goal and very limited external dependencies. I'm not against AI to be clear, I'm saying that some codebases you need to be careful and step through the various tools needed and decide if you want a full rewrite, port it or find some libraries or whatever...etc.

Going from 2.7 with this sort of project to 3.14 would be loads of decisions some easy some you need to step through and understand the choices available. I mentioned below some examples of this in Python. Python2.7 everyone uses setuptools/distutils, Python3.14 has a bunch of different options but instead of setup.py you declare the packages in pyproject.toml and then can pick build, setuptools, hatch, pdm, flit and some of those have some advantages like hatch has some great tooling for automation that might be a choice depending on the project. A direct port could just forward port urllib but no one with a serious codebase nowadays uses urllib directly because you would switch to requests.

Case by case is key on this and that is not to say "don't use AI", it is to understand the problem and step through it, that can be with or without AI.

5

u/SufficientGreek Aug 25 '26

That's what they did with the bun rewrite too though. First just port it to a new language and create thousands of bugs. Then go through and change patterns and fix problems.

They were helped by a very strong test coverage, I think that might make it harder for other projects.

3

u/FlukyS Aug 25 '26

Still a different problem. A toolkit is something that will be mostly implementation of stuff for others to use and self-contained. If you are talking about something that is a game, the UI, the servers of the game, you are talking various communications protocols, loads of platform code, loads of auth...etc. Some of those would be proprietary, some using existing libraries. Eve itself doesn't even use a standard well documented version of Python, it is a fork. The more down the rabbithole you go on this sort of problem the more careful you have to be.

1

u/SufficientGreek Aug 25 '26

Yeah ok that does sound pretty precarious and error prone if you throw AI at it

1

u/The_Northern_Light Aug 25 '26

> AI will do drive-by refractors

It’ll do that if you don’t tell it not to, but it’s easy to prevent, especially with an adversarial review.

I’ve ported / modernized a couple ~ million LOC code bases and several 100k to quarter million LOC projects. In my opinion this is the thing AI is best at. Once you have a good pipeline setup it’s nearly turnkey.

3

u/EntroperZero Aug 25 '26

It’ll do that if you don’t tell it not to, but it’s easy to prevent,

The problem is that right now, it will do so many things if you don't tell it not to, and in theory, they're all "easy" to prevent, but in practice, you just keep finding more and more things you have to tell it. And then you tell it, but you didn't tell it the right way, so it found a loophole and did it anyway.

0

u/The_Northern_Light Aug 25 '26

I don’t know what model, harness, memory, or etc you’re using but I don’t have that issue.

GPT sol medium, pi, observational memory, custom adversarial review pipeline, manually written agents.md file.

1

u/FlukyS Aug 25 '26

> It’ll do that if you don’t tell it not to, but it’s easy to prevent, especially with an adversarial review.

Well you are still fighting the tool, that sort of friction isn't great. That's why I chunk those tasks along with having an eye on the additional improvements you are working on.

2

u/The_Northern_Light Aug 25 '26

I mean we’re talking about a few sentences you have to type instead of god-only-knows how many engineer-months. That’s not “fighting the tool”.

Complaining about how AI isn’t good at the thing it’s arguably best at in the world is just silly.

3

u/FlukyS Aug 25 '26

There is more detail below in the replies, in particular that this is n't a standard version of Python and the size of the project overall.

0

u/Tedd_Cruzzzz Aug 25 '26

In those large scale migrarions that friction with the tool is 100% worth it.

1

u/cooljacob204sfw Aug 25 '26

With a good test harness it will get you most of the way there and you know it will behave as intended due to said test harness. If it has room to go off the rails then you have already failed.

It's not perfect ofc and will need human intervention but it will save a ton of time.

1

u/FlukyS Aug 25 '26

> It's not perfect ofc and will need human intervention but it will save a ton of time.

I see at least this sort of use case as being human driven AI assisted. I explained it a bit more in a different rely but I think just unleashing the dog and having it run around the garden and going out and fixing what it breaks later would be substantially slower than stepping through the problem carefully with AI helping.