Find Python types
Recipe ID
org.openrewrite.python.migrate.FindTypesArtifact
org.openrewrite.recipe:rewrite-migrate-pythonFind type references by name. Identifies classes matching a type pattern. In Python, all type definitions use the class keyword, covering regular classes, abstract base classes, protocols, enums, dataclasses, named tuples, typed dicts, and more.
Usage
You’ll need the Moderne CLI configured before running the command below.
mod run . --recipe org.openrewrite.python.migrate.FindTypes --recipe-option "typeName=OrderedDict"If the recipe isn’t available locally, install it with:
mod config recipes jar install org.openrewrite.recipe:rewrite-migrate-python:0.11.0Options
| Name | Type | Description |
|---|---|---|
typeNamerequired | String | A type name used to find matching type references. Can be a simple class name (e.g., OrderedDict) or a module-qualified name (e.g., collections.OrderedDict). Simple names match against the class name only, while qualified names match against the full module path. Supports glob expressions. collections..* finds every type from every submodule of the collections module.e.g. OrderedDict |
checkAssignability | Boolean | When enabled, find type references that are assignable to (i.e., subclasses of) the provided type. |
Data tables
Structured output this recipe can produce.
- Type usesThe source code of matching type uses.
org.openrewrite.java.table.TypeUses - Source files that had resultsSource files that were modified by the recipe run.
org.openrewrite.table.SourcesFileResults - Source files that had search resultsSearch results that were found during the recipe run.
org.openrewrite.table.SearchResults - Source files that errored on a recipeThe details of all errors produced by a recipe run.
org.openrewrite.table.SourcesFileErrors - Recipe performanceStatistics used in analyzing the performance of recipes.
org.openrewrite.table.RecipeRunStats