Upgrade to Python 3.8

Proprietary

Migrate deprecated APIs and detect legacy patterns for Python 3.8 compatibility. cgi.escape() becomes html.escape(), with quote=False where the call relied on cgi.escape() leaving quotes alone.

org.openrewrite.python.migrate.UpgradeToPython38
mod run . --recipe=org.openrewrite.python.migrate.UpgradeToPython38

Install it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.

Recipe list

It runs these recipes, in this order.

  1. Change import
  2. Replace cgi.escape() with html.escape()
  3. Replace cgi.parse_qs() with urllib.parse.parse_qs()
  4. Replace cgi.parse_qsl() with urllib.parse.parse_qsl()
  5. Replace platform.popen() with subprocess.check_output()
  6. Find removed macpath module usage
  7. Replace tarfile.filemode with stat.filemode
  8. Find removed sys.set_coroutine_wrapper() / sys.get_coroutine_wrapper()
  9. Replace str.format() with f-string
  10. Replace % formatting with f-string
  11. Find functools.cmp_to_key() usage
  12. Remove obsolete __future__ imports
  13. org.openrewrite.python.migrate.UpgradePythonVersionTo38