Skip to main content

Barricator production-grade Python Server SDK (local evaluation, SSE sync, telemetry)

Project description

barricator-python-client

PyPI

Production-grade Python Server SDK for Barricator. Standard library only (no third-party runtime deps), Python 3.9+.

Install

pip install barricator-client

Guarantees

  • Zero-latency evaluation. is_enabled(...) is a synchronous in-memory dict lookup — no I/O.
  • Local evaluation that mirrors the backend engine exactly (incl. MurmurHash3 bucketing — verified byte-identical with the Java SDK).
  • Real-time sync over SSE on a daemon thread, with exponential backoff + jitter on disconnect and graceful fallback to cached state.
  • Async telemetry flushed every 30s; never blocks the host application.
  • Two tracks: synchronous BarricatorClient and asyncio-native AsyncBarricatorClient.

Sync usage

from barricator import BarricatorClient, UserContext

with BarricatorClient("sdk-srv-...", base_url="https://app.barricator.io") as client:
    user = UserContext("user-123", email="user@enterprise.com", custom={"plan": "pro"})
    if client.is_enabled("premium-pricing", user):
        ...
    theme = client.string_variation("homepage-theme", user, "control")

Async usage

from barricator import AsyncBarricatorClient, UserContext

async with await AsyncBarricatorClient.create("sdk-srv-...") as client:
    user = UserContext("user-123", country="US")
    enabled = client.is_enabled("beta-feature", user)   # evaluation is sync (in-memory)

Test

python3 -m unittest discover -s tests -v

Layout

Module Responsibility
barricator.client / barricator.aio Sync / async clients
barricator.evaluation Local targeting engine
barricator.store Thread-safe FlagStore + MetricsBuffer
barricator.transport urllib bootstrap/flush + SSE parsing
barricator.murmur MurmurHash3 (cross-SDK consistent)
barricator.context UserContext

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

barricator_client-0.1.0.tar.gz (11.8 kB view details)

Uploaded Source

Built Distribution

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

barricator_client-0.1.0-py3-none-any.whl (13.0 kB view details)

Uploaded Python 3

File details

Details for the file barricator_client-0.1.0.tar.gz.

File metadata

  • Download URL: barricator_client-0.1.0.tar.gz
  • Upload date:
  • Size: 11.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for barricator_client-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d737b77924a7cadb6d7e89b45e9420b1ca0d0031993b466f8b19ae4cc95db1b4
MD5 51d003b33c71213227cf3464b31629ea
BLAKE2b-256 6587ab7d3ca4ed66bbaccb80ff73e75c7a259dc47cb6191b96e7e1ba508b0c4f

See more details on using hashes here.

Provenance

The following attestation bundles were made for barricator_client-0.1.0.tar.gz:

Publisher: release.yml on barricator/barricator-python-client

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

File details

Details for the file barricator_client-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for barricator_client-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 aff2013cdef126f8bd729a05d2fe526cc49f3f44c9b2d7d8a208b3fe416ad2cc
MD5 5340ace5dbfaf5e761787c1a01d75d54
BLAKE2b-256 a53bc789b04f529d1b13f816526c2c8e75635bb1c3035219e4dcdc35b5dd987d

See more details on using hashes here.

Provenance

The following attestation bundles were made for barricator_client-0.1.0-py3-none-any.whl:

Publisher: release.yml on barricator/barricator-python-client

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