Skip to main content

Fast RPSL parser with Polars DataFrame output

Project description

polars-rpsl

Fast RPSL (Routing Policy Specification Language) parser with Polars DataFrame output.

Installation

pip install polars-rpsl

Usage

Schema-less reading

Read RPSL data into a nested structure where each object is a list of attribute name/value pairs:

from polars_rpsl import read_rpsl

df = read_rpsl("ripe.db.route.gz")
print(df)

Output:

shape: (3, 1)
┌─────────────────────────────────────────────────┐
│ attributes                                      │
│ ---                                             │
│ list[struct[2]]                                 │
╞═════════════════════════════════════════════════╡
│ [{"route","192.0.2.0/24"}, {"origin","AS65000"}│
│ , {"mnt-by","MAINT-AS65000"}]                   │
│ [{"route","198.51.100.0/24"}, {"origin","AS650…│
│ [{"route","203.0.113.0/24"}, {"origin","AS6500…│
└─────────────────────────────────────────────────┘

Schema-based reading

Read RPSL data into a flat DataFrame with typed columns:

import polars as pl
from polars_rpsl import read_rpsl

schema = pl.Schema({
    "route": pl.String,
    "origin": pl.String,
    "mnt-by": pl.List(pl.String),  # Multi-valued attribute
})

df = read_rpsl("ripe.db.route.gz", schema=schema)
print(df)

Output:

shape: (3, 3)
┌─────────────────┬──────────┬──────────────────────────────┐
│ route           ┆ origin   ┆ mnt-by                       │
│ ---             ┆ ---      ┆ ---                          │
│ str             ┆ str      ┆ list[str]                    │
╞═════════════════╪══════════╪══════════════════════════════╡
│ 192.0.2.0/24    ┆ AS65000  ┆ ["MAINT-AS65000"]            │
│ 198.51.100.0/24 ┆ AS65001  ┆ ["MAINT-AS65001", "RIPE-NCC… │
│ 203.0.113.0/24  ┆ AS65002  ┆ ["MAINT-AS65002"]            │
└─────────────────┴──────────┴──────────────────────────────┘

Schema-based reading:

  • Supports pl.String for single-valued attributes
  • Supports pl.List(pl.String) for multi-valued attributes
  • Returns None for missing single-valued attributes
  • Returns empty list [] for missing multi-valued attributes
  • Raises an error if a single-valued attribute appears multiple times
  • Ignores attributes not defined in the schema

Reading gzip files

Gzip-compressed files (.gz) are automatically detected and decompressed:

df = read_rpsl("ripe.db.route.gz")

Development

# Install dependencies
uv sync

# Build and install in development mode
uv run maturin develop

# Run tests
uv run pytest tests/ -v

# Build wheel
uv run maturin build --release --out dist/

Project Structure

rpsl-reader/
├── crates/
│   ├── rpsl-parser/     # Core parser (minimal dependencies)
│   └── polars-rpsl/     # Polars + Python bindings
├── python/
│   └── polars_rpsl/     # Python wrapper
└── tests/               # Python tests

License

MIT

Project details


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.

polars_rpsl-0.1.3-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.8 MB view details)

Uploaded PyPymanylinux: glibc 2.17+ x86-64

polars_rpsl-0.1.3-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ x86-64

polars_rpsl-0.1.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

polars_rpsl-0.1.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

polars_rpsl-0.1.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

polars_rpsl-0.1.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

polars_rpsl-0.1.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

File details

Details for the file polars_rpsl-0.1.3-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for polars_rpsl-0.1.3-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 78daf6a4b41f2d4604e38cb4b901f641b75bc01ec35e52b4d479fee219f7d2b9
MD5 bc575c450e090b7f8789df5bde76dc54
BLAKE2b-256 eba4226d15fedc2d46172491329eb18b1e8fe91934f14fff8ea781ca9ac7de8a

See more details on using hashes here.

Provenance

The following attestation bundles were made for polars_rpsl-0.1.3-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: python.yaml on ragnard/rpsl-reader

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

File details

Details for the file polars_rpsl-0.1.3-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for polars_rpsl-0.1.3-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f0fd53162179e70a575c0ef3f4e5eac369f740687c4a3dbc4dc6e58f312bde6e
MD5 ae6ab58fef8624eceb99c143f6e4a626
BLAKE2b-256 f8f7976b35babc895546d4b1f0a04e4c74efa4261b3f3fee2205e5ca22c8f75d

See more details on using hashes here.

Provenance

The following attestation bundles were made for polars_rpsl-0.1.3-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: python.yaml on ragnard/rpsl-reader

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

File details

Details for the file polars_rpsl-0.1.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for polars_rpsl-0.1.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 25c2421a485c759206f0b45058ca5328b04eb8a5d593e69d812a616dea9346f9
MD5 f677dd0588cdc116985e8ea7b930cf2f
BLAKE2b-256 1d5a2357280df035c0f6f85ced533c46865ad06fce82351658ab1e769ab275e2

See more details on using hashes here.

Provenance

The following attestation bundles were made for polars_rpsl-0.1.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: python.yaml on ragnard/rpsl-reader

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

File details

Details for the file polars_rpsl-0.1.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for polars_rpsl-0.1.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 96b661956bc0af7dad0d32aa5d368e900cda5ca8ce5bf22eefc0401e0423a920
MD5 ff43d5fb0b52e82174fd98f9e3bd3737
BLAKE2b-256 980e88730e09213a5f84b332af3510db13401ac6a3ac9da34baee4058a4b84c3

See more details on using hashes here.

Provenance

The following attestation bundles were made for polars_rpsl-0.1.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: python.yaml on ragnard/rpsl-reader

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

File details

Details for the file polars_rpsl-0.1.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for polars_rpsl-0.1.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 94ab3efc81e77f8450ad8867fa65cbbad5cbdbaa4ec384e6fb9ad8d09ca393ac
MD5 d36052733c996538171429725b95a4db
BLAKE2b-256 650bf66032bfe699eea8311840e2c1da79d63040fd546990750233a570f9280c

See more details on using hashes here.

Provenance

The following attestation bundles were made for polars_rpsl-0.1.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: python.yaml on ragnard/rpsl-reader

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

File details

Details for the file polars_rpsl-0.1.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for polars_rpsl-0.1.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c91efb08bc3704a01732155827f2f994eed233f50a526df4c74907697180b8d3
MD5 ca8f9257480e2fe58070320e6ac67162
BLAKE2b-256 946425c4f6e896ff28a3e5e0a1ae8522df2ff1585686369b21097119db89e95b

See more details on using hashes here.

Provenance

The following attestation bundles were made for polars_rpsl-0.1.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: python.yaml on ragnard/rpsl-reader

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

File details

Details for the file polars_rpsl-0.1.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for polars_rpsl-0.1.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 25fc6533666afd7ce4dd9ed8db627dc1262888027d9e51269f5bb0f636f0e8f8
MD5 79323ce49abefabb89092fea0a6c2f22
BLAKE2b-256 e3368404298f0716727876e845ed22e415ea5bbb89a4403e704cac8963d8604a

See more details on using hashes here.

Provenance

The following attestation bundles were made for polars_rpsl-0.1.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: python.yaml on ragnard/rpsl-reader

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

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page