Skip to main content

Beava: real-time feature server with composable streaming pipelines (Python SDK + bundled Rust server binary).

Project description

beava — Python SDK

Python SDK for Beava, the single-binary real-time feature server. Author pipelines with @bv.event / @bv.table decorators; push events and read features against a running beava server over HTTP or TCP.

Install

# pip    (recommended) — installs SDK + bundled Rust server binary from PyPI
pip install beava

# brew   — Homebrew formula (macOS + Linuxbrew)
brew install beava-dev/beava/beava

# docker — zero deps on the host
docker run -p 8080:8080 -p 8081:8081 beavadev/beava:latest

The wheel ships the SDK and the Rust beava server binary (polars-style); after install, the beava shell command is on PATH and the SDK can run against it directly — including embed mode (bv.App() with no URL). Pin a specific version with pip install beava==0.0.0.

Quickstart

import beava as bv

@bv.event
class Click:
    user_id: str
    page: str

@bv.table(key="user_id")
def UserActivity(e: Click):
    return e.group_by("user_id").agg(
        clicks_1h=bv.count(window="1h"),
        unique_pages_1h=bv.n_unique("page", window="1h"),
    )

app = bv.App(url="http://localhost:8080")
app.register(Click, UserActivity)

app.push("Click", {"user_id": "alice", "page": "/home"})
app.push("Click", {"user_id": "alice", "page": "/products"})

app.get("UserActivity", "alice")
# => {"clicks_1h": 2, "unique_pages_1h": 2}

Transports

The same SDK speaks three transports — pick by the URL you pass to bv.App(...).

# HTTP/JSON (curl-compatible debugging path)
app = bv.App(url="http://localhost:8080")

# Framed TCP (sub-millisecond fast-path; JSON or msgpack content)
app = bv.App(url="tcp://localhost:8081")

# Embed mode (no separate server — auto-spawns a local `beava` binary)
app = bv.App()

Embed mode finds the beava binary that ships with the curl-installed wheel automatically. Override with BEAVA_BINARY=/path/to/beava if you want to point at a different build.

Surface

Method Wire Notes
app.register(*descriptors, force=False, dry_run=False) POST /register Returns {"registry_version": <n>}. Pass force=True for destructive schema changes; dry_run=True returns a categorized diff without applying.
app.push(event_name, fields) POST /push body {event, data} Fire-and-forget. Returns server ack.
app.get(table, key=None, features=None) POST /get body {table, key} Returns a flat dict of feature values. key=None routes to the global-aggregation sentinel (ADR-003). features=[...] narrows to a subset.
app.batch_get(requests) POST /batch_get body {requests: [...]} requests is a list of (table, key) or (table, key, features) tuples. Returns a list of dicts in input order.
app.reset() POST /reset (test_mode-only) Wipes server state. Pass test_mode=True to bv.App(...) to enable.
app.ping() POST /ping Liveness; returns {"pong": True, "registry_version": <n>}.
app.close() Releases the transport connection.

Pipeline DSL

@bv.event declares an event schema. Fields are typed Python class attributes; the SDK serializes them to JSON on push.

@bv.table(key=...) declares a feature table. The decorated function takes one event-typed parameter and returns e.group_by(...).agg(...) over it. The runtime maintains the table incrementally — every event updates exactly the affected key's row.

The key= kwarg accepts a string (single-column key) or a list of strings (composite key).

bv.col("name") references an event field inside a where= filter or arithmetic expression. Strings in where= are rejected — pass an _Expr (e.g. bv.col("event_type") == "click").

bv.lit(value) wraps a Python literal so it can participate in the same expression grammar.

Operator catalogue

50+ aggregation primitives are exported flat at the bv.* namespace. Inspect the live surface from Python:

import beava as bv
print([x for x in dir(bv) if not x.startswith("_")])

Selection by family:

  • Corecount, sum, mean, min, max, var, std, n_unique, quantile
  • Sketchtop_k, bloom_member, entropy, histogram, hour_of_day_histogram, dow_hour_histogram
  • Recencyfirst, last, first_n, last_n, lag, first_seen, last_seen, age, time_since
  • Decayewma, ema, ewvar, ew_zscore, decayed_sum, decayed_count
  • Velocityrate_of_change, inter_arrival_stats, burst_count, delta_from_prev, trend, z_score
  • Buffer / geomost_recent_n, reservoir_sample, geo_velocity, geo_distance, geo_spread, distance_from_home

Deprecation aliases retained: avg → mean, variance → var, stddev → std, count_distinct → n_unique, percentile → quantile. Use the canonical form in new code.

Demo data

bv.demo exposes three pre-built pipelines + dataset loaders for trying the SDK without writing your own pipeline:

import beava as bv
adtech = bv.demo.adtech()      # ad-impression / click / conversion
fraud = bv.demo.fraud()        # transaction fraud
ecommerce = bv.demo.ecommerce()  # cart / view / purchase

Each returns a tuple of (events, tables, dataset) ready to register and push.

Errors

Top-level error types: bv.RegistrationError (raised on register failures with structured code + message), bv.ValidationError (raised by client-side input validators), bv.BinaryNotFoundError (raised in embed mode if the beava binary isn't on PATH).

Learn more

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

beava-0.0.5.tar.gz (1.3 MB view details)

Uploaded Source

Built Distributions

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

beava-0.0.5-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.7 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

beava-0.0.5-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.5 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

beava-0.0.5-py3-none-macosx_11_0_arm64.whl (2.4 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

beava-0.0.5-py3-none-macosx_10_12_x86_64.whl (2.6 MB view details)

Uploaded Python 3macOS 10.12+ x86-64

File details

Details for the file beava-0.0.5.tar.gz.

File metadata

  • Download URL: beava-0.0.5.tar.gz
  • Upload date:
  • Size: 1.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for beava-0.0.5.tar.gz
Algorithm Hash digest
SHA256 94ad314518677d257f85fac9a8326dcb0a7f2514fed2381325274090f741839c
MD5 a99039663f5f4ab5a984c25b652d7a22
BLAKE2b-256 1425e089c0af5f6bbbe5d189f1b541e9230dcc1f4d8444491d0d3e83b88c219d

See more details on using hashes here.

Provenance

The following attestation bundles were made for beava-0.0.5.tar.gz:

Publisher: release-wheels.yml on beava-dev/beava

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

File details

Details for the file beava-0.0.5-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for beava-0.0.5-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f492744ef7c167565b57f50dfd0f15ec305377f3ae2233efd54288fb2ff6a905
MD5 de8576060a1603372a103d8918db56d9
BLAKE2b-256 3d4776ac9b630f8413fe8d3cab3a9f551bcacbe199b78ec321937c649395ff87

See more details on using hashes here.

Provenance

The following attestation bundles were made for beava-0.0.5-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release-wheels.yml on beava-dev/beava

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

File details

Details for the file beava-0.0.5-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for beava-0.0.5-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 83077f9b8939f4d0bb12508c65b482c23a455c1b7db7eb3b95b3458e1d5da601
MD5 3c941e5bff484b24cdf10e19567f5074
BLAKE2b-256 43edcaf7b4a72aff39df8679933b2e1435f41c806cbce964271ed316bb5e80e8

See more details on using hashes here.

Provenance

The following attestation bundles were made for beava-0.0.5-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release-wheels.yml on beava-dev/beava

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

File details

Details for the file beava-0.0.5-py3-none-macosx_11_0_arm64.whl.

File metadata

  • Download URL: beava-0.0.5-py3-none-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 2.4 MB
  • Tags: Python 3, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for beava-0.0.5-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2bc082533258f4b2d870b76adf73267cab5025cb58ea02c986339e5f7dd6f52e
MD5 ac15c91f745a2a38f75f9fe51869be71
BLAKE2b-256 3df6c2b07b8b0b2baa84b1afd7892483fc4e19636e781766509085b7f308028a

See more details on using hashes here.

Provenance

The following attestation bundles were made for beava-0.0.5-py3-none-macosx_11_0_arm64.whl:

Publisher: release-wheels.yml on beava-dev/beava

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

File details

Details for the file beava-0.0.5-py3-none-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for beava-0.0.5-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 c9412f614abe2477fb72f1010d9da9ff624c41de8d74763f99557f8d3837b9b7
MD5 53b71b09bcb278675f9e5ccfe8f49bf9
BLAKE2b-256 b07dfaff2c6e981b71310816b294f1c59e145c25af2fadb71f415b6c3aada3f4

See more details on using hashes here.

Provenance

The following attestation bundles were made for beava-0.0.5-py3-none-macosx_10_12_x86_64.whl:

Publisher: release-wheels.yml on beava-dev/beava

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