Skip to main content

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 of enum.Enum
  • DescribedIntEnum – child class of enum.IntEnum
  • DescribedStrEnum – child class of enum.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


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)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

described_enum-0.0.1-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

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

Hashes for described_enum-0.0.1.tar.gz
Algorithm Hash digest
SHA256 984554834ef702546f5abba29642b0c0e9c20716935f3837fa17916f49168a88
MD5 5d4f038b7cb8718bdb127bb64ebd4fdb
BLAKE2b-256 83f5257de6ecad7d09c57040ae243afda905e5b83d6347cca5c409fed3a6a232

See more details on using hashes here.

File details

Details for the file described_enum-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for described_enum-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 59dbe73ea0a92e578d30bfb8f26bb8d8d92f0022349b173eadd6b1cdc452b4d8
MD5 924748bcae8cc63d180a3f7256ec6a82
BLAKE2b-256 41792928081ce0d8d829341ac4630df74d8d62ad5e7e1debd556ffea3b8b2b39

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page