Skip to main content

hypercast

CI PyPI License: MIT

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

pip install hypercast

abi3 wheels for all six platforms, so one wheel per platform covers every CPython 3.10+. No compiler needed to install and no dependencies at all — the PyO3 extension is the package.

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.2-cp310-abi3-win_arm64.whl (204.0 kB view details)

Uploaded CPython 3.10+Windows ARM64

hypercast-0.0.2-cp310-abi3-win_amd64.whl (207.8 kB view details)

Uploaded CPython 3.10+Windows x86-64

hypercast-0.0.2-cp310-abi3-manylinux_2_28_x86_64.whl (354.7 kB view details)

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

hypercast-0.0.2-cp310-abi3-manylinux_2_28_aarch64.whl (351.8 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.28+ ARM64

hypercast-0.0.2-cp310-abi3-macosx_11_0_arm64.whl (315.8 kB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

hypercast-0.0.2-cp310-abi3-macosx_10_12_x86_64.whl (317.7 kB view details)

Uploaded CPython 3.10+macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: hypercast-0.0.2-cp310-abi3-win_arm64.whl
  • Upload date:
  • Size: 204.0 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.2-cp310-abi3-win_arm64.whl
Algorithm Hash digest
SHA256 db5e1a210fbfabd9c1c1265e1bd543f839786e1ff754189daa05b9809feed843
MD5 7c8d43393ad092bce5504749645f1b65
BLAKE2b-256 0938c83c8df6cfcdd6ba344ae21be46b77e74a5af4560ee7de7c6e750e90749e

See more details on using hashes here.

Provenance

The following attestation bundles were made for hypercast-0.0.2-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.2-cp310-abi3-win_amd64.whl.

File metadata

  • Download URL: hypercast-0.0.2-cp310-abi3-win_amd64.whl
  • Upload date:
  • Size: 207.8 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.2-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 cf760dd040a49e683ca049f5d2c8e855c7fe6bd15bbf307c40d4d65e6c9cdbfa
MD5 68300167d330191479e4f2c0f7da9b62
BLAKE2b-256 1f9f0622263b9d72e35d62c68a035afd29e735556329f8166c02799e948cf6a2

See more details on using hashes here.

Provenance

The following attestation bundles were made for hypercast-0.0.2-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.2-cp310-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for hypercast-0.0.2-cp310-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7703e72b5368fe5a80072e86ea562351054c0d1b01b189e7e9f3c24f3ef7ebcc
MD5 c020d0ccae9c1f6d75c3a0f8eebdb78e
BLAKE2b-256 79696c73cf8e3d49afc27c68d3cad377436048fa6d3802e8c9e98f9c28ef0448

See more details on using hashes here.

Provenance

The following attestation bundles were made for hypercast-0.0.2-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.2-cp310-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for hypercast-0.0.2-cp310-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 8c3b7c6eae95edf97767306fd75dd55b610ee4b54ed0962cbb60efe14cd9b1cd
MD5 091240e072056a35def4f4c05ede70fa
BLAKE2b-256 27de30fa1c4f1a1fc838d7913eb731f261356ed62813a776a1da765c1516b06b

See more details on using hashes here.

Provenance

The following attestation bundles were made for hypercast-0.0.2-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.2-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for hypercast-0.0.2-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 db63dc2bc7c7bda01ade93281e6934368e34366ce9afae70a2461fdc96a0b290
MD5 15e9ebec6565ebd892870ccfead779bd
BLAKE2b-256 db756feb9388d9a5062f544c4b898b2003815cc32c184d0f8c6e89f701c29896

See more details on using hashes here.

Provenance

The following attestation bundles were made for hypercast-0.0.2-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.2-cp310-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for hypercast-0.0.2-cp310-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 106ebc1428e352f1ac99f872f39c1469c29af924c7b30bb6eb33c3f1cfedee1d
MD5 55f7f91f2b50dd8a267d95039ef35fa7
BLAKE2b-256 a40c74cb7cb886c0bb8c5ce08f478140eeafbd1ea53c7a2919d624b79e5bea67

See more details on using hashes here.

Provenance

The following attestation bundles were made for hypercast-0.0.2-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

This release

0.0.2 This release

6 files

0.0.1

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