described-enum
Python Enums with description property
Install
With pip:
pip install described-enum
With uv:
uv add described-enum
With poetry:
poetry add described-enum
Classes
DescribedEnum– child class ofenum.EnumDescribedIntEnum– child class ofenum.IntEnumDescribedStrEnum– child class ofenum.StrEnum
Usage examples
from described_enum import DescribedIntEnum, DescribedStrEnum
class TaskStatus(DescribedIntEnum):
PENDING = 1, 'Task was created / enqueued'
RUNNING = 2, 'Working on the task'
DONE = 3, 'Success'
FAILED = 4, 'Task failed'
print(TaskStatus.RUNNING.name) # will print str 'RUNNING'
print(TaskStatus.RUNNING.value) # will print int 2
print(TaskStatus.RUNNING.description) # will print str 'Working on the task'
class Format(DescribedStrEnum):
XML = 'xml', 'Extensible Markup Language'
JSON = 'json', 'JavaScript Object Notation'
TOML = 'toml', "Tom's Obvious, Minimal Language"
YAML = 'yml', "YAML Ain't Markup Language"
print(Format.YAML.name) # will print str 'YAML'
print(Format.YAML.value) # will print str 'yml'
print(Format.YAML.description) # will print str "YAML Ain't Markup Language"
Metadata
Release files for described-enum 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| described_enum-0.0.1.tar.gz | 2.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| described_enum-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 6.2 kB
Release files / described_enum-0.0.1.tar.gz
| Download URL | described_enum-0.0.1.tar.gz |
|---|---|
| Size | 2.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
984554834ef702546f5abba29642b0c0e9c20716935f3837fa17916f49168a88
|
|
BLAKE2b-256 checksum How to use checksums |
83f5257de6ecad7d09c57040ae243afda905e5b83d6347cca5c409fed3a6a232
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.8
|
Release files / described_enum-0.0.1-py3-none-any.whl
| Download URL | described_enum-0.0.1-py3-none-any.whl |
|---|---|
| Size | 3.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
59dbe73ea0a92e578d30bfb8f26bb8d8d92f0022349b173eadd6b1cdc452b4d8
|
|
BLAKE2b-256 checksum How to use checksums |
41792928081ce0d8d829341ac4630df74d8d62ad5e7e1debd556ffea3b8b2b39
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.8
|