Replace typing.Set with set
Recipe ID
org.openrewrite.python.migrate.ReplaceTypingSetWithSetArtifactopenrewrite-migrate-pythonPEP 585 deprecated typing.Set in Python 3.9. Replace it with the built-in set wherever a type is expected, including class base lists, where either spelling subclasses set. Applies inside if TYPE_CHECKING: blocks as well; the built-in generic is valid at runtime from Python 3.9 on, so no from __future__ import annotations is needed. References in a value position are left alone: typing.Set and set are distinct objects, so substituting one for the other where the name is used as a value would change behaviour.
Single recipeProprietary
Usage
This recipe has no required configuration options. You’ll need the Moderne CLI configured before running the command below.
mod run . --recipe org.openrewrite.python.migrate.ReplaceTypingSetWithSetIf the recipe isn’t available locally, install it with:
mod config recipes pip install openrewrite-migrate-python