Skip to main content

The kwimage_ext Module

GitlabCIPipeline GitlabCICoverage Pypi PypiDownloads ReadTheDocs

Read the docs

https://kwimage_ext.readthedocs.io

Gitlab (main)

https://gitlab.kitware.com/computer-vision/kwimage_ext

Pypi

https://pypi.org/project/kwimage_ext

The kwimage_ext module contains acceleration extensions used by kwimage. Normal installs are Rust-first: the public compatibility API is implemented in Python and dispatches supported kernels to the kwimage_ext._rust PyO3 extension.

Install a released wheel in the usual way:

python -m pip install kwimage_ext

Building from source requires a Rust toolchain because the normal PEP-517 backend is maturin. CMake and Cython are not required for the production wheel; they are only needed by maintainers when building the historical parity backend.

Rust-first development

The default PEP-517 build uses maturin and installs the Rust extension as kwimage_ext._rust. The public Python modules remain compatibility shims, so downstream kwimage imports do not need to change while kernels are ported.

For an editable Rust build:

./dev/build_rust.sh
python -m pytest tests/test_rust_backend.py tests/test_rust_shims.py

The historical Cython/C sources are retained temporarily as a parity reference. To rebuild both implementations and require direct semantic parity:

./dev/check_backend_parity.sh

dev/build_legacy.sh is available when only the reference extensions are needed. It builds CPU reference modules under explicit *_legacy names; those binaries are not part of the normal wheel.

Backend selection is capability-aware: a Rust module is selected only when it implements every symbol required by a particular shim. Set KWIMAGE_EXT_FORCE_RUST=1 to prove that a test is not accidentally falling through to a legacy extension. KWIMAGE_EXT_FORCE_LEGACY=1 is intended for maintainer diagnostics only.

The Rust module also exposes narrow coco-assignment capabilities through kwimage_ext.algo.assignment. coco_greedy_match batches IoU thresholds; coco_greedy_match_grid additionally batches independent area/ignore slices so downstream evaluators can cross the Python/Rust boundary once per image. Both accept an already-built CSR sparse candidate graph plus stable prediction order / truth flags. Geometry and metric policy remain outside these kernels; downstream kwcoco retains Python reference implementations and fallbacks. Direct kernel parity and timing can be checked with:

KWIMAGE_EXT_FORCE_RUST=1 python -m pytest -q tests/test_rust_assignment.py
python dev/bench_assignment.py --n-pred=400 --n-true=400 --candidates=40

Release wheels use PyO3 abi3-py310. Build one CPython 3.10 baseline wheel per platform and test that same artifact on every supported Python version. The artifact-level check is:

python dev/check_wheel_artifact.py wheelhouse/kwimage_ext*.whl

Release evidence audit

For release candidates, validate the built wheel, not an editable checkout. The artifact validator first checks the archive structure, then installs the wheel into a temporary target directory and requires every imported kwimage_ext module (including algo.assignment and _rust) to resolve from that isolated target. This prevents source-tree imports or stale editable .pth files from hiding an incomplete release artifact:

python dev/validate_wheel_artifact.py wheelhouse/kwimage_ext*.whl

For a local release candidate, the deterministic preflight is:

./dev/build_release_candidate.sh _release_candidate

That command always builds a fresh non-editable wheel, validates the isolated install/capability surface, runs the release-packaging guards, records SHA256 hashes and wheel contents, and emits an uploadable evidence bundle. dev/validate_rust_port.sh performs the same non-editable wheel audit in addition to the editable development tests. End-to-end COCO metric speed / memory comparisons remain owned by kwcoco because only the full evaluator can make a meaningful comparison against pycocotools.COCOeval.

Release files for kwimage-ext 0.3.2

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 kwimage-ext 0.3.2
File Interpreter ABI Platform
kwimage_ext-0.3.2-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.10 abi3 Linux glibc 2.17+ x86-64 Details

Release files / kwimage_ext-0.3.2-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL kwimage_ext-0.3.2-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 414.1 kB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
def2445897f11e45dcf80ed1d7530a5a7c3a94be6de6a7075ea9d1ddab5c6930
BLAKE2b-256 checksum
How to use checksums
96f76c117fdf482fdc40848a2b3eaf06dcc2125eb23e78a69fa5a9638ee4cc89
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release history Release notifications | RSS feed

0.4.1

7 release files

0.4.0

7 release files

This release

0.3.2 This release

1 release file

0.3.1

5 release files

0.2.2

5 release files

0.2.0

5 release files

0.0.1

4 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