Upgrade to Python 3.8
Recipe ID
org.openrewrite.python.migrate.UpgradeToPython38Artifactopenrewrite-migrate-pythonMigrate deprecated APIs and detect legacy patterns for Python 3.8 compatibility.
Composite recipepythonmigration3.8Proprietary
Usage
This recipe has no required configuration options. You’ll need the Moderne CLI configured before running the command below.
mod run . --recipe org.openrewrite.python.migrate.UpgradeToPython38If the recipe isn’t available locally, install it with:
mod config recipes pip install openrewrite-migrate-pythonDefinition
This recipe runs the following recipes in order.
- Change import
org.openrewrite.python.ChangeImport - Change import
org.openrewrite.python.ChangeImport - Change import
org.openrewrite.python.ChangeImport - Change import
org.openrewrite.python.ChangeImport - Replace
cgi.parse_qs()withurllib.parse.parse_qs()org.openrewrite.python.migrate.ReplaceCgiParseQs - Replace
cgi.parse_qsl()withurllib.parse.parse_qsl()org.openrewrite.python.migrate.ReplaceCgiParseQsl - Replace
platform.popen()withsubprocess.check_output()org.openrewrite.python.migrate.ReplacePlatformPopen - Find removed
macpathmodule usageorg.openrewrite.python.migrate.FindMacpathModule - Replace
tarfile.filemodewithstat.filemodeorg.openrewrite.python.migrate.ReplaceTarfileFilemode - Change import
org.openrewrite.python.ChangeImport - Find removed
sys.set_coroutine_wrapper()/sys.get_coroutine_wrapper()org.openrewrite.python.migrate.FindSysCoroutineWrapper - Replace
str.format()with f-stringorg.openrewrite.python.migrate.ReplaceStrFormatWithFString - Replace
%formatting with f-stringorg.openrewrite.python.migrate.ReplacePercentFormatWithFString - Find
functools.cmp_to_key()usageorg.openrewrite.python.migrate.FindFunctoolsCmpToKey - Remove obsolete
__future__importsorg.openrewrite.python.migrate.RemoveFutureImports - org.openrewrite.python.migrate.UpgradePythonVersionTo38
org.openrewrite.python.migrate.UpgradePythonVersionTo38