backports.strenum
Base class for creating enumerated constants that are also subclasses of str
Decision gist · record as of 2026-08-14
Yes, if you need StrEnum on Python 3.8–3.10 and can configure it as a conditional dependency (install only on <3.11). The package is minimal, has no external dependencies, carries no known vulnerabilities, and uses a permissive MIT license. Dormant maintenance is acceptable because it is a static backport of a standard library feature. Not worth installing on Python 3.11+, where the standard library StrEnum should be used directly.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Package only installs on Python >=3.8.6 and <3.11; on Python 3.11+ the standard library StrEnum should be used instead.
- Low install friction with no runtime dependencies.
- Maintenance is dormant—last release was 2023-12-09 and the repository shows no recent activity—but the package is intentionally minimal and unlikely to require updates unless Python's enum behavior changes.
License · maintenance · safety
MIT (permissive) — MIT license permits unrestricted use, modification, and distribution with minimal restrictions, making it safe to include in any project type.
last release 2023-12-09 (979 days) · last repo commit 2024-07-24 · 8 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 8,402,027 downloads/mo, #1,626 on PyPI
Alternatives
Verify before relying
pip install backports.strenum
from backports.strenum import StrEnum
class Color(StrEnum):
RED = "red"
BLUE = "blue"
print(Color.RED == "red") # True- Whether the package's behavior fully matches Python 3.11's StrEnum in all edge cases, particularly around container operations that change in Python 3.12.
- Whether conditional dependency configuration is documented for common package managers.
- Full compatibility with all string operations and edge cases described in Python 3.11 enum documentation.
What it is and what it does
backports.strenum is a direct copy of Python 3.11's StrEnum class, ported to run on Python 3.8.6 through 3.10. It lets you create enumeration classes whose members are both enum constants and string values, so they can be used interchangeably with strings in most contexts. Members support string operations like upper() and lower(), and equality checks work naturally (e.g., Color.RED == "red" returns True).
The package is designed as a conditional dependency: code should import from the standard library on Python 3.11+, and fall back to backports.strenum only on earlier versions. It has no runtime dependencies and installs cleanly. Maintenance is dormant but intentional—the package is a static backport unlikely to need updates unless Python's enum semantics shift significantly.
Use it for
- Define string-based enums in libraries that must support Python 3.8–3.10 while using native StrEnum on 3.11+.
- Replace hardcoded string constants with type-safe enum members that retain string compatibility.
- Build configuration or status classes where members need to serialize as strings and be usable in string comparisons.
- Migrate legacy code from plain string constants to enums without breaking string-based APIs.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need StrEnum on Python 3.8–3.10 and can configure it as a conditional dependency (install only on <3.11).
The package is minimal, has no external dependencies, carries no known vulnerabilities, and uses a permissive MIT license. Dormant maintenance is acceptable because it is a static backport of a standard library feature. Not worth installing on Python 3.11+, where the standard library StrEnum should be used directly.
Install
backports-strenum on PyPI
Before you install
Low install friction with no runtime dependencies. Maintenance is dormant—last release was 2023-12-09 and the repository shows no recent activity—but the package is intentionally minimal and unlikely to require updates unless Python's enum behavior changes.
Package only installs on Python >=3.8.6 and <3.11; on Python 3.11+ the standard library StrEnum should be used instead.
License in practice
MIT license permits unrestricted use, modification, and distribution with minimal restrictions, making it safe to include in any project type.
Quickstart
pip install backports.strenum
from backports.strenum import StrEnum
class Color(StrEnum):
RED = "red"
BLUE = "blue"
print(Color.RED == "red") # True
Verify before relying
- Whether the package's behavior fully matches Python 3.11's StrEnum in all edge cases, particularly around container operations that change in Python 3.12.
- Whether conditional dependency configuration is documented for common package managers.
- Full compatibility with all string operations and edge cases described in Python 3.11 enum documentation.
Package facts
| License | MIT permissive |
| Python support | Capped below the current Python release >=3.8.6,<3.11 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Dormant 979 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 8,402,027 / month, #1,626 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 3 - AlphaIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.9 |
Evidence: backports_strenum-1.3.1-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “string enum backport”
- backports.strenumProvides StrEnum, a string-based enumeration class from Python 3.11,…
- enum34Provides enumeration support for older Python versions by backporting…
- enum-compatConditionally installs enum34 on Python versions older than 3.4; on…
Give your agent the search over MCP, or paste the wish link into any chat.
More Software Development packages
Provides backported and experimental type hints for Python 3.9+, allowing use of newer typing features on older Python versions and enabling early experimentation with type system PEPs before they enter the standard library.
NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.
FastAPI is a Python web framework for building REST APIs using type hints, with automatic request validation, serialization, and interactive API documentation.
Provides a way to document function parameters, class attributes, return types, and variables inline using Python's `Annotated` type hint syntax instead of traditional docstrings.
Typer builds command-line applications from Python functions using type hints, automatically generating help text, argument parsing, and shell completion.
Install it if you are building CLIs in Python.
Distlib provides low-level packaging utilities for building, distributing, and managing Python software—including metadata handling, version specifiers, wheel support, script installation, and dependency resolution.
See also StrEnum · enum34 · matrix-enum · enum-tools · aenum · enum-compat · pysubtypes · django-enum · constantly · exitstatus