Update to Python3
Created by: Zach DeCook
This script is immensely useful. Since python2 is going to retire at the beginning of next year, we should make an effort to update this script.
While most distributions are still shipping with python2
installed as the default python
, eventually this will not be the case, and eventually installing python2
as a separate package will not be possible.
Imported comments:
By Silas S. Brown on 2019-11-21T10:28:07.100Z
closed via commit ead21428
By Zach DeCook on 2019-10-09T01:02:25.055Z
Tauthon related: I was unable to get pytest to run in Tauthon (https://gitlab.com/earboxer/lexconvert/-/jobs/315372987), so you're right about it being more of a hassle.
By Zach DeCook on 2019-10-03T03:54:39.126Z
mentioned in issue #3 (closed)
By Silas S. Brown on 2019-09-30T19:38:44.631Z
Thanks. One thing we perhaps should note is it says python-future requires Python 2.6+. I had been aiming for a minimum of Python 2.3 because I wasn't aware of a newer version on RISC OS, although having said that I haven't actually tested lexconvert on 2.3 for a while, nor have I double-checked the RISC OS situation for a while, so perhaps we should re-think that. I did just try lexconvert with Python 2.5 and it still seems to work OK on 2.5, which might help on some old Macs.
The python-future page also mentions an alternative called python-modernize, which has a minimum requirement of Python 2.4 although it needs a package called six. But the other worry (for both python-modernize and python-future) is "how do we get these extra packages on a system that doesn't already have them", because Pip says it will drop support for 2.x in January, so, unless it can be manually installed without too much trouble, we can't really expect users of old computers to be able to "pip install" something.
I suppose if all else fails we can simply keep two versions of the script: a Python 3 one for going forward, and a Python 2 one for backward compatibility. And we say "the current Python 2 version isn't going away, and if we feel nice we might even back-port new changes to it, but don't hold us to that".
By Zach DeCook on 2019-09-30T01:32:08.611Z
Maybe look at Python-Future
http://python-future.org/faq.html#relationship-between-python-future-and-other-compatibility-tools
https://python-future.org/compatible_idioms.html#essential-syntax-differences
By Silas S. Brown on 2019-09-29T19:41:31.151Z
I totally agree a Python 3 version would be good. It would also be nice to keep the Python2 version around for a while, for the benefit of users who still have old Macs which shipped with Python2 (--mac-uk option etc), since installing Python3 on these will be extra hassle, and upgrading macOS is not an option if your hardware's too old. On the other hand, new Macs sold after 2020 will not be bundled with any version of Python, so up-to-date Mac users will start having to install their own bundles anyway.
As far as I can tell, the schedule is:
- 2020: end of upstream Python 2 support
- 2023: end of free support of Ubuntu 18.04 LTS (which has Python2)
- 2024: end of life for Red Hat RHEL7 and CentOS 7 (which has Python2), and probable end of Debian support
- 2028: end of extended commercial support for 18.04 LTS
Forks like Tauthon might be supported for longer, but might be more of a hassle to set up.
It's theoretically possible to write code that will run on both Python 2 and Python 3, but that could be a bit of a nightmare. But I do wonder if it might be possible to make the 2to3 tool work reliably for our case (perhaps by finding a suitable configuration for it), meaning for a while we could have both Python2 and Python3 versions on the go simultaneously, with the Python3 being automatically generated from the Python2. But perhaps I'm being silly and it's better just to replace the code.
By Zach DeCook on 2019-09-28T14:47:54.292Z
mentioned in issue #2 (closed)