Skip to main content

coheriq

Swap in an accelerated implementation of a library — without changing the code that calls it.

Coheriq is a dispatch decorator framework. A library marks certain functions and classes as candidates for acceleration; a separate, independently published package can then replace their implementations at runtime. The user enables the accelerated version by setting an environment variable or in one line of Python, and every call site transparently begins using it.

This lets acceleration be optional (users who can't or don't want the fast path keep the default, and pay none of its install cost), decentralized (a GPU/MPI/HPC engine ships as its own package, maintained by a different team), and drop-in (no call site changes).

The mental model: three parties

1. The library (the "domain") marks what could be accelerated and provides the default implementation:

from coheriq import AccelerationDomain

_domain = AccelerationDomain("mylib", env_prefix="MYLIB")

@_domain.acceleration_candidate
def normalize(xs):
    total = sum(xs)
    return [x / total for x in xs]

_domain.materialize()

2. An acceleration engine — typically a separate package — provides a faster/better implementation of any subset of those candidates:

from coheriq import AccelerationEngine

_engine = AccelerationEngine("mylib", "jax-accelerated")

@_engine.override
def normalize(xs):
    import jax.numpy as jnp
    a = jnp.asarray(xs)
    return (a / a.sum()).tolist()

_engine.materialize()

3. The user activates an engine once, before first use — and nothing else about their code changes:

import coheriq
import mylib

coheriq.enable_engine("mylib", "jax-accelerated")

mylib.normalize([1.0, 2.0, 3.0])   # now runs on JAX, via the engine

Engines are ordinary Python classes under the hood, so independently developed engines can be combined through diamond inheritance into a hybrid that delivers all of their accelerations at once.

Supported platforms

Coheriq targets Linux, macOS, and Windows. Its full test suite runs on Linux and macOS, operating systems which support isolating each test in its own process with pytest --forked (this relies on os.fork()). Windows is tested in a more limited way, running the portions of the suite that do not require --forked, until a fork-free way to run the rest is worked out.

Documentation

Metadata

Release files for coheriq 0.0.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 coheriq 0.0.0
File Size Uploaded
coheriq-0.0.0.tar.gz 59.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for coheriq 0.0.0
File Interpreter ABI Platform
coheriq-0.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 73.5 kB

Release files / coheriq-0.0.0.tar.gz

Download URL coheriq-0.0.0.tar.gz
Size 59.6 kB
Tags Source
SHA-256 checksum
How to use checksums
c9f5f615911a2b91de6cc92ed870634e7c59a6ddbaac44b7a5ab68f43ec93ca3
BLAKE2b-256 checksum
How to use checksums
1c20096dd7da7aff91f9f891bbbbabdfa307febe55d7a7c0bc138099d77c34d3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 16, 2026.

Transparency log

Release files / coheriq-0.0.0-py3-none-any.whl

Download URL coheriq-0.0.0-py3-none-any.whl
Size 13.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
90f15a0dfed596f2500d7c571adba075c3699670398b5b91c6ec55a758b16039
BLAKE2b-256 checksum
How to use checksums
9a5c52e001ff10cda3c143f6d603a4247b57c449fd5bb5c931b2d6963ae209c7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 16, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.0.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