Skip to main content

Python Encore

PyPI Python License: MIT CI Docs

Small enhancements of the Python standard library, used across this monorepo. It has no dependencies.

Installation

pip install qiu-python-encore

qiu_python_encore.enum.ExtendedEnum

An Enum whose members also compare equal to their raw values, so that code can accept either a member or its value, e.g. from a configuration file or a hypothesis strategy:

from qiu_python_encore.enum import ExtendedEnum


class Color(ExtendedEnum):
    RED = "red"
    GREEN = "green"


assert Color.RED == "red"
assert Color("red") is Color.RED  # normalize raw values to members
assert Color.list() == ["red", "green"]  # the raw values, in definition order
assert {Color.RED: 1}["red"] == 1  # members hash like their values

Compared to a standard Enum:

  • A member equals its raw value (Color.RED == "red"), but not its name (Color.RED != "RED").
  • A member equals a member of any other Enum with the same value.
  • Members hash like their raw values, consistently with the equality above, so they can be used in sets, as dict keys and with functools.cache.
  • list() returns the raw values of the members.

Documentation

The documentation, with the API reference from the docstrings, is built from docs/ with MkDocs and published at https://blackwild.github.io/qiu/qiu-python-encore/. To serve it locally, from the repository root:

uv run mkdocs serve -f packages/qiu-python-encore/mkdocs.yml

Tests

From the repository root:

uv run pytest packages/qiu-python-encore

Release files for qiu-python-encore 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for qiu-python-encore 0.1.0
File Size Uploaded
qiu_python_encore-0.1.0.tar.gz 3.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for qiu-python-encore 0.1.0
File Interpreter ABI Platform
qiu_python_encore-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 7.9 kB

Release files / qiu_python_encore-0.1.0.tar.gz

Download URL qiu_python_encore-0.1.0.tar.gz
Size 3.3 kB
Tags Source
SHA-256 checksum
How to use checksums
52ecd57a8beb338d16f235e04dc6de456d643ed250042059c6ab1a6f7fdd870f
BLAKE2b-256 checksum
How to use checksums
1625c9b35490d97c3c76a648b88b1fd7b7de8b819c79c9c34e7b369566400f8a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.18 {"installer":{"name":"uv","version":"0.12.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / qiu_python_encore-0.1.0-py3-none-any.whl

Download URL qiu_python_encore-0.1.0-py3-none-any.whl
Size 4.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cc9d943a38f5a5d5ae2f3b47ac20ab5fe30924790f35e5abde161c2296e251a6
BLAKE2b-256 checksum
How to use checksums
17d57cd196e9a9d6fb37091964647cc232c0dfdb1181035e2235c03da79170cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.18 {"installer":{"name":"uv","version":"0.12.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page