Registry / serialization / enum-compat

enum-compat

JSON →
library0.0.3pypypi✓ verified 26d ago

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.

pip install enum-compat
INSTALL
IMPORT
SIG · ENUM-COMPAT
E
enum-compat
serializationpythonv0.0.3
Install
1.6s avg
Import
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.0.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 17.8MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.6s · import 0.000s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Enum
from enum import Enum
enum-compat itself does not provide symbols for direct import; its purpose is to ensure `from enum import Enum` works correctly across Python versions by conditionally installing enum34.

This quickstart demonstrates the usage of Python's `enum.Enum` type, which `enum-compat` ensures is available. On Python 3.4+ this comes from the standard library; on older versions, `enum-compat` makes the `enum34` backport available as `enum`.

from enum import Enum class Color(Enum): RED = 1 GREEN = 2 BLUE = 3 print(Color.RED) print(Color.RED.value) print(Color.GREEN.name)
Debug
Known issues
breakingThe `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`.
fix
Remove `enum-compat` from your dependencies. Instead, specify `enum34` conditionally for Python versions less than 3.4 directly in your `setup.py` or `pyproject.toml`.
affects: All versions
gotchaOn 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.
fix
Ensure your project's dependency management (e.g., `setup.py`, `pyproject.toml`) only installs `enum34` when `python_version < "3.4"`.
affects: Python 3.4 and newer
deprecatedThe `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).
fix
Modern Python projects (Python 3.8+) should directly use the built-in `enum` module. For projects requiring Python 3.4-3.7, `enum` is built-in. Only very old projects requiring Python < 3.4 might have a legitimate, though discouraged, reason to use `enum34` directly.
affects: All versions
Errors
Common errors & fixes
ImportError: No module named enum
This error typically occurs when attempting to use `enum.Enum` in Python 2.x or Python 3.3, and the `enum34` backport (which `enum-compat` is designed to install on these older versions) is not present or improperly installed.
fix
Ensure `enum-compat` (or directly `enum34`) is installed for Python versions older than 3.4: `pip install enum-compat` or `pip install enum34`.
AttributeError: module 'enum' has no attribute 'IntFlag'
This error frequently happens in Python 3.6 and later because the `enum34` backport (which `enum-compat` installs for older Python versions) is still installed and shadowing the standard library `enum` module. The `enum34` backport lacks newer features like `IntFlag` (added in Python 3.6).
fix
Uninstall `enum34` and `enum-compat` from your Python 3.4+ environment: `pip uninstall enum34 enum-compat`. The standard library `enum` module will then be used, which includes `IntFlag` and other newer features.
Installing enum package causes pip to not work
Installing the `enum` package (often referring to `enum34`) on Python 3.x can interfere with `pip` itself, leading to further installation failures due to `ImportError` or `AttributeError` within `pip`'s operations. This happens because `enum34` can shadow critical standard library modules `pip` relies on.
fix
If `pip` is still functional, run `pip uninstall enum enum34`. If `pip` is broken, you may need to manually locate and delete the `enum.py` or `enum34` directory from your `site-packages` and then reinstall `pip`. For projects, use conditional dependencies like `enum34; python_version < "3.4"` in `requirements.txt` or `setup.py` to prevent `enum34` from being installed on Python 3.4+.
Upgrade
Version history
0.0.3latest on PyPI · released Oct 14, 2019
Audit
Dependencies
enum34requiredProvides the Enum type for Python versions older than 3.4. Installed conditionally.
Agent activity
9 hits · last 30 days
node
8
Resources
enum-compat — pip install enum-compat · libregistry