Skip to main content

goldenflow-native

Optional native (Rust/PyO3) acceleration kernels for GoldenFlow. The sibling of goldenmatch-native; same abi3 / maturin / Arrow-zero-copy posture.

GoldenFlow stays a pure-Python wheel. pip install goldenflow[native] pulls this compiled runtime, and goldenflow.core._native_loader discovers it (or falls back to pure Python when it's absent). It is off by default at runtime even when installed — see Gating.

What it accelerates

The international phone family. GoldenFlow's pure-Python transforms already resolve the common (NANP) case with vectorized Polars expressions; these kernels accelerate the residual — international numbers that would otherwise hit the phonenumbers library one row at a time. Kernels:

function returns
phone_e164_arrow(array, region) Utf8 E.164 (null on parse failure)
phone_national_arrow(array, region) Utf8 national format
phone_country_code_arrow(array, region) Int64 country calling code
phone_valid_arrow(array, region) Boolean validity

Each takes an Arrow Utf8/LargeUtf8 array (zero-copy in), returns an Arrow array (zero-copy out), and releases the GIL around the compute loop. Any row it can't parse comes back null so the Python reference settles it — the native path is never worse than pure Python.

Dates are intentionally not a native kernel: the Polars str.to_date coalesce fast path already resolves the 4-digit-year formats in vectorized Rust, and a per-row chrono parser would be slower while reintroducing a 2-digit-year parity hazard. The ragged date tail stays on dateutil.

Gating: NANP-only (parity-safe, on by default)

phone is in goldenflow.core._native_loader._GATED_ON, so it runs under GOLDENFLOW_NATIVE=auto (the default) — but only in a provably parity-safe mode.

Characterization across 20 country metadata sets showed the Rust phonenumber port is byte-identical to the Python phonenumbers library except when a +CC international number is parsed with a mismatched default region (the transforms pass "US") and its national number starts with 1 (e.g. +33142685300 → native +3342685300 — the port mis-applies US national-prefix stripping). It also diverges on ambiguous leading-1 inputs (1234567890 → native +1234567890 vs python +11234567890).

Two gates make native authoritative only where it's proven correct:

  1. Kernel nanp_only mode — emits a result only for country-code-1 numbers; everything else returns null and falls back to Python.
  2. Canonical-NANP acceptance (in transforms/_native.py) — keeps only ^\+1[2-9]\d{9}$ outputs, dropping the malformed 9-digit results the leading-1 ambiguity produces.

So native resolves the canonical-NANP residual the Polars fast path can't reach (alpha like 1-800-FLOWERS, extensions, +1-prefixed forms) ~4-5× faster, and everything international/ambiguous defers to Python. phone_country_code is also gated (country code agrees on all NANP); phone_national/phone_validate stay pure Python (no cheap canonical check). Verified byte-identical to phonenumbers over a 60k mixed corpus in packages/python/goldenflow/tests/transforms/test_native_parity.py.

GOLDENFLOW_NATIVE=0 forces pure Python; =1 enables native for all components (bench/parity lane, no nanp_only restriction — will diverge on intl).

Build

# In-tree dev build (drops goldenflow/_native.abi3.so):
python packages/python/goldenflow/scripts/build_native.py

# Distributable abi3 wheel:
cd packages/rust/extensions/native-flow && maturin build --release

Release files for goldenflow-native 0.28.0

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

Source distribution (sdist)

Source distribution for goldenflow-native 0.28.0
File Size Uploaded
goldenflow_native-0.28.0.tar.gz 231.6 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for goldenflow-native 0.28.0
File
goldenflow_native-0.28.0-cp311-abi3-win_amd64.whl CPython 3.11 abi3 Windows x86-64 Details
goldenflow_native-0.28.0-cp311-abi3-manylinux_2_28_x86_64.whl CPython 3.11 abi3 Linux glibc 2.28+ x86-64 Details
goldenflow_native-0.28.0-cp311-abi3-manylinux_2_28_aarch64.whl CPython 3.11 abi3 Linux glibc 2.28+ ARM64 Details
goldenflow_native-0.28.0-cp311-abi3-macosx_11_0_arm64.whl CPython 3.11 abi3 macOS 11.0+ ARM64 Details
goldenflow_native-0.28.0-cp311-abi3-macosx_10_12_x86_64.whl CPython 3.11 abi3 macOS 10.12+ x86-64 Details

Total release size: 22.4 MB

Release files / goldenflow_native-0.28.0.tar.gz

Download URL goldenflow_native-0.28.0.tar.gz
Size 231.6 kB
Tags Source
SHA-256 checksum
How to use checksums
4e3b3f19e04da0eed342dbe260a4b9f2aaa9d6ac456de6e29c55442de07e8a64
BLAKE2b-256 checksum
How to use checksums
fa53db294ac37e796e69c917ae7dcbb23fb69a8a49c0627f29974babd1db1841
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.13

Release files / goldenflow_native-0.28.0-cp311-abi3-win_amd64.whl

Download URL goldenflow_native-0.28.0-cp311-abi3-win_amd64.whl
Size 4.2 MB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
1a3a719a7f50356f34ff5c1aa6ae25551544572bced7c0a429b5e506e48c2b44
BLAKE2b-256 checksum
How to use checksums
20e1558be30bf16d499959d83cabeb8399e5f3878c4419d2eb2d6a256c69c405
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.13

Release files / goldenflow_native-0.28.0-cp311-abi3-manylinux_2_28_x86_64.whl

Download URL goldenflow_native-0.28.0-cp311-abi3-manylinux_2_28_x86_64.whl
Size 4.6 MB
Tags CPython 3.11 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
7e6967e9142778b85d0303a01c0a7f6beae9a3cb3909fd77de09dc5917d5d134
BLAKE2b-256 checksum
How to use checksums
35706e64fd4ea5500c3e70a1af3df1b0aa90033e72725135f821288bde2d977e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.13

Release files / goldenflow_native-0.28.0-cp311-abi3-manylinux_2_28_aarch64.whl

Download URL goldenflow_native-0.28.0-cp311-abi3-manylinux_2_28_aarch64.whl
Size 4.7 MB
Tags CPython 3.11 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
ed6ec7e15e0c1f0250723e28d49406f8c2ca96156232dd489add3a6d1920c4f2
BLAKE2b-256 checksum
How to use checksums
12515f7a870280ca412b90a056ec2113649a2f7cfd32fef81cf7f27299608275
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.13

Release files / goldenflow_native-0.28.0-cp311-abi3-macosx_11_0_arm64.whl

Download URL goldenflow_native-0.28.0-cp311-abi3-macosx_11_0_arm64.whl
Size 4.2 MB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
11686bb5595f1dac97f6bff4b2a6684cd1c7e325958d8041a06873431fc48542
BLAKE2b-256 checksum
How to use checksums
facfbf83ea1218020c00214de5f297012770b42f961a9e9bf06f2f6ac32f710b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.13

Release files / goldenflow_native-0.28.0-cp311-abi3-macosx_10_12_x86_64.whl

Download URL goldenflow_native-0.28.0-cp311-abi3-macosx_10_12_x86_64.whl
Size 4.5 MB
Tags CPython 3.11 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
a1cf99ca281076a8971db79860d569e3366920d1074994b81dc5022492fc759c
BLAKE2b-256 checksum
How to use checksums
fccfc0bf92571e78230698abd7d9e36a30b6960704591e678ed24c6b599dfc17
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.13

Release history Release notifications | RSS feed

This release

0.28.0 This release

6 release files

0.27.0

6 release files

0.2.0

6 release files

0.1.1

6 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