You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support Python enum classes as metric states - #1234
Export member names as string labels, independent of their underlying values. Preserve the enum class when constructing labelled children. Accept member names and aliases; reject empty enum classes and members of a different enum class. Existing string sequences retain their behavior. The documentation specifies these choices and includes an example.
Before: all four new regression tests fail on ff9a2d3: enum classes expose member objects as labels, state() raises AttributeError, and empty enum classes are accepted.
After: the Enum tests pass, including labelled children, aliases, actual text exposition, invalid states, and registry reuse after rejected construction.
Python 3.9.24: 446 tests passed with the optional integrations installed. Python 3.10.19, 3.12.12, 3.13.9 and 3.14.7: 432 passed and 14 optional-dependency tests skipped in each standard tox environment.
tox -e flake8,isort,mypy: passed; mypy reports no issues in 42 files.
Source and wheel builds, installed-wheel state/exposition checks, Python compilation, and git diff --check: passed.
The initial macOS system Python 3.9.6 run failed six existing TLS tests because its SSL library lacks TLS 1.3. The complete run was repeated with isolated Python 3.9.24 and OpenSSL 3.5.4; no tests or TLS checks were changed.
AI assistance: OpenAI Codex assisted with implementation, tests, and validation.
Merge Danger
Door: two-way
Blast Radius: Enum
This adds a constructor input type and member-based state selection. Metric names and existing string-state behavior remain unchanged. Enum classes expose canonical member names, including when selected through an alias.
Summary
Allow a Python
enum.Enumclass to define an Enum metric's states, as requested in #975.Export member names as string labels, independent of their underlying values. Preserve the enum class when constructing labelled children. Accept member names and aliases; reject empty enum classes and members of a different enum class. Existing string sequences retain their behavior. The documentation specifies these choices and includes an example.
Fixes #975. @csmarchbanks
Evidence
ff9a2d3: enum classes expose member objects as labels,state()raisesAttributeError, and empty enum classes are accepted.tox -e flake8,isort,mypy: passed; mypy reports no issues in 42 files.git diff --check: passed.The initial macOS system Python 3.9.6 run failed six existing TLS tests because its SSL library lacks TLS 1.3. The complete run was repeated with isolated Python 3.9.24 and OpenSSL 3.5.4; no tests or TLS checks were changed.
AI assistance: OpenAI Codex assisted with implementation, tests, and validation.
Merge Danger
Door: two-way
Blast Radius: Enum
This adds a constructor input type and member-based state selection. Metric names and existing string-state behavior remain unchanged. Enum classes expose canonical member names, including when selected through an alias.