Upgrade to Python 3.10

Proprietary

Migrate 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.

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

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. Upgrade to Python 3.9
  2. Replace collections ABC imports with collections.abc
  3. Replace typing.Optional[X] with X | None
  4. Replace typing.Union[X, Y] with X | Y
  5. Replace threading.currentThread() with threading.current_thread()
  6. Replace threading.activeCount() with threading.active_count()
  7. Replace Condition.notifyAll() with Condition.notify_all()
  8. Replace Event.isSet() with Event.is_set()
  9. Replace Thread.getName() with Thread.name
  10. Replace Thread.setName() with Thread.name = ...
  11. Replace Thread.isDaemon() with Thread.daemon
  12. Replace Thread.setDaemon() with Thread.daemon = ...
  13. org.openrewrite.python.migrate.UpgradePythonVersionTo310