Linux distributions and Python 2
Linux distributions and Python 2
Posted Jun 11, 2018 20:19 UTC (Mon) by malefic (guest, #37306)In reply to: Linux distributions and Python 2 by Cyberax
Parent article: Linux distributions and Python 2
Having migrated numerous codebases, I disagree. For high quality codebases with decent test coverage the migration is straightforward. Instagram, which isn't small by any metric, had made their transition with several months worth of work by a few engineers (https://www.youtube.com/watch?v=66XoCk79kjM)
> gains you pretty much nothing.
A decade of language development is not "nothing". Even if you don't care about numerous language improvements, the real-world performance gains alone are a very good reason to upgrade (https://twitter.com/victorstinner/status/865973964421476352, https://bit.ly/2JEIzkh)
Posted Jun 11, 2018 20:37 UTC (Mon)
by Cyberax (✭ supporter ✭, #52523)
[Link]
You can't say beforehand if your codebase is going to do any better with Py3. I've seen it go both ways.
Posted Jun 12, 2018 5:54 UTC (Tue)
by k8to (guest, #15413)
[Link]
I've brought very significant codebases to 3 without any significant pain, just cleanups that should have been done anyway, and I've also had code that required huge pain because it wanted to deal mostly with byte strings, but so much of the python3 library doesn't want byte strings.
Posted Jun 14, 2018 3:48 UTC (Thu)
by lambda (subscriber, #40735)
[Link] (3 responses)
Good thing that most code out there is a high-quality code base with decent test coverage then, right?
I just ported a 750 line script from Python 2 to Python 3; it's only fairly recently that I've found there are enough reasons to do so (in this case, availability of Python 3 and not Python 2 in the base install of our distro, plus the typing module and mypy to add static types), and enough barriers have been removed.
Here are the steps I went through to make sure the port was working:
And this is for a fairly simple little script, dealing with some files which just contain ASCII text and ASCII filenames.
Our main codebase uses Twisted, using PB and Jelly to pass objects over the network. There were no automated tests when I started at the company, and while we've been trying to add tests for new features or code that we're touching, we still have pretty poor coverage. Additionally, it's is a networked application that also has to interact with networked filesystems on Windows, macOS, and GNU/Linux, which makes the encoding issues even more fun to deal with. Oh, and most of what is jellied and shared between systems consists of dicts, with different value types for different keys.
At some point, we are going to have to port this to Python 3, but I imagine it's going to take a long time, cause a lot of grief for the developers in the process, and still probably cause regressions for customers even if we're as thorough as we can be by adding unit tests, integration tests, and type annotations.
Posted Jun 15, 2018 15:13 UTC (Fri)
by togga (subscriber, #53103)
[Link] (2 responses)
Start try to reuse existing python modules from another more "down to earth" language like go and then migrate away is my tip. Python language is obviously not long term stable. Linux distributions and Python 2
Linux distributions and Python 2
Linux distributions and Python 2
For high quality codebases with decent test coverage the migration is straightforward
Linux distributions and Python 2