Skip to main content

An Enum that inherits from str.

Project description


StrEnum is a Python enum.Enum that inherits from str to complement enum.IntEnum in the standard library.


You can use pip to install.

pip install StrEnum


from enum import auto
from strenum import StrEnum

class HttpMethod(StrEnum):
    GET = auto()
    HEAD = auto
    POST = auto()
    PUT = auto()
    DELETE = auto()
    CONNECT = auto()
    OPTIONS = auto()
    TRACE = auto()
    PATCH = auto()

print(f"An HTTP method: {HttpMethod.GET}")  # prints "An HTTP method: GET"


Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please ensure tests pass before submitting a PR. This repository uses Black and Pylint for consistency. Both are run automatically as part of the test suite.

Running the tests

Tests can be run using

python3 test

Or inside a virtualenv:

python3 -m venv .venv
.venv/bin/python3 test



Project details

Release history Release notifications

This version


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for StrEnum, version 0.4.0
Filename, size File type Python version Upload date Hashes
Filename, size StrEnum-0.4.0-py3-none-any.whl (3.0 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size StrEnum-0.4.0.tar.gz (2.1 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page