Python Enums with description property
Project description
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"
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
described_enum-0.0.1.tar.gz
(2.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file described_enum-0.0.1.tar.gz.
File metadata
- Download URL: described_enum-0.0.1.tar.gz
- Upload date:
- Size: 2.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
984554834ef702546f5abba29642b0c0e9c20716935f3837fa17916f49168a88
|
|
| MD5 |
5d4f038b7cb8718bdb127bb64ebd4fdb
|
|
| BLAKE2b-256 |
83f5257de6ecad7d09c57040ae243afda905e5b83d6347cca5c409fed3a6a232
|
File details
Details for the file described_enum-0.0.1-py3-none-any.whl.
File metadata
- Download URL: described_enum-0.0.1-py3-none-any.whl
- Upload date:
- Size: 3.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
59dbe73ea0a92e578d30bfb8f26bb8d8d92f0022349b173eadd6b1cdc452b4d8
|
|
| MD5 |
924748bcae8cc63d180a3f7256ec6a82
|
|
| BLAKE2b-256 |
41792928081ce0d8d829341ac4630df74d8d62ad5e7e1debd556ffea3b8b2b39
|