Skip to main content

Feature guards, observability, and security response in a single import — evaluated locally, 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(
    "pckid-...",
    ClientOptions(environment="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_key_id, 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.2.20260314.tar.gz (19.6 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.2.20260314-py3-none-any.whl (13.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for liteguard-0.2.20260314.tar.gz
Algorithm Hash digest
SHA256 59af6c3a68f0fedc249a64e1135a852ef969e0eeee13d1efc328ca0d149d4aeb
MD5 979e3137a4a8897a91802b2dee0f9c71
BLAKE2b-256 0ad2c519c691126cac21333c87a78dc5628ac930227c7f415d085c91e3c3af97

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for liteguard-0.2.20260314-py3-none-any.whl
Algorithm Hash digest
SHA256 9eabc771e9f0668491cfe80324070e64cf3aeaf3add2bfe99db028f17f22ce94
MD5 d4499861629477bd9fa7e293ffac8c6e
BLAKE2b-256 681925001a663085826047b8a942cc778055af32ad76064daaa35260bf67e172

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