{"id":21669,"library":"ordered-enum","title":"ordered-enum","description":"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.","status":"active","version":"0.0.10","language":"python","source_language":"en","source_url":"https://github.com/woodruffw/ordered_enum","tags":["enum","ordered-enum","ordering","python3"],"install":[{"cmd":"pip install ordered-enum","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"Correct import path is 'ordered_enum' (with underscore), not 'ordered_enum'.","wrong":"from ordered_enum import OrderedEnum as OE","symbol":"OrderedEnum","correct":"from ordered_enum import OrderedEnum"}],"quickstart":{"code":"from ordered_enum import OrderedEnum\n\nclass Color(OrderedEnum):\n    RED = 0\n    GREEN = 1\n    BLUE = 2\n\nassert Color.RED < Color.GREEN\nassert Color.BLUE > Color.RED\nprint(\"Ordering works!\")","lang":"python","description":"Define an enum with ordered comparisons based on member declaration order."},"warnings":[{"fix":"Ensure comparisons only within the same enum class.","message":"Comparison operators (<, <=, >, >=) only work between members of the same OrderedEnum subclass. Comparing across different OrderedEnum subclasses raises TypeError.","severity":"breaking","affected_versions":">=0.0.1"},{"fix":"Use the .value attribute for numeric comparisons: Color.RED.value < 1.","message":"OrderedEnum 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.","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"For simple ordered enums, use Python's IntEnum with auto() and custom ordering, or use another library.","message":"The package is not actively maintained; no updates since 2024. Consider alternatives like stdlib IntEnum if integer ordering is needed.","severity":"deprecated","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Use correct import: from ordered_enum import OrderedEnum","cause":"Mistyped import: using 'ordered-enum' (hyphen) or misspelling","error":"AttributeError: module 'ordered_enum' has no attribute 'OrderedEnum'"},{"fix":"Ensure both operands are members of the same OrderedEnum subclass.","cause":"Attempting comparison between two different OrderedEnum subclasses or between OrderedEnum and a non-enum value.","error":"TypeError: '<' not supported between instances of 'Color' and 'Color'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}