Feature guards, observability, and security response in a single import. Evaluated locally with zero network overhead per check
Project description
Liteguard Python SDK
Installation
pip install liteguard
Requires Python 3.9+.
Quick Start
from liteguard import ClientOptions, LiteguardClient
client = LiteguardClient(
"pct-...",
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_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.
contextvarskeep 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
Release history Release notifications | RSS feed
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.3.20260315.tar.gz
(20.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file liteguard-0.3.20260315.tar.gz.
File metadata
- Download URL: liteguard-0.3.20260315.tar.gz
- Upload date:
- Size: 20.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef47fa4ab939159911d4f62de556558f374fbaef44488c7ddc3a5ed294851b04
|
|
| MD5 |
f7037facfffeaad4687764cbbeb8fff5
|
|
| BLAKE2b-256 |
321f33ca349bb0e13eb1909ac3b308b788cbe44f8cf2c766e5d49efe5ba032b6
|
File details
Details for the file liteguard-0.3.20260315-py3-none-any.whl.
File metadata
- Download URL: liteguard-0.3.20260315-py3-none-any.whl
- Upload date:
- Size: 14.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e2333fff7597a34c60b5ed0be05887d6303d883e473120a3a97e402f0e46e767
|
|
| MD5 |
bb9a7a766bf1db8d7ad5f7ea3f39bc3d
|
|
| BLAKE2b-256 |
2f6c67f047b2f38ef904badae8d2060a135fb8856c69154019bffbb2bcbf5116
|