Registry / serialization / ordered-enum

ordered-enum

JSON →
library0.0.10pypypi✓ verified 35d ago

A small library for adding total orderings to enums, providing an OrderedEnum base class that supports comparison operators (<, <=, >, >=) based on member definition order. Version 0.0.10, released in 2024, requires Python >=3.9. Maintained with infrequent releases.

serialization
Install & Compatibility
Where this runs
tested against v0.0.10 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 17.8MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.8s · import 0.000s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Correct import path is 'ordered_enum' (with underscore), not 'ordered_enum'.

from ordered_enum import OrderedEnum

Define an enum with ordered comparisons based on member declaration order.

from ordered_enum import OrderedEnum class Color(OrderedEnum): RED = 0 GREEN = 1 BLUE = 2 assert Color.RED < Color.GREEN assert Color.BLUE > Color.RED print("Ordering works!")
Debug
Known footguns
breakingComparison operators (<, <=, >, >=) only work between members of the same OrderedEnum subclass. Comparing across different OrderedEnum subclasses raises TypeError.
gotchaOrderedEnum does not support integer comparison with enum values. For example, Color.RED < 1 will raise TypeError. This is by design and differs from Python's standard IntEnum.
deprecatedThe package is not actively maintained; no updates since 2024. Consider alternatives like stdlib IntEnum if integer ordering is needed.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
15 hits · last 30 days
gptbot
4
ahrefsbot
4
amazonbot
4
claudebot
2
script
1
Resources