Registry / type-stubs / types-enum34

types-enum34

JSON →
library1.1.8pypypi✓ verified 23d ago

types-enum34 is a PEP 561 type stub package providing static type information for the `enum34` library. The `enum34` library itself is a backport of Python 3.4's standard library `enum` module, enabling enumeration support for older Python versions (2.4-3.3). This stub package allows type-checking tools like MyPy, PyCharm, and Pytype to analyze code that uses `enum34`. The current version is 1.1.8, released in January 2022, and its development cadence follows contributions to the `typeshed` project.

pip install types-enum34
INSTALL
IMPORT
SIG · TYPES-ENUM34
T
types-enum34
type-stubspythonv1.1.8
Install
1.5s avg
Import
Disk
65MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.1.8 · 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.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 65.6MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 1.5s · import 0.000s · 18MB
65MB installed
● package 65MB
Code
Verified usage

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

Enum
from enum import Enum

This quickstart demonstrates how to define and use an enumeration, consistent with the `enum34` library's API (which `types-enum34` provides stubs for). The `types-enum34` package itself does not introduce new runtime functionality; it merely provides static type hints. This code is designed to work with the `enum34` runtime package. For Python versions 3.4 and above, the `enum` module is part of the standard library, rendering `enum34` (and thus `types-enum34`) largely obsolete for new projects.

from enum import Enum from typing import TYPE_CHECKING # This example demonstrates usage of enum34 (type-checked by types-enum34) # Ensure 'enum34' is installed in your Python 2.x or pre-3.4 environment. # For Python 3.4+, the 'enum' module is built-in. class Color(Enum): RED = 1 GREEN = 2 BLUE = 3 def get_color_name(color_enum: Color) -> str: return color_enum.name def get_color_value(color_enum: Color) -> int: return color_enum.value if __name__ == '__main__': my_color = Color.RED print(f"Selected color: {my_color}") print(f"Name: {get_color_name(my_color)}") print(f"Value: {get_color_value(my_color)}") # Example of type checking with mypy (assuming mypy is run externally) # if TYPE_CHECKING: # reveal_type(my_color) # # The following would ideally be flagged by a type checker if `enum34` was in use and `types-enum34` enabled # # get_color_name('invalid_string') # type: ignore
Debug
Known issues
breakingInstalling `enum34` (the runtime library for which `types-enum34` provides stubs) on Python 3.4 or newer environments can cause conflicts with the built-in `enum` module. This may lead to unexpected behavior, import issues, or break `pip` itself.
fix
Do not install `enum34` on Python 3.4 or later. If it's already installed, uninstall it: `pip uninstall enum34`. Python 3.4+ includes `enum` in its standard library, making `enum34` redundant.
affects: Python 3.4+
gotcha`types-enum34` is a stub package for static type checking. It does not provide the `enum` runtime functionality. You must install the `enum34` package separately (e.g., `pip install enum34`) for the code to run in Python environments older than 3.4.
fix
Ensure `enum34` is installed alongside `types-enum34` if you are targeting Python versions where `enum` is not part of the standard library (i.e., Python < 3.4).
affects: All versions
deprecatedThe `enum` module became a part of the Python standard library in Python 3.4. The `enum34` backport (and consequently `types-enum34`) is primarily relevant for maintaining compatibility with Python 2.x and earlier Python 3.x versions. New projects targeting Python 3.4+ should use the built-in `enum` module directly and typically do not require `enum34` or `types-enum34`.
fix
For Python 3.4+, rely on the built-in `enum` module. If type checking is needed, mypy and other tools will automatically find stubs for the standard library module.
affects: < 3.4 for runtime; primarily for Python 2.x usage with type checking.
gotchaThere have been past issues with type checkers like MyPy correctly identifying `types-enum34` as Python 2 compatible when using `--py2` flags, or issues with metadata declarations in `typeshed` affecting stub compatibility.
fix
Ensure you are using recent versions of your type checker and `types-enum34`. If issues persist, refer to the `typeshed` GitHub repository for the latest status and workarounds.
affects: Older MyPy versions (e.g., 0.910 with types-enum34 0.1.7)
Upgrade
Version history
1.1.8latest on PyPI · released Jan 20, 2022
Audit
Dependencies
enum34requiredThis package provides typing stubs for the 'enum34' runtime library. It is only useful if 'enum34' (or an equivalent 'enum' backport) is installed and used in your project, typically for Python versions prior to 3.4.
Agent activity
19 hits · last 30 days
node
16
OpenAI (training)
1
Resources
types-enum34 — pip install types-enum34 · libregistry