Enum Compat
A 'virtual' package (version 0.0.3) designed to provide `enum.Enum` compatibility across Python versions. Its sole purpose is to install the `enum34` backport on Python versions older than 3.4. On Python 3.4 and later, it acts as a no-op, as `enum` is part of the standard library. The project's last release was in October 2019, and it has no active development or release cadence.
Warnings
- breaking The `enum-compat` package is explicitly discouraged for direct use by its maintainer. You should directly depend on `enum34` with a version specifier for older Python versions (e.g., `'enum34; python_version < "3.4"'`) in your `install_requires` instead of `enum-compat`.
- gotcha On Python 3.4 and newer, `enum` is part of the standard library. Installing `enum-compat` (or `enum34`) on these versions is redundant and serves no functional purpose, potentially leading to confusion about the source of the `enum` module.
- deprecated The `enum-compat` package has not seen updates since 2019 and explicitly recommends against its own use. It targets a compatibility problem for Python versions that are now past their end-of-life (Python 2.x, Python 3.0-3.3).
Install
-
pip install enum-compat
Imports
- Enum
from enum import Enum
Quickstart
from enum import Enum
class Color(Enum):
RED = 1
GREEN = 2
BLUE = 3
print(Color.RED)
print(Color.RED.value)
print(Color.GREEN.name)