Replace re.template() with re.compile() and flag re.TEMPLATE/re.T

Proprietary

re.template() was deprecated in Python 3.11 and removed in 3.13. Calls are auto-replaced with re.compile(). re.TEMPLATE/re.T flags have no direct replacement and are flagged for manual review.

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

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. Find re.TEMPLATE and re.T