Skip to main content

NumbDuck

Adapting DuckDB database API to the Numba JIT context.

Leverages bindings toolkit in the NumbOx project.

Inspired by the NumbSQL project.

Caching

Every binding and buffer allocator compiles under the options in NUMBDUCK_JIT_OPTIONS, a JSON object read once at import. If it is not set, the options are {"cache": true, "nogil": true}, so compiled code goes into numba's on-disk cache, and export NUMBDUCK_JIT_OPTIONS='{"cache": false}' turns the cache off. A compile option that differs from the defaults turns it off too, since numba's cache key holds no compile options. The two bignum bindings never use the cache, since the name of their C symbol depends on the duckdb version and is not in any cache key.

numbduck checks once at import whether numba can write a cache for it. If numba cannot, numbduck compiles without a cache and warns once, naming the remedy. That happens on a read-only install, and under an import from a .zip, when the user cache directory is read-only too. It also happens under an import from an .egg, .whl or .pyz archive, and on numba 0.68 and later under an import from a .zip that holds only .pyc files. numbox's Where the cache lands describes each placement and its remedy.

Examples

Runnable narrative-style examples comparing numbduck against the closest stock DuckDB Python+Arrow approaches live in examples/. Each script is self-contained, generates its own data, and prints the measured numbers.

Highlights:

  • Throughput (haversine.py): JIT chunk callback is ~400× faster than a per-row Python scalar UDF (10K rows) and ~100× faster than a PyArrow expression UDF at 1M rows. The win comes from no Python crossings per chunk and LLVM-fused math with no intermediate arrays.

  • Latency + GIL-free (online_scoring.py): ~2.2× lower per-event latency vs pure-Python conn.execute, and monotonic parallel scaling to ~2.4× on 8 threads while the Python loop plateaus under GIL contention.

  • Branchy logic (fraud_score.py): Arrow's pc.if_else chain beats the Python scalar UDF by ~60× (Arrow is the right stock-DuckDB tool here). The JIT chunk callback then beats Arrow by ~16× at 10K and ~1750× at 1M rows. The gap grows because each Arrow UDF chunk crosses the Python boundary and allocates intermediates, while the JIT computes in registers.

Metadata

Release files for numbduck 0.0.5

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

Built distribution (wheel)

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

Release files / numbduck-0.0.5-py3-none-any.whl

Download URL numbduck-0.0.5-py3-none-any.whl
Size 23.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b8995d707b44a44063a664f243ad7cf08a5933317684289bb8cf1f1c921fda58
BLAKE2b-256 checksum
How to use checksums
d16b4470fb2320d221caa77d6f45215856b1bacdf8787ed633e0ef07d6bf6cde
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 Nov 3, 2026.

Transparency log

Security for numbduck 0.0.5

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

1 file in this release has been uploaded with provenance metadata.

Attestation for numbduck-0.0.5-py3-none-any.whl

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 Nov 3, 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.

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