Upgrade to Python 3.10
Recipe ID
org.openrewrite.python.migrate.UpgradeToPython310Artifactopenrewrite-migrate-pythonMigrate deprecated APIs and adopt new syntax for Python 3.10 compatibility. This includes adopting PEP 604 union type syntax (X | Y) and other modernizations between Python 3.9 and 3.10.
Composite recipepythonmigration3.10Proprietary
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.UpgradeToPython310If 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.
- Upgrade to Python 3.9
org.openrewrite.python.migrate.UpgradeToPython39 - Replace
collectionsABC imports withcollections.abcorg.openrewrite.python.migrate.ReplaceCollectionsAbcImports - Replace
typing.Optional[X]withX | Noneorg.openrewrite.python.migrate.ReplaceTypingOptionalWithUnion - Replace
typing.Union[X, Y]withX | Yorg.openrewrite.python.migrate.ReplaceTypingUnionWithPipe - Replace
threading.currentThread()withthreading.current_thread()org.openrewrite.python.migrate.ReplaceThreadingCurrentThread - Replace
threading.activeCount()withthreading.active_count()org.openrewrite.python.migrate.ReplaceThreadingActiveCount - Replace
Condition.notifyAll()withCondition.notify_all()org.openrewrite.python.migrate.ReplaceConditionNotifyAll - Replace
Event.isSet()withEvent.is_set()org.openrewrite.python.migrate.ReplaceEventIsSet - Replace
Thread.getName()withThread.nameorg.openrewrite.python.migrate.ReplaceThreadGetName - Replace
Thread.setName()withThread.name = ...org.openrewrite.python.migrate.ReplaceThreadSetName - Replace
Thread.isDaemon()withThread.daemonorg.openrewrite.python.migrate.ReplaceThreadIsDaemon - Replace
Thread.setDaemon()withThread.daemon = ...org.openrewrite.python.migrate.ReplaceThreadSetDaemon - org.openrewrite.python.migrate.UpgradePythonVersionTo310
org.openrewrite.python.migrate.UpgradePythonVersionTo310