enum-tools
Tools to expand Python's enum module.
What it is and what it does
enum_tools extends Python's standard enum module with three main components: a Sphinx extension (autoenum) that documents enums more effectively than the default autoclass directive, a decorator (@document_enum) that extracts docstrings for enum members from inline comments, and custom enum classes with additional functionality. The package is primarily useful for projects that use enums extensively and need better documentation generation or want to attach metadata to enum members without boilerplate.
It depends on pygments for syntax highlighting and typing-extensions for type hints, both lightweight and widely available. The package supports Python 3.7 through 3.13 and is actively maintained. It's particularly relevant for library authors and projects with complex enum hierarchies that need clear, auto-generated documentation.
Use it for:
- Generate Sphinx documentation for enum classes automatically with better formatting than the default autoclass directive.
- Add descriptive docstrings to individual enum members using inline comments with the @document_enum decorator.
- Build custom enum subclasses with extended behavior beyond the standard Enum class for domain-specific use cases.
- Maintain enum documentation in sync with code by extracting member descriptions from source comments.
- Support type-checked enum definitions across Python 3.7+ projects with full typing support.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides utilities to enhance Python's enum module with better Sphinx documentation, member docstrings via decorators, and custom enum classes with extended functionality.
Yes, if you use enums in a documented project or need custom enum behavior. The low install friction, active maintenance, and lack of known vulnerabilities make it safe to adopt. The copyleft license (LGPL-3.0-or-later) is a consideration for proprietary code but not a barrier for open-source projects. Install it when Sphinx documentation or member docstrings would improve your codebase clarity.
Install
enum-tools on PyPI
pip
pip install enum-toolsuv
uv add enum-toolspoetry
poetry add enum-toolsInstalling enum-tools
Before you install
Low install friction with only two lightweight runtime dependencies (pygments and typing-extensions). Actively maintained with recent commits and a stable Beta status.
License in practice
Licensed under LGPL-3.0-or-later (copyleft). Derivative works and distributions must preserve the license and source availability; suitable for open-source projects but requires careful review in proprietary contexts.
Quickstart
pip install enum_tools
from enum_tools.documentation import document_enum
from enum import Enum
@document_enum
class Color(Enum):
RED = 1 # The color red
BLUE = 2 # The color blue
Requires Python 3.7 or later; Sphinx extension use requires Sphinx to be installed separately in your documentation build environment.
Verify before relying
- Specific capabilities of custom_enums classes and how they differ from standard Enum beyond what the description states.
- Whether the Sphinx extension (autoenum) works with all Sphinx versions or has version constraints.
- Performance characteristics or limitations when documenting large enum hierarchies.
Package facts
| License | LGPL-3.0-or-later (copyleft) |
| Python support | supports the current Python release (>=3.7) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — pygments, typing-extensions |
| Maintenance | actively maintained — 484 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,401,832/month — #3,949 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: enum_tools-0.13.0-py3-none-any.whl
Keywords: documentation, enum, sphinx, sphinx-extension
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
attributes-docExtracts and stores docstrings for class…
permissive · top 15,000 on PyPI
matrix-enumExtends Python's built-in Enum to support…
permissive · top 15,000 on PyPI
sphinx-toolboxSphinx-toolbox extends Sphinx with a collection…
permissive · top 15,000 on PyPI
backports.strenumProvides StrEnum, a string-based enumeration…
permissive · top 5,000 on PyPI
astatineAstatine provides helper functions and…
permissive · top 15,000 on PyPI
domdf-python-toolsA collection of utility functions and helpers…
permissive · top 5,000 on PyPI
ordered-enumAdds comparison operators to Python enums so…
unclear · top 15,000 on PyPI
pysubtypesProvides enhanced subclasses for Python…
permissive · top 15,000 on PyPI
enum34Provides enumeration support for older Python…
permissive · top 5,000 on PyPI
numpydocA Sphinx extension that parses and renders…
permissive · top 5,000 on PyPI