← All recipes
Moderne licensed

Find Python types

Recipe IDorg.openrewrite.python.migrate.FindTypes
Artifactorg.openrewrite.recipe:rewrite-migrate-python

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

Single recipeProprietary

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

Options

NameTypeDescription
typeNamerequiredStringA 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
checkAssignabilityBooleanWhen 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