Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add emit_str_enum config option #66

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

devstein
Copy link

@devstein devstein commented Dec 16, 2024

Description

Add emit_str_enum config option to change generate enums to use enum.StrEnum, which implements __str__ and string comparison checks for users.

New Behavior

with emit_str_enum

class Status(enum.StrEnum):
    """Venues can be either open or closed"""
    OPEN = "op!en"
    CLOSED = "clo@sed"

without emit_str_enum (current behavior)

class Status(str, enum.Enum):
    """Venues can be either open or closed"""
    OPEN = "op!en"
    CLOSED = "clo@sed"

Todos

  • Add documentation
  • Add tests

@devstein devstein changed the title [WIP] feat: add emit_str_enum config option feat: add emit_str_enum config option Jan 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant