matrix-enum
Data structure for multi-dimensional enums
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-enumuv
uv add matrix-enumpoetry
poetry add matrix-enumInstalling 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
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
enum-toolsProvides utilities to enhance Python's enum…
copyleft · top 5,000 on PyPI
pysubtypesProvides enhanced subclasses for Python…
permissive · top 15,000 on PyPI
backports.strenumProvides StrEnum, a string-based enumeration…
permissive · top 5,000 on PyPI
aenumaenum provides advanced enumeration types…
permissive · top 1,000 on PyPI
ordered-enumAdds comparison operators to Python enums so…
unclear · top 15,000 on PyPI
django-enumfieldsProvides Django model fields that store Python…
permissive · top 15,000 on PyPI
enum34Provides enumeration support for older Python…
permissive · top 5,000 on PyPI
StrEnumStrEnum is a string-based enum class that…
permissive · top 1,000 on PyPI
alembic-postgresql-enumExtends Alembic to automatically detect and…
permissive · top 5,000 on PyPI
marshmallow-enumProvides an Enum field type for Marshmallow…
permissive · top 5,000 on PyPI