Skip to main content

Drop-in replacement for PyBGPStream using BGPKIT

Project description

PyBGPFlux

Docs PyPI - Version CI License

A drop-in replacement for PyBGPStream using BGPKIT.
For a high-performance Rust library and CLI, check out bgpflux.

Features

  • Generates time-ordered BGP messages on the fly from RIBs and updates MRT files of multiple collectors
  • Stream the same BGP messages as PyBGPStream, enabling seamless, drop-in replacement
  • Lazy loading consumes minimal memory, making it suitable for large datasets
  • Multiple BGP parsers supported: pybgpkit (default but slow), bgpkit-parser, bgpdump and pybgpstream single file backend (the latter three are system dependencies)
  • Multiple BGP archive brokers supported: bgpkit (default, self-hostable), bgpstream, bgpfinder (self-hostable)
  • Caching with concurrent downloading fully compatible with the BGPKIT parser's caching functionality.
  • Performance: for updates, typically 3–10× faster than PyBGPStream; for RIB-only processing, currently about 3–4× slower (see perf.md for test details).
  • A CLI tool

Quick start

Installation:

pip install pybgpflux

Usage:

import datetime
from pybgpflux import BGPStreamConfig, BGPStream

config = BGPStreamConfig(
    start_time=datetime.datetime(2010, 9, 1, 0, 0),
    end_time=datetime.datetime(2010, 9, 1, 1, 59),
    collectors=["route-views.wide", "rrc04"],
    data_types=["ribs", "updates"],
)

stream = BGPStream.from_config(config)

n_elems = 0
for elem in stream:
  n_elems += 1
    
print(f"Processed {n_elems} BGP elements")

or in the terminal:

pybgpflux --start-time 2010-09-01T00:00:00 --end-time 2010-09-01T01:59:00 --collectors route-views.sydney route-views.wide --data-types updates > updates.txt

Motivation

While PyBGPStream has long been the primary tool for streaming historical BGP data from multiple collectors, it is currently no longer actively maintained. New features are lagging (extended communities, RFC 9234) and the broker has become unreliable.

PyBGPFlux was developed to fill this gap, providing a modern, maintained alternative that restores these capabilities. PyBGPFlux is a library designed for maximum flexibility, utilizing Python to seamlessly integrate multiple parsers and brokers.

Missing features

  • Live mode for RouteViews collectors
  • Some PyBGPStream data interface options like csv or sqlite

Project details


Download files

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

Source Distribution

pybgpflux-0.5.2.tar.gz (21.4 kB view details)

Uploaded Source

Built Distribution

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

pybgpflux-0.5.2-py3-none-any.whl (29.8 kB view details)

Uploaded Python 3

File details

Details for the file pybgpflux-0.5.2.tar.gz.

File metadata

  • Download URL: pybgpflux-0.5.2.tar.gz
  • Upload date:
  • Size: 21.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.22 {"installer":{"name":"uv","version":"0.11.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for pybgpflux-0.5.2.tar.gz
Algorithm Hash digest
SHA256 21563adf9cef7036b92fbe36e5e8d7bdfb01fb9806105447af929bea343bf3df
MD5 e2ee574e9df17c4dcb54cac5997c2465
BLAKE2b-256 ffbfd85ba759b066533b998c4b0b98b2cab0d0ba59c7247836092d99beb26d8f

See more details on using hashes here.

File details

Details for the file pybgpflux-0.5.2-py3-none-any.whl.

File metadata

  • Download URL: pybgpflux-0.5.2-py3-none-any.whl
  • Upload date:
  • Size: 29.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.22 {"installer":{"name":"uv","version":"0.11.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for pybgpflux-0.5.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ad33ef4b3bce7a2d3fa23eb5b4a047e5353c4df4a5ff5ec60fb56b6b8a9b340b
MD5 b6156f7dc104cf2903f0cdc8bf1e0788
BLAKE2b-256 a2404a81bc648f222fd9b31297c934891fe8298f05870937b313e7411ca8639f

See more details on using hashes here.

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