Skip to main content

hypercast

CI

match/case over a two-case verdict — the value, or a closed reason plus the exact byte span that offended — with the Rust core linked straight into CPython as a native extension. No dlopen, no ctypes marshalling, no runtime bridge.

Allocation-lean scalar casts — booleans, the full integer family, reals, UUIDs, temporals. The PyO3 extension (hypercast._native) is the only backend — a door is an ordinary METH_FASTCALL extension call into a direct Rust call, and the wheel maturin builds is the whole package (the interim ctypes fallback is gone). Python 3.10 is the floor (match/case is the consumption idiom); wheels are abi3-py310, one per platform covering every CPython from there up, no compiler needed to install.

import hypercast

match hypercast.cast_i32("(1,234)", hypercast.NumFormat.INVARIANT):
    case hypercast.Success(value):
        print("got", value)                       # -1234, accounting negative
    case hypercast.Fault(reason, offset, length):
        print(reason.name, "at byte", offset)

Door names mirror the native ABI (cast_i32, cast_f64, cast_timestamp, …); inputs are str or bytes, both zero-copy views. Exhaustiveness is the type checker's job here — pair the two cases with typing.assert_never under mypy/pyright for the compile-time guarantee the static bindings get natively. Python-flavored fidelity, stated honestly: int is unbounded, so cast_u64 returns the true unsigned value with no bit-pattern games; datetime's resolution is microseconds, so the core's nanoseconds truncate by three digits on the temporal doors — datetime's own ceiling, not the parser's, and said out loud rather than discovered later.

Why not int() / fromisoformat / dateutil?

  1. Verdicts, not exceptions — bad data is the expected case for untrusted text, and a Fault is a reason plus a span, not a ValueError to catch and regex.

  2. The vocabulary untrusted sources actually send — twenty boolean lexemes, accounting parentheses, declared separators, radix prefixes, all five .NET Guid text forms plus urn:uuid: prefixes, protobuf JSON durations — with each lenience individually declared, never guessed.

  3. One engine across a polyglot system — bit-for-bit verdicts with every other binding, held by the shared corpus (26 tests green, full twelve-file corpus replay).

  4. Native-extension speed — the escape from the interpreted tier is this binding's own receipt: the old losses were never "Python calling native code," they were ctypes (~1 µs of interpreted marshalling per call, measured). With the mechanism replaced, every door runs 10-18x faster than it did over ctypes (pyperf, linux-arm64): timestamp 3.07 µs → 201 ns — near-parity with C-accelerated fromisoformat (163 ns) while returning verdicts instead of exceptions; i32 at 146 ns vs int()'s 88; uuid at parity with uuid.UUID() (both sides bounded by UUID.__init__ itself); and the forgiveness doors at ~180 ns for grammar the stdlib doesn't sell at any price.

    The messy-feed doors are where the gap is widest, because strptime is the only stdlib parser that accepts their input at all — and it is slow:

    Door HyperCast stdlib Verdict
    cast_datetime("1/7/2026 3:04 PM", MONTH_DAY_YEAR) 409 ns 5.19 µs datetime.strptime 12.7x faster
    cast_date("1/7/2026", MONTH_DAY_YEAR) 292 ns 3.86 µs datetime.strptime 13.2x faster

    Separator detection costs ~18 ns: 1.234.567,89 under NumFormat.DETECT is 216 ns against 198 ns for the same text under a declared eurozone format. Reproduce: python bench_cast.py --fast (pyperf, in the bench extra).

The honest trade-off: for plain invariant integers int() still wins — it's a C-accelerated builtin with no boundary to cross. These doors earn their keep on the culture-machinery parsers, the closed error contract, and cross-language agreement. And dropping ctypes means dropping the Pyodide/wasm path Python briefly had — the wheels are real native extensions, and a native extension has no browser story.

Install

Not on PyPI yet — the release pipeline is staged (.github/workflows/release.yml, Trusted Publishing pending) and the wheels ship with the first coordinated tag. Until then: clone the repo, cargo build --release --features python in rust/, copy libhypercast.so to python/src/hypercast/_native.abi3.so (CI's own staging step, by hand), and pytesttests/conftest.py puts the in-repo package on the path with no install step.

See the repo root README for the full door table, the receipts, and the state of every other language binding.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

hypercast-0.0.1-cp310-abi3-win_arm64.whl (204.1 kB view details)

Uploaded CPython 3.10+Windows ARM64

hypercast-0.0.1-cp310-abi3-win_amd64.whl (207.9 kB view details)

Uploaded CPython 3.10+Windows x86-64

hypercast-0.0.1-cp310-abi3-manylinux_2_28_x86_64.whl (354.6 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.28+ x86-64

hypercast-0.0.1-cp310-abi3-manylinux_2_28_aarch64.whl (351.9 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.28+ ARM64

hypercast-0.0.1-cp310-abi3-macosx_11_0_arm64.whl (315.9 kB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

hypercast-0.0.1-cp310-abi3-macosx_10_12_x86_64.whl (317.8 kB view details)

Uploaded CPython 3.10+macOS 10.12+ x86-64

File details

Details for the file hypercast-0.0.1-cp310-abi3-win_arm64.whl.

File metadata

  • Download URL: hypercast-0.0.1-cp310-abi3-win_arm64.whl
  • Upload date:
  • Size: 204.1 kB
  • Tags: CPython 3.10+, Windows ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for hypercast-0.0.1-cp310-abi3-win_arm64.whl
Algorithm Hash digest
SHA256 95cd0036b1d24feba51508c31753c744f7c4e9211d337d538adf0f8777481274
MD5 30c9e68c9209bc0a7464410abb15c286
BLAKE2b-256 a310a47f039ef123ce1734cad4cf5c67f5567fff8a5bedcf4a441ab66e7f9fd2

See more details on using hashes here.

Provenance

The following attestation bundles were made for hypercast-0.0.1-cp310-abi3-win_arm64.whl:

Publisher: release.yml on SkunkWerkx/HyperCast

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hypercast-0.0.1-cp310-abi3-win_amd64.whl.

File metadata

  • Download URL: hypercast-0.0.1-cp310-abi3-win_amd64.whl
  • Upload date:
  • Size: 207.9 kB
  • Tags: CPython 3.10+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for hypercast-0.0.1-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 34e554536f2e16509564567dcfb1df5b0ad73ed5159e5cb367d6a92b4fba7c31
MD5 57accedb233e9f59900f834c0823bfde
BLAKE2b-256 c2cb83585294d1bd3b9e9dff14e04dfdd1383ab37d42e7635b0c3dba24369311

See more details on using hashes here.

Provenance

The following attestation bundles were made for hypercast-0.0.1-cp310-abi3-win_amd64.whl:

Publisher: release.yml on SkunkWerkx/HyperCast

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hypercast-0.0.1-cp310-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for hypercast-0.0.1-cp310-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0856d2bb2083c0d40defcdacf0e2c25e8dcec94ba206e9cc0868239fd4c64234
MD5 1b35e0c74325722327558384dd803c15
BLAKE2b-256 124359edbb0100e76e1505bdcaf365ccef1f5a4894e815f2564eda0befb42560

See more details on using hashes here.

Provenance

The following attestation bundles were made for hypercast-0.0.1-cp310-abi3-manylinux_2_28_x86_64.whl:

Publisher: release.yml on SkunkWerkx/HyperCast

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hypercast-0.0.1-cp310-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for hypercast-0.0.1-cp310-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 53861b6235e8add5e275202d3ce4687f77f6780970d47ca43f2b1504d852007d
MD5 c53feb819243d4f5ce5d652ac817c50d
BLAKE2b-256 51cd09400e7c85e7b830d157c978053bcaeeb52173a992fa6da65ecf6a173c56

See more details on using hashes here.

Provenance

The following attestation bundles were made for hypercast-0.0.1-cp310-abi3-manylinux_2_28_aarch64.whl:

Publisher: release.yml on SkunkWerkx/HyperCast

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hypercast-0.0.1-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for hypercast-0.0.1-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a0a85ce0b9d370ebeb5ada3f0b0233afbaf1a81ab02ea2d981e57a4b28911610
MD5 1305047a8272cf98058953f4379e50a5
BLAKE2b-256 fb5c10b2d268fe1551376c4e6ecd5f253a0a3d43dc56ff1171f7351d193f0b6d

See more details on using hashes here.

Provenance

The following attestation bundles were made for hypercast-0.0.1-cp310-abi3-macosx_11_0_arm64.whl:

Publisher: release.yml on SkunkWerkx/HyperCast

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hypercast-0.0.1-cp310-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for hypercast-0.0.1-cp310-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 de228f50893552e22630db5fe8dcff668f9aadcf697bb9ddb1324ed8cc1464fe
MD5 c42d75daa975dde0978fb0f28237acf1
BLAKE2b-256 dfafe0d47a2d6bc418e7967c921f82369ab814df91f2cd48211af895064138ae

See more details on using hashes here.

Provenance

The following attestation bundles were made for hypercast-0.0.1-cp310-abi3-macosx_10_12_x86_64.whl:

Publisher: release.yml on SkunkWerkx/HyperCast

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.0.2

6 files

This release

0.0.1 This release

6 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