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.

Stability policy

This library follows semantic versioning 2.0.0. Semver allows a project in the 0.y.z series to change anything at any time; Coheriq makes a stronger promise than that, so downstream consumers — the domains and engines that build against Coheriq's decorators — can depend on a version range rather than pinning an exact patchlevel or minor release.

Until the major version becomes non-zero:

  • Patchlevel releases (0.4.1 → 0.4.2) contain bug fixes only. No new features.
  • Minor releases (0.4.2 → 0.5.0) may add features, and do not break existing consumers. The end-user interface for enabling an engine may change in a minor release.
  • A breaking change to the interface used by consumers advances the minor version to the next multiple of ten. If the current release is 0.4.2 and a breaking change lands on main, the next release is 0.10.0.

Downstream packages should therefore depend on Coheriq as:

coheriq>=0.4,<0.10

That picks up bug fixes and new features automatically, and stops before the release that would require attention. Without the multiple-of-ten rule, a version number could not distinguish a release that adds features from one that breaks you, leaving <0.5 as the only safe cap and a pin bump due on every feature release.

Documentation

Metadata

Release files for coheriq 0.1.1

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.1.1
File Size Uploaded Provenance Actions
coheriq-0.1.1.tar.gz 85.4 kB With provenance Details for coheriq-0.1.1.tar.gz

Built distribution (wheel)

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

Total release size: 104.2 kB

Release files / coheriq-0.1.1.tar.gz

Download URL coheriq-0.1.1.tar.gz
Size 85.4 kB
Tags Source
SHA-256 checksum
How to use checksums
687cce48f2c10fe9faead3b82735004e26935593a214776fed336d77a238d8b0
BLAKE2b-256 checksum
How to use checksums
077e22cb20e5e3e61fa7902a6fc540942b8282999964b31c17c42dd205bcc31d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 31, 2026.

Transparency log

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

Download URL coheriq-0.1.1-py3-none-any.whl
Size 18.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
05f4efb892e8cda9a46a47fc91d44968fce8c25fdc085271f45e192084dc5a4e
BLAKE2b-256 checksum
How to use checksums
0334080054ddd79021628d1b6ede7a1113783e4c7643cbe8f010e944350da318
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 31, 2026.

Transparency log

Security for coheriq 0.1.1

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for coheriq-0.1.1.tar.gz

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 Oct 31, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files Full provenance

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