skillfed

matrix-enum

Data structure for multi-dimensional enums

matrix-enum v1.1.0 115.3K downloads/30d#12,261 on PyPI10
Permissive license MIT Abandoned released

What it is and what it does

MatrixEnum is a wrapper around Python's standard Enum that lets you define enum members with multiple named attributes instead of a single value. Each member is constructed using a Member object that holds arbitrary key-value pairs, and all members must have the same set of attributes with globally unique values across all attributes. The package automatically makes enum members reversible—you can look up a member by any of its attribute values, not just by name.

The main use case is when you need an enum where each entry has several related pieces of data (like a status code, a display label, and a database ID) and you want to retrieve enum members by any of those values interchangeably. It also supports an `extra()` method to attach duplicate-allowed metadata to members. The package depends on six and enum34 for compatibility, though it is no longer maintained as of late 2020.

Use it for:

  • Define a status enum with code, label, and description attributes, then look up by any of them.
  • Create a mapping of HTTP status codes to reason phrases and canonical names, retrievable by any dimension.
  • Build an animal classification enum with scientific name, common name, and taxonomy ID, queryable by each.
  • Store role definitions with numeric ID, string name, and permission level, with reversible lookups.
  • Represent currency data (code, symbol, name) in a single enum with multi-way lookup.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Extends Python's built-in Enum to support multi-dimensional enum members with multiple attributes and reversible lookups by any attribute value.

No. The package is abandoned (last commit May 2023, last release December 2020) with no active maintenance. While it works for its narrow use case and has no known vulnerabilities, the lack of updates means it will not adapt to future Python versions or address any bugs that emerge. For new projects, prefer a maintained alternative or implement multi-dimensional enum logic directly using dataclasses or a simple wrapper.

Install

matrix-enum on PyPI

pip

pip install matrix-enum

uv

uv add matrix-enum

poetry

poetry add matrix-enum

Installing matrix-enum

Before you install

Low friction installation with only two lightweight runtime dependencies (six and enum34). However, the package is abandoned—last commit was 2023-05-17 and no releases since 2020-12-04, so expect no maintenance or updates for bugs or compatibility issues.

License in practice

MIT license is permissive and places no restrictions on use, modification, or distribution in proprietary or open-source projects.

Quickstart

pip install matrix_enum

from matrix_enum import MatrixEnum, Member

class Status(MatrixEnum):
    ACTIVE = Member(code=1, label='active')
    INACTIVE = Member(code=2, label='inactive')

print(Status.ACTIVE.code)  # 1
print(Status(1) is Status.ACTIVE)  # True

Requires Python 2.7 or 3.4+; abandoned status means no support for modern Python versions beyond 3.7.

Verify before relying

  • Whether the package works correctly with Python versions released after 3.7 (last tested version in classifiers).
  • Real-world performance or stability issues that may have emerged since the last release in December 2020.
  • Whether six and enum34 dependencies remain compatible with current Python ecosystems.

Package facts

License MIT (permissive)
Python support supports the current Python release (>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, <4)
Install friction low — pure-Python wheel
Runtime dependencies 2 — six, enum34
Maintenance abandoned — 2,079 days since the last release
Last repo commit
First released
Downloads 115,281/month — #12,261 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: matrix_enum-1.1.0-py2.py3-none-any.whl

Keywords: enum

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseNatural Language :: EnglishProgramming Language :: PythonProgramming Language :: Python :: 2Programming Language :: Python :: 2.7Programming Language :: Python :: 3Programming Language :: Python :: 3.4Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: Libraries :: Python ModulesTopic :: Utilities

Tags

multi-dimensional enumsenum with multiple attributesreversible enum lookupenum member attributespython enum extensionstructured enum valuesenum with named fields
enum-extensionabandoned

More Python Modules packages