Liteguard Python SDK
- Website: liteguard.io
- Project Page: https://github.com/liteguard/liteguard
- Issues: https://github.com/liteguard/liteguard/issues/new
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.evaluate(name, options=None)returns aGuardDecisionwith the full evaluation result.scope.execute_if_open(name, fn, options=None)measures guarded execution.scope.start_execution()creates an execution correlation handle.scope.bind_protected_context(protected_context)returns a derived protected scope.scope.get_properties()returns the current property bag for transport.client.flush_signals()flushes buffered telemetry.client.shutdown()flushes and stops background workers.
Convenience helpers
For server applications that want request-scoped context propagation:
client.run_with_scope(scope, fn)runsfnwithscopeas the active scope, propagated across async boundaries viacontextvars.client.get_active_scope()returns the scope bound to the current request.client.with_properties(properties, fn)derives and activates a scope with additional properties.client.with_protected_context(protected_context, fn)derives and activates a protected scope.
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.
- The convenience helpers above also serve as infrastructure for auto-instrumentation of third-party dependencies. See the Liteguard CLI for build-time instrumentation.
Development
make test-python
License
Apache 2.0 see LICENSE.
Metadata
Release files for liteguard 0.6.20260405
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| liteguard-0.6.20260405.tar.gz | 22.5 kB | Without provenance | Details for liteguard-0.6.20260405.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| liteguard-0.6.20260405-py3-none-any.whl | Python 3 | none | any | Details for liteguard-0.6.20260405-py3-none-any.whl |
Total release size: 38.9 kB
Release files / liteguard-0.6.20260405.tar.gz
| Download URL | liteguard-0.6.20260405.tar.gz |
|---|---|
| Size | 22.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b069148b041c24e299149d48a5bc224857677b82175ea083397391fcd3e6b16e
|
|
BLAKE2b-256 checksum How to use checksums |
ee182eb8d6a50930963cb755467ac0668b2c0d1376545963f6269488e38c76e3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|
Release files / liteguard-0.6.20260405-py3-none-any.whl
| Download URL | liteguard-0.6.20260405-py3-none-any.whl |
|---|---|
| Size | 16.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
be5ac9317c8e658e978b11f495256b2a9646f1f6845adee54ef2a855a0c567bd
|
|
BLAKE2b-256 checksum How to use checksums |
396df59d19ec2a2d963a88ad996af275af7ea2377df25e8913d3f86f59c35b14
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|
Security for liteguard 0.6.20260405
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.