Change import

Proprietary

Change a Python import from one module/name to another, updating all type attributions.

org.openrewrite.python.ChangeImport

Required

The module to change imports from

The module to change imports to

Optional

The name to change (for 'from X import name' style). Leave empty for direct imports.

The new name. If not specified, uses the old name.

Optional alias for the new import

mod run . --recipe=org.openrewrite.python.ChangeImport \ -P old_module=collections \ -P new_module=collections.abc

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