Skip to main content

Feature guards, observability, and security response in a single import. Evaluated locally with zero network overhead per check

Project description

Liteguard Python SDK

Python SDK PyPI

Installation

pip install liteguard

Requires Python 3.9+.

Quick Start

from liteguard import ClientOptions, LiteguardClient

client = LiteguardClient(
    "pct-...",
    ClientOptions(environment="env-production"),
)
client.start()

scope = client.create_scope({"user_id": "user-123", "plan": "pro"})

if scope.is_open("payments.checkout"):
    ...

client.shutdown()

Primary API

  • LiteguardClient(project_client_token, options) creates a client.
  • client.start() fetches the initial bundle and starts refresh and flush workers.
  • client.create_scope(properties=None) creates an immutable request scope.
  • scope.is_open(name, options=None) evaluates a guard locally.
  • scope.execute_if_open(name, fn, options=None) measures guarded execution.
  • scope.bind_protected_context(protected_context) returns a derived protected scope.
  • client.flush_signals() flushes buffered telemetry.
  • client.shutdown() flushes and stops background workers.

Notes

  • Guard evaluation is fully local after the initial fetch.
  • Scopes are immutable and request-scoped.
  • contextvars keep overlapping async request scopes isolated.
  • Unadopted guards default open and emit no signals.

Development

make test-python

License

Apache 2.0 see LICENSE.

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

liteguard-0.4.20260317.tar.gz (20.7 kB view details)

Uploaded Source

Built Distribution

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

liteguard-0.4.20260317-py3-none-any.whl (14.4 kB view details)

Uploaded Python 3

File details

Details for the file liteguard-0.4.20260317.tar.gz.

File metadata

  • Download URL: liteguard-0.4.20260317.tar.gz
  • Upload date:
  • Size: 20.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for liteguard-0.4.20260317.tar.gz
Algorithm Hash digest
SHA256 537a3a69960cf63c2ca047baa87029c719b4c84ff5bb0bc48f06685275e8b587
MD5 f078cdd152f3b2b20cf17299fa39a215
BLAKE2b-256 8c820f7c37077452ceb5f21ff46c0567b17f64c66a58627d367302b6c88c7a00

See more details on using hashes here.

File details

Details for the file liteguard-0.4.20260317-py3-none-any.whl.

File metadata

File hashes

Hashes for liteguard-0.4.20260317-py3-none-any.whl
Algorithm Hash digest
SHA256 134d47713e580309715eeb6309014ba42662bdd3d9da530288d181b9a8fcf10b
MD5 74ea052a6c6988fd6705a7f5449e7191
BLAKE2b-256 a22b70ef3062fed1ba164a9f34f505303d27d59353f38ca70f8a60424e4bebcf

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