Skip to content

UP035 (deprecated-import) for backports.strenum #8102

@amartani

Description

@amartani

https://pypi.org/project/backports.strenum/ implements a backport of Python 3.11's enum.StrEnum as backports.strenum.StrEnum. It would be nice if UP035 (deprecated-import) added support for replacing it with the original version when targeting 3.11+.

Note that the package instructions already suggests using:

if sys.version_info >= (3, 11):
    from enum import StrEnum
else:
    from backports.strenum import StrEnum

But if someone is not using the conditional import, it would be good for UP035 to clean it up.

Tested on ruff v0.1.1 - https://play.ruff.rs/c973b82b-0107-469b-9b10-9196353b8901

Metadata

Metadata

Assignees

Labels

wishNot on the current roadmap; maybe in the future

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions