Python Forum
how difficult its to move to Python 3.8 from Python 2.7
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how difficult its to move to Python 3.8 from Python 2.7
#1
Hello All,
I am working for a health insurance company as a python developer and we were using python 2.7 and willing to move to Python 3.8 as soon as possible due to the EOL of Python 2. We have a big mobile service using Python 2. I am not a big expert in this and would like to know How difficult its and what are the typical issues in this regard.
Thanks in advance,
Kumar
Reply
#2
It really depends on your project. Start with 2to3, which will do a lot of the tedious work for you, and test thoroughly.

In my experience, half or more of the effort is dealing with bytes vs str. I recommend you use type hinting and mypy to go back and validate those parts of your code.

A lot of people find the migration difficult enough that they've waited this long, so I don't want to suggest that it's going to be easy. I'd love it if you post back here with any findings though, it might inspire a tutorial on doing such a migration.
Reply
#3
(Jan-22-2020, 10:06 PM)micseydel Wrote: It really depends on your project. Start with 2to3, which will do a lot of the tedious work for you, and test thoroughly. In my experience, half or more of the effort is dealing with bytes vs str. I recommend you use type hinting and mypy to go back and validate those parts of your code. A lot of people find the migration difficult enough that they've waited this long, so I don't want to suggest that it's going to be easy. I'd love it if you post back here with any findings though, it might inspire a tutorial on doing such a migration.
Hello micseydel, Thanks for the response. So, does it mean we can use the old code for the existing app?
And also the error we are getting is ERROR: Package 'setuptools' requires a different Python: 2.7.12 not in '>=3.5'
does it mean the issue is with the setuptools only or any others?
Reply
#4
can you explain what program, application, script etc you are attempting to run when you generate the error regarding 'setuptools'? I want to know what you are running and how you are running it. what operating system are you using and if you are telnet ssh vm remote etc.. what environment are you remote into? example: "using putty on windows to ssh into a linux server in the cloud running a shell script to install a custom built medical application from source. some of the required libraries are compiled to binary with gcc and some are python2.7 libraries that do not need to be compiled"

you might find that your installer is python but your application is written in something else. they do this because some programmers do not write scripts in bash.

we need a lot more information before we can see where it performs the version check. we can override the check. we also need to check dependencies. then we need to scan the code for functions that can only work in python 2.7. depending on your situation it could be easy or it could be hard.
Reply
#5
First you should check all external dependencies (Modules), if they available for Python 3 and still maintained.
If all dependencies still available for Python 3, you've luck. If there is a dependency, which has no candidate for Python 3, you must find a replacement.

Then comes str vs bytes
Improved Syntax for Exceptions
Absolute imports vs relative Imports

The tool 2to3 can help, but in the most cases you have to do the rest by hand.
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  mouse move event/cinfiguration ttk/python janeik 4 1,060 Jul-03-2023, 05:30 PM
Last Post: deanhystad
  python move specific files from source to destination including duplicates mg24 3 1,096 Jan-21-2023, 04:21 AM
Last Post: deanhystad
  difficult string conversion need help Pir8Radio 3 1,052 Nov-27-2022, 06:15 PM
Last Post: Gribouillis
  python move folders and subfolders not working mg24 5 2,159 Nov-09-2022, 02:24 PM
Last Post: Larz60+
  creating simplex tableau pivot program easy or difficult for a beginner in Python? alex_0 2 2,570 Mar-31-2021, 03:39 AM
Last Post: Larz60+
  How to solve difficult non-linear equations? shreeniket 3 2,380 Apr-23-2020, 01:36 AM
Last Post: shreeniket
  Programming Difficult math in Python Huntern 6 4,755 Oct-17-2019, 06:32 AM
Last Post: Huntern
  Very difficult challenge for me cristfp 1 2,742 Apr-01-2019, 08:45 PM
Last Post: Yoriz
  How can I move in an external program via Python? Pythoner 0 2,271 Dec-29-2018, 12:43 PM
Last Post: Pythoner
  Why is basic Twitter Connectivity So Difficult? Not sure what I'm doing wrong. Oliver 0 1,882 Mar-10-2018, 12:38 PM
Last Post: Oliver

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020