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.com") 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.1.tar.gz (11.7 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.1-py3-none-any.whl (13.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: barricator_client-0.1.1.tar.gz
  • Upload date:
  • Size: 11.7 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.1.tar.gz
Algorithm Hash digest
SHA256 b85b92b299246c3ad8fc209fc7e127a9ae695a7129b4740c5746a6fccdbd98d7
MD5 60b64f72af7ffb837158243f041c49da
BLAKE2b-256 3db6a97d90e3322f793fd1dba3aa2f60d6dce082ebda14008681a04868b24531

See more details on using hashes here.

Provenance

The following attestation bundles were made for barricator_client-0.1.1.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.1-py3-none-any.whl.

File metadata

File hashes

Hashes for barricator_client-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 021c293232a5c41ea373d64a59605be60cb2b014d808fc8f6556734f17ad34c9
MD5 85252b3abc98c5bbe62f6861279dc1c1
BLAKE2b-256 628acad3f5f7ab222f33e41b3002a1a20b3c3249a558b614e19ce560b0a73cd7

See more details on using hashes here.

Provenance

The following attestation bundles were made for barricator_client-0.1.1-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