Registry / serialization / enum34

enum34

JSON →
library1.1.10pypypi✓ verified 26d ago

`enum34` backports the `enum.Enum` class from Python 3.4 to older Python versions (2.4-3.3), enabling the use of enumerated types across diverse legacy environments. It also includes selected features from newer Python `enum` modules, such as `auto()` and `Flag` from Python 3.6. The library is currently at version 1.1.10, and due to its nature as a backport, active development has ceased, though it remains functional and stable for its intended purpose.

pip install enum34
INSTALL
IMPORT
SIG · ENUM34
E
enum34
serializationpythonv1.1.10
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 v1.1.10 · 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
from enum34 import Enum
IntEnum
from enum import IntEnum
from enum34 import IntEnum
auto
from enum import auto
from enum34 import auto

Defines a basic `Enum` using `auto()` for automatic value assignment and demonstrates accessing members by name, value, and iteration.

from enum34 import Enum, auto class Color(Enum): RED = auto() GREEN = auto() BLUE = auto() def __str__(self): return self.name.lower() print(f"First color: {Color.RED}") print(f"Value of GREEN: {Color.GREEN.value}") print(f"Access by value (1): {Color(1)}") print(f"Iterating through colors:") for color in Color: print(f"- {color.name}: {color.value}")
Debug
Known issues
breaking`enum34` should NOT be used on Python 3.4 or newer. Python 3.4 introduced the `enum` module into the standard library. Using `enum34` on these versions can lead to conflicts, unexpected behavior, or unnecessary overhead. Always use the built-in `enum` module for Python 3.4+.
fix
Remove `enum34` from your dependencies and switch to `from enum import Enum` (or `IntEnum`, `auto`, etc.) for Python 3.4 and later.
affects: Python >= 3.4
gotchaWhile `enum34` primarily backports `Enum` from Python 3.4, it also includes features like `auto()`, `Flag`, and `StrEnum` which were introduced in later Python versions (3.6 and 3.11 respectively). Be aware that the behavior of these backported features might have subtle differences or limitations compared to their native implementations in newer Python versions.
fix
Thoroughly test your enum implementations, especially when using advanced features like `auto()` or `Flag`, if targeting a wide range of Python versions or migrating to/from native `enum`.
affects: All versions when comparing to native `enum` in Python >= 3.6/3.11
deprecatedFor all new Python projects or projects targeting Python 3.4 or newer, `enum34` is obsolete. Its sole purpose is to provide `enum` functionality to legacy Python 2 and early Python 3 environments (up to 3.3).
fix
If starting a new project or upgrading an existing one to Python 3.4+, do not install `enum34`. Rely solely on the standard library's `enum` module.
affects: All versions (in context of new projects)
Upgrade
Version history
1.1.10latest on PyPI · released Mar 10, 2020
Audit
Dependencies

No dependency data recorded yet.

Agent activity
13 hits · last 30 days
node
12
Resources
enum34 — pip install enum34 · libregistry