Skip to main content

StrEnum

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

Installation

You can use pip to install.

pip install StrEnum

Usage

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"

Contributing

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 setup.py:

python3 setup.py test

Or inside a virtualenv:

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

License

MIT

Download files

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

Source Distribution

StrEnum-0.4.0.tar.gz (2.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

StrEnum-0.4.0-py3-none-any.whl (3.0 kB view details)

Uploaded Python 3

File details

Details for the file StrEnum-0.4.0.tar.gz.

File metadata

  • Download URL: StrEnum-0.4.0.tar.gz
  • Upload date:
  • Size: 2.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.5

File hashes

Hashes for StrEnum-0.4.0.tar.gz
Algorithm Hash digest
SHA256 2ca9626a75fd9a95189211469c3ba2a7dacf5d3ee68605f00971e8836e284fff
MD5 e3f27c48686f7ae421d53964191514d3
BLAKE2b-256 6aeaf49d25791e0fe97e3ecd99c8930f7e6fcb6055ac7d01cfbe3b5541811690

See more details on using hashes here.

File details

Details for the file StrEnum-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: StrEnum-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 3.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.5

File hashes

Hashes for StrEnum-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0e289bbe93debf07e08448a35739f6f7664af33737455419839760772060b626
MD5 c4d9ee968e743dff43ad25a73f5e367b
BLAKE2b-256 b9060838022531d9aae3579bfbe9afb1e7f3a694c6fb91b74a6559ac84dafa3d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page