int-enum-choices
Helper turning an IntEnum into (value, label) choices with reverse lookups —
handy for Django-style choice fields backed by integer enums.
Installation
pip install entirius-py-int-enum-choices
Usage
from enum import IntEnum
from int_enum_choices import IntEnumChoices
class Color(IntEnum):
RED = 1
GREEN = 2
class ColorChoices(IntEnumChoices):
enumClass = Color
labels = {Color.RED: "Red", Color.GREEN: "Green"}
ColorChoices.choices() # [(1, "Red"), (2, "Green")]
ColorChoices.label(1) # "Red"
ColorChoices.idFromText("red") # Color.RED
ColorChoices.keys() # [1, 2]
Development
make install # sync dependencies (uv)
make check # lint + format check (ruff)
make test # test suite (pytest)
Development and agent instructions: AGENTS.md.
License
Mozilla Public License 2.0 — see LICENSE.
Metadata
Release files for entirius-py-int-enum-choices 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| entirius_py_int_enum_choices-2.0.0.tar.gz | 21.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| entirius_py_int_enum_choices-2.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 29.2 kB
Release files / entirius_py_int_enum_choices-2.0.0.tar.gz
| Download URL | entirius_py_int_enum_choices-2.0.0.tar.gz |
|---|---|
| Size | 21.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
14b02733651f800f58acc34950502832a8f9ef0474b0cb9596eeb2f1b42af490
|
|
BLAKE2b-256 checksum How to use checksums |
1ab28596d7839d0e4fe67588235cc5b6e00e89f52fe32f10a19541c5c2dd8420
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / entirius_py_int_enum_choices-2.0.0-py3-none-any.whl
| Download URL | entirius_py_int_enum_choices-2.0.0-py3-none-any.whl |
|---|---|
| Size | 8.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e53e800e8d988aa2ee3ec079a26c3b01bf9d6d34b6d21192fd59f183f38c9f20
|
|
BLAKE2b-256 checksum How to use checksums |
caa698664b41cf9cf255bab644e8adba6f6bb7be82d3d1523d84024a9d4a2ebf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|