Misc.Dec 22, 2019
NewVicktree

Migrating to Python 3 easy?

I am a junior web developer (django) and have been contracted to migrate code to python 3. Is migrating easy? Is it due able within 3-ish months for a beginner?

Poll
87 Participants
Select only one answer
Add a comment
New
_95 Dec 22, 2019

Depends on the libraries they have imported and some syntactical differences.. but it's 'due able'

New
Vicktree OP Dec 22, 2019

my hopes is that i do not have to rewrite large portions of code and can just copy and paste. I do believe all the libraries are really old, but we will have to see.

Microsoft wackwack Dec 22, 2019

Just a heads up as English might not be your first language, it’s spelt doable

Capital One Rexxar Dec 22, 2019

Depends on if you do a thorough job or not. You don’t just go in “convert” code. You have to make sure it works correctly in all scenarios. I’ve seen this break multiple times in many places already.

Flatiron Health hnVv57 Dec 22, 2019

If you have some good testing in place, running 2to3 on your projects should be good enough along with some mild cleanup after. Relative imports and python byte types are going to be your main problem I imagine. https://docs.python.org/2/library/2to3.html This shouldn’t result in any massive rewrites though in my experience so far

New
Vicktree OP Dec 22, 2019

thanks, hearing that makes me a little less anxious

Cisco i like me Dec 22, 2019

import migrate migrate.initiate()

New
Vicktree OP Dec 22, 2019

dude trying to put me out a job?

Cisco NnMk28 Dec 22, 2019

Try to add pyenv + pipenv / poetry for reproducibility. Use type hint (>3.7) if you think it is useful for complex function: def divide(x: int, y: int) -> double: # ....

Dropbox DrewH Dec 22, 2019

It depends a huge amount on: How large a codebase Test quality Deployment strategy What libraries you're using

Microsoft flightless Dec 22, 2019

Spend a significant amount of time making sure test coverage is good before doing the flip. If you have 100% test coverage and passing, you can blindly run a converter, run the tests, and you're good in one day. If you have 50% coverage, you can only be sure that half of the system didn't break after converting.

Pure Storage HvFu38 Dec 22, 2019

Due able

New
Vicktree OP Dec 22, 2019

T_T