Skip to main content

RadixIP Python Bindings

High-performance IP longest-prefix matching for Python, powered by a native Rust backend via PyO3.

Why RadixIP in Python?

Python is notoriously bound by the Global Interpreter Lock (GIL). When dealing with network engineering tasks (like parsing millions of BGP routes or massive log files), native Python dictionaries and classes can quickly become a memory and CPU bottleneck.

RadixIP pushes the entire routing table and bit-traversal logic down into native Rust memory. Because of the GIL, the engine is explicitly configured to use the memory-efficient StandardEngine (without threading shards) to maximize single-core throughput.

Installation

pip install radixip

Pre-built wheels are distributed for Windows, Linux, and macOS (x86_64 & ARM64).

Usage

from radixip import RadixEngine

# Initialize the native engine
engine = RadixEngine()

# Insert prefixes with rich metadata
engine.insert("10.0.0.0/8", { 
    "value": "allow", 
    "attributes": { "asn": "AS12345", "region": "us-east" } 
})

# Perform sub-microsecond longest-prefix matching
match = engine.lookup("10.1.2.3")

if match:
    print(f"Matched! Action: {match['value']}")
    print(f"Attributes:", match['attributes'])
else:
    print("No match found.")

# Statistics
print(engine.stats())

Policy checks

The native policy binding loads the same YAML configuration used by the Rust and Go middleware. Token buckets, blocklist checks, and auto-ban state remain in Rust; Python receives only the compact decision result.

from radixip import RadixPolicy

policy = RadixPolicy.from_yaml("config/radixip.yaml")
result = policy.check_ip("203.0.113.10")
print(result["decision"])             # allow, block, or limit
print(result["retry_after_seconds"])

Use this result in Flask, Django, FastAPI, or another Python framework middleware. Keep one policy instance per process rather than constructing one per request.

FastAPI middleware

from fastapi import FastAPI
from radixip import RadixPolicy
from radixip.middleware import RadixIPMiddleware

app = FastAPI()
policy = RadixPolicy.from_yaml("config/radixip.yaml")
app.add_middleware(RadixIPMiddleware, policy=policy)

The default uses the direct peer address and does not trust forwarded headers. Pass resolve_ip to RadixIPMiddleware when the application sits behind a known, trusted proxy chain.

Benchmarks

You can verify the performance on your own machine using pytest-benchmark:

cd lib/python
pip install pytest pytest-benchmark
pytest tests/test_benchmark.py

Metadata

Release files for radixip 1.2.0

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

Built distributions (wheels)

Table of built distributions (wheels) for radixip 1.2.0
File Actions
radixip-1.2.0-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details for radixip-1.2.0-cp312-cp312-win_amd64.whl
radixip-1.2.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ x86-64 Details for radixip-1.2.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
radixip-1.2.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ ARM64 Details for radixip-1.2.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
radixip-1.2.0-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details for radixip-1.2.0-cp312-cp312-macosx_11_0_arm64.whl
radixip-1.2.0-cp312-cp312-macosx_10_12_x86_64.whl CPython 3.12 CPython 3.12 macOS 10.12+ x86-64 Details for radixip-1.2.0-cp312-cp312-macosx_10_12_x86_64.whl

Total release size: 4.4 MB

Release files / radixip-1.2.0-cp312-cp312-win_amd64.whl

Download URL radixip-1.2.0-cp312-cp312-win_amd64.whl
Size 812.2 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
f0cbc02480b542281f75e67ea58736dc38880bf5125e96e027efad15b994384c
BLAKE2b-256 checksum
How to use checksums
c0593b9ddf31e7f6d1093eb390c144af1aad7c7856362e1fc8a3f0ee31d06379
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 18, 2026.

Transparency log

Release files / radixip-1.2.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL radixip-1.2.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 940.3 kB
Tags CPython 3.12 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
2cd5fa4821a73426a7281ac2e679508ba8788b5b901241b4664d0e162c6797df
BLAKE2b-256 checksum
How to use checksums
b5809c70dd2f7d79d1a55ff62bff6d7d2d54b6729d85058864721f8bdfdf9ba6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 18, 2026.

Transparency log

Release files / radixip-1.2.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL radixip-1.2.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 896.0 kB
Tags CPython 3.12 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
0044e143b79153c841cfb6ea8ce51b977015c8a6c18b20988a6c5bc8a55125f4
BLAKE2b-256 checksum
How to use checksums
4d9fa8bbb7d67931023cead28d8abd68d926bf6064d9ebd789170de73fcab171
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 18, 2026.

Transparency log

Release files / radixip-1.2.0-cp312-cp312-macosx_11_0_arm64.whl

Download URL radixip-1.2.0-cp312-cp312-macosx_11_0_arm64.whl
Size 841.9 kB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
316b995d20c6712358d0951542ac0972aca6284ccb2b4bf1c61f7487d0a77e8b
BLAKE2b-256 checksum
How to use checksums
e4d8dd5c4f13addadbad11d09809f416a5b5a072a5aa525e39e14411b3382727
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 18, 2026.

Transparency log

Release files / radixip-1.2.0-cp312-cp312-macosx_10_12_x86_64.whl

Download URL radixip-1.2.0-cp312-cp312-macosx_10_12_x86_64.whl
Size 911.2 kB
Tags CPython 3.12 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
ea3db64e34fe268106b9aa23d767f7f05f310d72ef55ad95f89d88adab147947
BLAKE2b-256 checksum
How to use checksums
653f3ab63a6eb93f653e84f8531a7fe6ebf69e49a6ff5282e1a2b7e5e02a098f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 18, 2026.

Transparency log

Security for radixip 1.2.0

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

All 5 files in this release have been uploaded with provenance metadata.

Select from 5 files

Attestation for radixip-1.2.0-cp312-cp312-win_amd64.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 18, 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.

Release history Release notifications | RSS feed

This release

1.2.0 This release

5 release files Full provenance

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