liteguard 0.2.20260314__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,9 @@
1
+ __pycache__
2
+ *.pyc
3
+ *.pyo
4
+ .pytest_cache
5
+ .venv
6
+ venv
7
+ *.egg-info
8
+ dist
9
+ build
@@ -0,0 +1,55 @@
1
+ # Node
2
+ node_modules/
3
+ dist/
4
+ *.tsbuildinfo
5
+
6
+ # Python
7
+ __pycache__/
8
+ *.py[cod]
9
+ *.egg-info/
10
+ .venv/
11
+ venv/
12
+ dist/
13
+ build/
14
+ .pytest_cache/
15
+ *.egg
16
+ .coverage
17
+ htmlcov/
18
+
19
+ # Go
20
+ vendor/
21
+
22
+ # Java
23
+ target/
24
+ *.class
25
+ *.jar
26
+
27
+ # Rust
28
+ target/
29
+
30
+ # Ruby
31
+ .bundle/
32
+ vendor/bundle/
33
+ Gemfile.lock
34
+ *.gem
35
+
36
+ # IDE
37
+ .idea/
38
+ .vscode/
39
+ *.iml
40
+ *.swp
41
+ *.swo
42
+ *~
43
+
44
+ # OS
45
+ .DS_Store
46
+ Thumbs.db
47
+
48
+ # Environment
49
+ *.env
50
+ *.env.local
51
+
52
+ # Coverage & test output
53
+ coverage/
54
+ *.lcov
55
+ tests/conformance/*.json
@@ -0,0 +1,27 @@
1
+ # syntax=docker/dockerfile:1.4
2
+ ARG PYTHON_VERSION=3.12
3
+
4
+ FROM node:22-slim AS conformance-fixtures
5
+
6
+ WORKDIR /fixtures
7
+
8
+ COPY --from=shared_tests / ./tests/
9
+ COPY --from=repo_tools / ./tools/
10
+
11
+ RUN npm ci --prefix tools \
12
+ && npm --prefix tools run conformance:yaml-to-json
13
+
14
+ FROM python:${PYTHON_VERSION}-slim
15
+
16
+ WORKDIR /app
17
+
18
+ # Install the package (editable) and dev dependencies.
19
+ # Copy only the project metadata first so this layer is cached until pyproject.toml changes.
20
+ COPY pyproject.toml README.md ./
21
+ COPY src src/
22
+ RUN pip install --no-cache-dir -e ".[dev]"
23
+
24
+ COPY tests tests/
25
+ COPY --from=conformance-fixtures /fixtures/tests/ ./tests/
26
+
27
+ CMD ["sh", "-ec", "count=\"${LITEGUARD_TESTS_COUNT:-1}\"; case \"$count\" in ''|*[!0-9]*) echo 'LITEGUARD_TESTS_COUNT must be a positive integer' >&2; exit 1 ;; esac; if [ \"$count\" -lt 1 ]; then echo 'LITEGUARD_TESTS_COUNT must be a positive integer' >&2; exit 1; fi; i=1; while [ \"$i\" -le \"$count\" ]; do echo \"==> pytest run $i/$count\"; pytest --tb=short -q; i=$((i + 1)); done"]
@@ -0,0 +1,87 @@
1
+ Metadata-Version: 2.4
2
+ Name: liteguard
3
+ Version: 0.2.20260314
4
+ Summary: Feature guards, observability, and security response in a single import — evaluated locally, zero network overhead per check
5
+ Project-URL: Homepage, https://liteguard.io
6
+ Project-URL: Documentation, https://github.com/liteguard/liteguard/tree/main/sdk/python
7
+ Project-URL: Source, https://github.com/liteguard/liteguard
8
+ Project-URL: Tracker, https://github.com/liteguard/liteguard/issues
9
+ License: Apache-2.0
10
+ Keywords: feature-flags,feature-guards,liteguard,observability,security
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: Apache Software License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.9
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Topic :: Internet
21
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
22
+ Classifier: Typing :: Typed
23
+ Requires-Python: >=3.9
24
+ Provides-Extra: dev
25
+ Requires-Dist: pytest-cov>=5.0; extra == 'dev'
26
+ Requires-Dist: pytest>=8.0; extra == 'dev'
27
+ Description-Content-Type: text/markdown
28
+
29
+ # Liteguard Python SDK
30
+
31
+ [![Python SDK](https://github.com/liteguard/liteguard/actions/workflows/test-python.yml/badge.svg)](https://github.com/liteguard/liteguard/actions/workflows/test-python.yml)
32
+ [![PyPI](https://img.shields.io/pypi/v/liteguard)](https://pypi.org/project/liteguard/)
33
+
34
+ ## Installation
35
+
36
+ ```bash
37
+ pip install liteguard
38
+ ```
39
+
40
+ Requires Python 3.9+.
41
+
42
+ ## Quick Start
43
+
44
+ ```python
45
+ from liteguard import ClientOptions, LiteguardClient
46
+
47
+ client = LiteguardClient(
48
+ "pckid-...",
49
+ ClientOptions(environment="production"),
50
+ )
51
+ client.start()
52
+
53
+ scope = client.create_scope({"user_id": "user-123", "plan": "pro"})
54
+
55
+ if scope.is_open("payments.checkout"):
56
+ ...
57
+
58
+ client.shutdown()
59
+ ```
60
+
61
+ ## Primary API
62
+
63
+ - `LiteguardClient(project_client_key_id, options)` creates a client.
64
+ - `client.start()` fetches the initial bundle and starts refresh and flush workers.
65
+ - `client.create_scope(properties=None)` creates an immutable request scope.
66
+ - `scope.is_open(name, options=None)` evaluates a guard locally.
67
+ - `scope.execute_if_open(name, fn, options=None)` measures guarded execution.
68
+ - `scope.bind_protected_context(protected_context)` returns a derived protected scope.
69
+ - `client.flush_signals()` flushes buffered telemetry.
70
+ - `client.shutdown()` flushes and stops background workers.
71
+
72
+ ## Notes
73
+
74
+ - Guard evaluation is fully local after the initial fetch.
75
+ - Scopes are immutable and request-scoped.
76
+ - `contextvars` keep overlapping async request scopes isolated.
77
+ - Unadopted guards default open and emit no signals.
78
+
79
+ ## Development
80
+
81
+ ```bash
82
+ make test-python
83
+ ```
84
+
85
+ ## License
86
+
87
+ Apache 2.0 — see [LICENSE](https://github.com/liteguard/liteguard/blob/main/LICENSE).
@@ -0,0 +1,59 @@
1
+ # Liteguard Python SDK
2
+
3
+ [![Python SDK](https://github.com/liteguard/liteguard/actions/workflows/test-python.yml/badge.svg)](https://github.com/liteguard/liteguard/actions/workflows/test-python.yml)
4
+ [![PyPI](https://img.shields.io/pypi/v/liteguard)](https://pypi.org/project/liteguard/)
5
+
6
+ ## Installation
7
+
8
+ ```bash
9
+ pip install liteguard
10
+ ```
11
+
12
+ Requires Python 3.9+.
13
+
14
+ ## Quick Start
15
+
16
+ ```python
17
+ from liteguard import ClientOptions, LiteguardClient
18
+
19
+ client = LiteguardClient(
20
+ "pckid-...",
21
+ ClientOptions(environment="production"),
22
+ )
23
+ client.start()
24
+
25
+ scope = client.create_scope({"user_id": "user-123", "plan": "pro"})
26
+
27
+ if scope.is_open("payments.checkout"):
28
+ ...
29
+
30
+ client.shutdown()
31
+ ```
32
+
33
+ ## Primary API
34
+
35
+ - `LiteguardClient(project_client_key_id, options)` creates a client.
36
+ - `client.start()` fetches the initial bundle and starts refresh and flush workers.
37
+ - `client.create_scope(properties=None)` creates an immutable request scope.
38
+ - `scope.is_open(name, options=None)` evaluates a guard locally.
39
+ - `scope.execute_if_open(name, fn, options=None)` measures guarded execution.
40
+ - `scope.bind_protected_context(protected_context)` returns a derived protected scope.
41
+ - `client.flush_signals()` flushes buffered telemetry.
42
+ - `client.shutdown()` flushes and stops background workers.
43
+
44
+ ## Notes
45
+
46
+ - Guard evaluation is fully local after the initial fetch.
47
+ - Scopes are immutable and request-scoped.
48
+ - `contextvars` keep overlapping async request scopes isolated.
49
+ - Unadopted guards default open and emit no signals.
50
+
51
+ ## Development
52
+
53
+ ```bash
54
+ make test-python
55
+ ```
56
+
57
+ ## License
58
+
59
+ Apache 2.0 — see [LICENSE](https://github.com/liteguard/liteguard/blob/main/LICENSE).
@@ -0,0 +1,45 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "liteguard"
7
+ version = "0.2.20260314"
8
+ description = "Feature guards, observability, and security response in a single import — evaluated locally, zero network overhead per check"
9
+ readme = "README.md"
10
+ license = { text = "Apache-2.0" }
11
+ requires-python = ">=3.9"
12
+ keywords = ["feature-flags", "feature-guards", "liteguard", "security", "observability"]
13
+ dependencies = []
14
+ classifiers = [
15
+ "Development Status :: 4 - Beta",
16
+ "Intended Audience :: Developers",
17
+ "License :: OSI Approved :: Apache Software License",
18
+ "Programming Language :: Python :: 3",
19
+ "Programming Language :: Python :: 3.9",
20
+ "Programming Language :: Python :: 3.10",
21
+ "Programming Language :: Python :: 3.11",
22
+ "Programming Language :: Python :: 3.12",
23
+ "Programming Language :: Python :: 3.13",
24
+ "Topic :: Software Development :: Libraries :: Python Modules",
25
+ "Topic :: Internet",
26
+ "Typing :: Typed",
27
+ ]
28
+
29
+ [project.urls]
30
+ Homepage = "https://liteguard.io"
31
+ Documentation = "https://github.com/liteguard/liteguard/tree/main/sdk/python"
32
+ Source = "https://github.com/liteguard/liteguard"
33
+ Tracker = "https://github.com/liteguard/liteguard/issues"
34
+
35
+ [project.optional-dependencies]
36
+ dev = [
37
+ "pytest>=8.0",
38
+ "pytest-cov>=5.0",
39
+ ]
40
+
41
+ [tool.hatch.build.targets.wheel]
42
+ packages = ["src/liteguard"]
43
+
44
+ [tool.pytest.ini_options]
45
+ testpaths = ["tests"]
@@ -0,0 +1,33 @@
1
+ """Liteguard Python SDK."""
2
+
3
+ from .client import LiteguardClient, LiteguardScope
4
+ from .types import (
5
+ ClientOptions,
6
+ Guard,
7
+ Options,
8
+ Properties,
9
+ PropertyValue,
10
+ ProtectedContext,
11
+ Rule,
12
+ SendUnadoptedGuardsRequest,
13
+ SendUnadoptedGuardsResponse,
14
+ Signal,
15
+ TraceContext,
16
+ )
17
+
18
+ __all__ = [
19
+ "LiteguardClient",
20
+ "LiteguardScope",
21
+ # types
22
+ "Guard",
23
+ "ClientOptions",
24
+ "Options",
25
+ "Properties",
26
+ "PropertyValue",
27
+ "ProtectedContext",
28
+ "Rule",
29
+ "SendUnadoptedGuardsRequest",
30
+ "SendUnadoptedGuardsResponse",
31
+ "Signal",
32
+ "TraceContext",
33
+ ]