orbit-sdk 1.0.0__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.
- orbit_sdk-1.0.0/.gitignore +7 -0
- orbit_sdk-1.0.0/PKG-INFO +253 -0
- orbit_sdk-1.0.0/README.md +237 -0
- orbit_sdk-1.0.0/pyproject.toml +66 -0
- orbit_sdk-1.0.0/requirements-test.txt +19 -0
- orbit_sdk-1.0.0/scripts/bench_overhead.py +111 -0
- orbit_sdk-1.0.0/scripts/domain_export.mjs +17 -0
- orbit_sdk-1.0.0/src/orbit/__init__.py +259 -0
- orbit_sdk-1.0.0/src/orbit/_autoimport.py +121 -0
- orbit_sdk-1.0.0/src/orbit/_bootstrap/sitecustomize.py +18 -0
- orbit_sdk-1.0.0/src/orbit/_classify.py +281 -0
- orbit_sdk-1.0.0/src/orbit/_core.py +1014 -0
- orbit_sdk-1.0.0/src/orbit/_db.py +216 -0
- orbit_sdk-1.0.0/src/orbit/_inbound.py +299 -0
- orbit_sdk-1.0.0/src/orbit/_logs.py +66 -0
- orbit_sdk-1.0.0/src/orbit/_outbound.py +206 -0
- orbit_sdk-1.0.0/src/orbit/_pii.py +134 -0
- orbit_sdk-1.0.0/src/orbit/_trackers.py +103 -0
- orbit_sdk-1.0.0/src/orbit/auto.py +10 -0
- orbit_sdk-1.0.0/src/orbit/py.typed +0 -0
- orbit_sdk-1.0.0/src/orbit/run.py +28 -0
- orbit_sdk-1.0.0/tests/__init__.py +0 -0
- orbit_sdk-1.0.0/tests/conftest.py +241 -0
- orbit_sdk-1.0.0/tests/djapp/__init__.py +0 -0
- orbit_sdk-1.0.0/tests/djapp/models.py +11 -0
- orbit_sdk-1.0.0/tests/djproject.py +54 -0
- orbit_sdk-1.0.0/tests/test_auto.py +65 -0
- orbit_sdk-1.0.0/tests/test_classify.py +70 -0
- orbit_sdk-1.0.0/tests/test_consent_tasks.py +169 -0
- orbit_sdk-1.0.0/tests/test_db.py +133 -0
- orbit_sdk-1.0.0/tests/test_inbound.py +155 -0
- orbit_sdk-1.0.0/tests/test_lifecycle.py +205 -0
- orbit_sdk-1.0.0/tests/test_novalues.py +101 -0
- orbit_sdk-1.0.0/tests/test_outbound.py +174 -0
- orbit_sdk-1.0.0/tests/test_parity.py +111 -0
orbit_sdk-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: orbit-sdk
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Orbit SDK by JuriCloud: runtime DPDP Act compliance tracking for Python back ends. No personal data leaves the process.
|
|
5
|
+
Author: JuriCloud
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Classifier: Framework :: Django
|
|
8
|
+
Classifier: Framework :: FastAPI
|
|
9
|
+
Classifier: Framework :: Flask
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
12
|
+
Classifier: Topic :: Security
|
|
13
|
+
Classifier: Typing :: Typed
|
|
14
|
+
Requires-Python: >=3.9
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
|
|
17
|
+
# orbit-sdk — Orbit SDK by JuriCloud for Python
|
|
18
|
+
|
|
19
|
+
Runtime DPDP Act compliance tracking inside your Python back end: where personal data comes in, where it is stored,
|
|
20
|
+
where it goes, whether consent was checked, whether it leaks into logs; erasure and export requests run in your code.
|
|
21
|
+
**No personal data leaves your process.** Python ≥ 3.9, zero runtime dependencies.
|
|
22
|
+
|
|
23
|
+
## Quick start: one line
|
|
24
|
+
|
|
25
|
+
```sh
|
|
26
|
+
pip install orbit-sdk
|
|
27
|
+
export ORBIT_KEY=sk_live_… # without it the SDK stays off (one stderr line)
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
```python
|
|
31
|
+
import orbit.auto # first line of your entry module (before Django/Flask/FastAPI, HTTP clients, DB drivers)
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Or without touching code: `python -m orbit.run uvicorn app:app --workers 4` (also `gunicorn …`, `celery …`, `python manage.py runserver`).
|
|
35
|
+
|
|
36
|
+
Service name defaults to the project name in `pyproject.toml` / `setup.cfg` / `setup.py`, else the folder name
|
|
37
|
+
(`ORBIT_SERVICE` overrides). Also read from env: `ORBIT_ENVIRONMENT`, `ORBIT_ENDPOINT`, `ORBIT_DEBUG`,
|
|
38
|
+
`ORBIT_DISABLED`, `ORBIT_ENFORCEMENT`. `orbit.health()["auto"]` lists what was instrumented:
|
|
39
|
+
`{"mode": "import-hook", "detected": ["fastapi…", "requests@2.34.2", "psycopg@3.3.9"], "missed": [], "errors": []}`.
|
|
40
|
+
|
|
41
|
+
## Add erasure (recommended)
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
import orbit
|
|
45
|
+
|
|
46
|
+
@orbit.on_erase
|
|
47
|
+
def erase(req: orbit.RightsRequest) -> dict:
|
|
48
|
+
return {"erased": users.erase_everywhere(req.principal_ref)}
|
|
49
|
+
|
|
50
|
+
@orbit.on_export # also verifies deletions: {"records": 0} after an erasure = verified
|
|
51
|
+
def export(req: orbit.RightsRequest) -> dict:
|
|
52
|
+
return {"categories": ["contact", "health"], "records": users.count(req.principal_ref)}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Handlers may be `async def`. They run on an SDK thread (5-minute timeout) with a fresh event loop; if an async handler
|
|
56
|
+
needs your app's loop (an asyncpg / SQLAlchemy async pool), pass it: `orbit.on_erase(handler, loop=app_loop)`.
|
|
57
|
+
Only the summary goes back (`{erased}`, `{categories, records}`); handler errors are sent with emails/numbers redacted.
|
|
58
|
+
|
|
59
|
+
## Consent checks
|
|
60
|
+
|
|
61
|
+
```python
|
|
62
|
+
if orbit.consent.allowed(user.ref, "marketing"): # sync (Django, Flask)
|
|
63
|
+
requests.post("https://api.moengage.com/v1/customer", json=profile)
|
|
64
|
+
|
|
65
|
+
if await orbit.consent.allowed_async(user.ref, "marketing"): # async (FastAPI, Starlette)
|
|
66
|
+
...
|
|
67
|
+
|
|
68
|
+
orbit.consent.record(user.ref, [{"purpose": "marketing", "action": "granted"}], channel="web", notice_version=3)
|
|
69
|
+
await orbit.consent.record_async(...) # same, from async code
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
- `granted` / `essential` → `True`, anything else → `False`. Cached 60 s per principal (LRU 10,000).
|
|
73
|
+
- Waits at most **1.5 s**. Orbit unreachable and nothing cached → `False` for consent purposes, `True` for essential
|
|
74
|
+
ones (fail safe); a stale cached answer is preferred to failing. After a failure, lookups skip the network for 15 s.
|
|
75
|
+
- An outbound call made later in the same request lists the purpose in `consentChecked`. Outside web requests (jobs,
|
|
76
|
+
consumers) wrap each unit of work: `with orbit.consent.scope(): …`.
|
|
77
|
+
- `record()` raises `orbit.OrbitError` if Orbit did not store the choice; requests that call it are counted as
|
|
78
|
+
`consentRecorded` against consent-looking form fields (`marketing_opt_in`, `agree_terms`, `newsletter`, …).
|
|
79
|
+
- Use an opaque principal reference (user id), not an email.
|
|
80
|
+
|
|
81
|
+
## Supported libraries
|
|
82
|
+
|
|
83
|
+
| Library | Tested | How | Explicit fallback |
|
|
84
|
+
|---|---|---|---|
|
|
85
|
+
| FastAPI / Starlette | 0.165.0 / 1.10.0 | `Starlette.__call__` wrapped (every app, mounted sub-apps once) | `app.add_middleware(orbit.ASGIMiddleware)` or `app = orbit.ASGIMiddleware(app)` (any ASGI app) |
|
|
86
|
+
| Flask | 3.1.3 | `before_request` / `teardown_request` added to every `Flask(...)` | `orbit.instrument_flask(app)` |
|
|
87
|
+
| Django (sync + async views) | 5.2.19 | middleware chain wrapped in `BaseHandler.load_middleware` | `MIDDLEWARE = ["orbit.DjangoMiddleware", …]` (first entry) |
|
|
88
|
+
| Django ORM | 5.2.19 | `connection.execute_wrappers` on every connection | — |
|
|
89
|
+
| SQLAlchemy | 2.1.9 | `before_cursor_execute` event on all engines | — |
|
|
90
|
+
| psycopg 3 (sync + async) | 3.3.9 | `Cursor` / `AsyncCursor` / server cursors `execute`, `executemany` | — |
|
|
91
|
+
| psycopg2 | 2.9.13 | `psycopg2.connect` installs a `cursor_factory` subclass | — |
|
|
92
|
+
| asyncpg | 0.32.0 | `Connection.execute/executemany/fetch/fetchrow/fetchval` | — |
|
|
93
|
+
| requests | 2.34.2 | `Session.send` | — |
|
|
94
|
+
| httpx (sync + async) | 0.28.1 | `Client.send`, `AsyncClient.send` | — |
|
|
95
|
+
| urllib3 | 2.8.0 | `HTTPConnectionPool.urlopen` (botocore and others) | — |
|
|
96
|
+
| aiohttp client | 3.14.5 | `ClientSession._request` | — |
|
|
97
|
+
| urllib.request | stdlib | `OpenerDirector.open` | — |
|
|
98
|
+
| logging | stdlib | `Logger.handle` (every logger) | — |
|
|
99
|
+
|
|
100
|
+
Libraries are patched right after they are imported (a `sys.meta_path` hook) or at `init` if already imported. An ORM
|
|
101
|
+
and the driver below it count a query once.
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
Everything below is the reference. Protocol: [docs/SDK.md](../../docs/SDK.md) (v1 + v1.1 policies/verification +
|
|
106
|
+
v1.2 consent fields).
|
|
107
|
+
|
|
108
|
+
## Explicit setup (instead of `import orbit.auto`)
|
|
109
|
+
|
|
110
|
+
```python
|
|
111
|
+
import orbit
|
|
112
|
+
orbit.init(key=os.environ["ORBIT_KEY"], service="patient-api")
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
| Argument | Env | Default | |
|
|
116
|
+
|---|---|---|---|
|
|
117
|
+
| `key` | `ORBIT_KEY` | — | App secret key (`sk_live_…`). Without it (and without `dry_run`) the SDK stays off. |
|
|
118
|
+
| `service` | `ORBIT_SERVICE` | project name / folder | Name shown in Orbit. |
|
|
119
|
+
| `environment` | `ORBIT_ENVIRONMENT` | `production` | |
|
|
120
|
+
| `release` | `ORBIT_RELEASE` | — | Your version string (v1.2: "fixed in release X"). |
|
|
121
|
+
| `endpoint` | `ORBIT_ENDPOINT` | `https://apidpdp-orbit.juricloud.co` | HTTPS only (plain http only for localhost). |
|
|
122
|
+
| `first_party_hosts` | | `()` | Your own hosts (suffix match); calls to them are not recorded. Orbit adds your app URLs. |
|
|
123
|
+
| `debug` | `ORBIT_DEBUG=1` | off | Prints every batch (already value-free) and swallowed SDK errors to stderr. |
|
|
124
|
+
| `dry_run` | | off | Records and aggregates, sends nothing, runs no tasks. |
|
|
125
|
+
| `disabled` | `ORBIT_DISABLED=1` | off | Everything off (the env var wins over code). |
|
|
126
|
+
| `enforcement` | `ORBIT_ENFORCEMENT=off` | on | `False`: policies never block locally; they warn. |
|
|
127
|
+
| `instrument` | | `True` | `False`: no library patching (use the explicit middlewares; logging is still covered). |
|
|
128
|
+
|
|
129
|
+
## What is collected
|
|
130
|
+
|
|
131
|
+
| Where | Sent to Orbit |
|
|
132
|
+
|---|---|
|
|
133
|
+
| Outbound HTTP | host, method, path template, body/query field names, categories, kinds, count, purposes consent-checked |
|
|
134
|
+
| Inbound requests | method, route template (`/v1/patients/:id`), body/query field names, categories, kinds, count, consent-like field names and how many requests recorded consent |
|
|
135
|
+
| Databases | engine, table, operation, column names, categories, kinds, count |
|
|
136
|
+
| Logs | logger name, level, categories, kinds, call site (`app/payments.py:88`), count — only when personal data is found |
|
|
137
|
+
| Consent | per purpose: allowed / denied / unknown counts |
|
|
138
|
+
| Policies | policy id, action, host, count |
|
|
139
|
+
|
|
140
|
+
**Never collected or sent:** any value (bodies, query values, SQL text, parameters, log messages, headers, cookies, your
|
|
141
|
+
users' IPs), path segments that look like ids or personal data (`:id`), object keys that look like personal data (`*`).
|
|
142
|
+
The only opt-in exception is `consent.record(…, email=…)`. Inbound bodies are read only when JSON or urlencoded,
|
|
143
|
+
with a `Content-Length` ≤ 64 KB, and only what your view itself read (ASGI) or Django/Flask cached.
|
|
144
|
+
|
|
145
|
+
Classification uses the Orbit server's own rules (`packages/domain`, ported and checked by `tests/test_parity.py`):
|
|
146
|
+
validated Aadhaar (Verhoeff), PAN, passport, GSTIN, card (Luhn), IFSC, UPI, email, Indian mobile, IPv4, coordinates;
|
|
147
|
+
plus field-name categories.
|
|
148
|
+
|
|
149
|
+
## Policies (enforcement)
|
|
150
|
+
|
|
151
|
+
Evaluated on every intercepted outbound call **before it is sent**: `consent_required`,
|
|
152
|
+
`no_recipient_without_contract`, `no_category_to_host`, `no_restricted_country`. Modes: **monitor** (record only,
|
|
153
|
+
default), **warn** (record, call listeners, one stderr line per policy per minute), **approve** (blocks until an
|
|
154
|
+
approver allows the host in Orbit; picked up on the next config refresh, ≤ 5 min), **block**.
|
|
155
|
+
|
|
156
|
+
```python
|
|
157
|
+
@orbit.on_policy
|
|
158
|
+
def on_policy(e: orbit.PolicyEvent) -> None:
|
|
159
|
+
metrics.increment("orbit.policy", tags={"policy": e.policy, "action": e.action})
|
|
160
|
+
|
|
161
|
+
try:
|
|
162
|
+
requests.post(url, json=payload)
|
|
163
|
+
except orbit.OrbitPolicyError as err: # err.code == "ORBIT_BLOCKED", err.policy_id, err.rule, err.host
|
|
164
|
+
...
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
`OrbitPolicyError` is not a `requests`/`httpx` exception: catch it where you send to third parties. Safeguards:
|
|
168
|
+
`ORBIT_ENFORCEMENT=off` downgrades block/approve to warn locally; evaluation faults fail open; a block/approve policy
|
|
169
|
+
whose config could not be refreshed for over an hour (Orbit down) only warns.
|
|
170
|
+
|
|
171
|
+
## Failure modes
|
|
172
|
+
|
|
173
|
+
| Situation | Effect on your app |
|
|
174
|
+
|---|---|
|
|
175
|
+
| Orbit down / refusing connections | None. Batches retried 3× (429/5xx, backoff), then dropped and counted; consent → cache or fail safe. |
|
|
176
|
+
| Orbit hanging or very slow | None on requests: all traffic to Orbit is on SDK daemon threads; consent waits ≤ 1.5 s once, then fails fast for 15 s. |
|
|
177
|
+
| Orbit returns 4xx for a batch | Batch dropped (`health()["lastError"]`). A pre-v1.2 server rejecting `consentFields` is detected; they are stripped. |
|
|
178
|
+
| SDK bug in a hook | Swallowed and counted (`health()["sdkErrors"]`); your call proceeds. Never raised into your code. |
|
|
179
|
+
| Process exit | `atexit` flush, bounded to 2 s. Serverless: call `orbit.flush()` at the end of each invocation. |
|
|
180
|
+
| Fork (gunicorn `--preload`, multiprocessing) | The child gets fresh locks, an empty window and its own threads. |
|
|
181
|
+
| Kill switch (Orbit → service → Disable) | On the next config fetch (≤ 5 min) recording stops and buffered data is dropped. `ORBIT_DISABLED=1` locally. |
|
|
182
|
+
| Memory | ≤ 2,000 aggregate keys per window (new keys beyond are dropped and counted), consent cache ≤ 10,000 principals. |
|
|
183
|
+
|
|
184
|
+
`orbit.health()` → `{enabled, queued, lastFlushAt, lastError, dropped, sdkErrors, auto}`.
|
|
185
|
+
`orbit.flush(timeout=5)` sends now; `orbit.close(timeout=2)` flushes and stops the threads.
|
|
186
|
+
|
|
187
|
+
## Performance
|
|
188
|
+
|
|
189
|
+
`.venv/bin/python scripts/bench_overhead.py` — 5,000 sequential calls per run, fresh process per run, median of 3,
|
|
190
|
+
without and with the SDK (dry run: classifies and aggregates exactly as in production). Python 3.13, Apple M-series:
|
|
191
|
+
|
|
192
|
+
```
|
|
193
|
+
outbound without SDK with SDK overhead requests POST, JSON body with personal data, keep-alive, local server
|
|
194
|
+
p50 0.454 ms 0.513 ms +59.0 µs
|
|
195
|
+
p95 0.603 ms 0.650 ms +47.1 µs
|
|
196
|
+
p99 0.713 ms 0.740 ms +27.3 µs
|
|
197
|
+
|
|
198
|
+
logging without SDK with SDK overhead logger.info with a personal-data argument (NullHandler)
|
|
199
|
+
p50 0.003 ms 0.045 ms +42.0 µs
|
|
200
|
+
p95 0.003 ms 0.053 ms +50.4 µs
|
|
201
|
+
|
|
202
|
+
sql without SDK with SDK overhead psycopg INSERT with personal-data parameters, local Postgres
|
|
203
|
+
p50 0.046 ms 0.053 ms +7.5 µs
|
|
204
|
+
p95 0.066 ms 0.074 ms +8.5 µs
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
The cost is fixed per call (~30–60 µs, mostly classifying the body fields). Against a real third-party API (20–300 ms)
|
|
208
|
+
it is 0.02–0.3 %, inside the < 2 % p95 budget. Log calls that are below the logger's level cost nothing; very chatty
|
|
209
|
+
INFO logging pays ~45 µs per call (Orbit can lower `sampleRate` per service).
|
|
210
|
+
|
|
211
|
+
## Security review checklist (for your security team)
|
|
212
|
+
|
|
213
|
+
- [ ] **Data minimisation:** read `src/orbit/_classify.py` — only names, categories and kinds leave `flatten` /
|
|
214
|
+
`template_path`; keys that look like personal data become `*`. `tests/test_novalues.py` feeds Aadhaar, PAN,
|
|
215
|
+
card, email, phone, IFSC, UPI, passport and GSTIN through every hook (outbound, inbound, SQL, logs, consent,
|
|
216
|
+
task errors) and asserts no ≥ 6-character substring of any value reaches a batch or the debug output.
|
|
217
|
+
- [ ] **Verify what is sent:** run with `ORBIT_DEBUG=1` in staging and read the batches.
|
|
218
|
+
- [ ] **Network:** the SDK talks only to `endpoint` with your secret key: `GET /sdk/v1/config`, `POST /sdk/v1/batch`,
|
|
219
|
+
`GET /sdk/v1/consent/:ref`, `GET|POST /sdk/v1/tasks`, `POST /c/v1/server/consents`. Egress can be pinned to that host.
|
|
220
|
+
- [ ] **Transport:** stdlib `http.client`; HTTPS required (http only for localhost); TLS verification and hostname
|
|
221
|
+
checks always on (own `ssl.create_default_context()`, unaffected by app settings); redirects never followed;
|
|
222
|
+
responses capped at 1 MB; gzip above 8 KB.
|
|
223
|
+
- [ ] **Secret handling:** the key is read from the argument/env and only sent in the `Authorization` header to
|
|
224
|
+
`endpoint`; it is never logged (the debug output prints batches, not headers).
|
|
225
|
+
- [ ] **No code loading / eval;** zero runtime dependencies (`pyproject.toml`); pure Python, readable source.
|
|
226
|
+
- [ ] **Failure isolation:** every hook is wrapped; SDK errors are counted, never raised into your code. Only
|
|
227
|
+
`OrbitPolicyError` (a policy you configured to block) and `OrbitError` from `consent.record` are raised on purpose.
|
|
228
|
+
- [ ] **Blocking is opt-in on the server** (default mode monitor) and can be turned off locally (`ORBIT_ENFORCEMENT=off`).
|
|
229
|
+
- [ ] **Rights tasks** run code *you* register; only summaries are returned; errors are redacted.
|
|
230
|
+
- [ ] **Kill switches:** server-side per service, `ORBIT_DISABLED=1` locally.
|
|
231
|
+
- [ ] **What is patched** (the table above) and nothing else; `sys.meta_path` gets one finder that only observes
|
|
232
|
+
imports of those modules (an import never fails or changes because of it).
|
|
233
|
+
|
|
234
|
+
## Limits
|
|
235
|
+
|
|
236
|
+
- Bodies: JSON or urlencoded only (no multipart, streamed/chunked bodies, generators, files), up to 64 KB. Inbound
|
|
237
|
+
ASGI bodies are seen only if your view reads them. Log arguments up to 8 KB, containers two levels deep, objects
|
|
238
|
+
other than str/numbers/dict/list/exceptions are not inspected (no `__str__` is called).
|
|
239
|
+
- Values are recognised only in validated shapes (e.g. an Aadhaar with a valid checksum); names cover the rest.
|
|
240
|
+
- psycopg2: cursors created with a per-call `cursor_factory=` (e.g. `RealDictCursor` passed to `conn.cursor()`) are not
|
|
241
|
+
instrumented; a factory set on the connection is.
|
|
242
|
+
- SQLAlchemy async over asyncpg may count a statement twice (greenlet context); sync engines count once.
|
|
243
|
+
- Starlette routes: plain Starlette apps get the route template by matching the app's top-level routes; routes inside
|
|
244
|
+
`Mount` fall back to a URL-derived template. FastAPI is exact.
|
|
245
|
+
- Start Orbit first (`import orbit.auto` at the top of `wsgi.py` / `asgi.py` / `manage.py` / `main.py`, or
|
|
246
|
+
`python -m orbit.run`). FastAPI/Starlette apps and SQLAlchemy engines created earlier are still covered (class-level
|
|
247
|
+
patches); a Flask app created earlier needs `orbit.instrument_flask(app)`, a Django handler built earlier needs the
|
|
248
|
+
`MIDDLEWARE` entry, and DB connections opened earlier are not instrumented.
|
|
249
|
+
- Consent context: in plain threads (no web request), a check stays attached to the thread until
|
|
250
|
+
`orbit.consent.scope()` is used.
|
|
251
|
+
- Not instrumented: `http.client` used directly, `pycurl`, gRPC, Celery task payloads, `print()`, loguru (bridge it to
|
|
252
|
+
logging), MySQL/SQLite drivers used without SQLAlchemy/Django.
|
|
253
|
+
- Free-threaded (no-GIL) CPython is untested.
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
# orbit-sdk — Orbit SDK by JuriCloud for Python
|
|
2
|
+
|
|
3
|
+
Runtime DPDP Act compliance tracking inside your Python back end: where personal data comes in, where it is stored,
|
|
4
|
+
where it goes, whether consent was checked, whether it leaks into logs; erasure and export requests run in your code.
|
|
5
|
+
**No personal data leaves your process.** Python ≥ 3.9, zero runtime dependencies.
|
|
6
|
+
|
|
7
|
+
## Quick start: one line
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
pip install orbit-sdk
|
|
11
|
+
export ORBIT_KEY=sk_live_… # without it the SDK stays off (one stderr line)
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
```python
|
|
15
|
+
import orbit.auto # first line of your entry module (before Django/Flask/FastAPI, HTTP clients, DB drivers)
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Or without touching code: `python -m orbit.run uvicorn app:app --workers 4` (also `gunicorn …`, `celery …`, `python manage.py runserver`).
|
|
19
|
+
|
|
20
|
+
Service name defaults to the project name in `pyproject.toml` / `setup.cfg` / `setup.py`, else the folder name
|
|
21
|
+
(`ORBIT_SERVICE` overrides). Also read from env: `ORBIT_ENVIRONMENT`, `ORBIT_ENDPOINT`, `ORBIT_DEBUG`,
|
|
22
|
+
`ORBIT_DISABLED`, `ORBIT_ENFORCEMENT`. `orbit.health()["auto"]` lists what was instrumented:
|
|
23
|
+
`{"mode": "import-hook", "detected": ["fastapi…", "requests@2.34.2", "psycopg@3.3.9"], "missed": [], "errors": []}`.
|
|
24
|
+
|
|
25
|
+
## Add erasure (recommended)
|
|
26
|
+
|
|
27
|
+
```python
|
|
28
|
+
import orbit
|
|
29
|
+
|
|
30
|
+
@orbit.on_erase
|
|
31
|
+
def erase(req: orbit.RightsRequest) -> dict:
|
|
32
|
+
return {"erased": users.erase_everywhere(req.principal_ref)}
|
|
33
|
+
|
|
34
|
+
@orbit.on_export # also verifies deletions: {"records": 0} after an erasure = verified
|
|
35
|
+
def export(req: orbit.RightsRequest) -> dict:
|
|
36
|
+
return {"categories": ["contact", "health"], "records": users.count(req.principal_ref)}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Handlers may be `async def`. They run on an SDK thread (5-minute timeout) with a fresh event loop; if an async handler
|
|
40
|
+
needs your app's loop (an asyncpg / SQLAlchemy async pool), pass it: `orbit.on_erase(handler, loop=app_loop)`.
|
|
41
|
+
Only the summary goes back (`{erased}`, `{categories, records}`); handler errors are sent with emails/numbers redacted.
|
|
42
|
+
|
|
43
|
+
## Consent checks
|
|
44
|
+
|
|
45
|
+
```python
|
|
46
|
+
if orbit.consent.allowed(user.ref, "marketing"): # sync (Django, Flask)
|
|
47
|
+
requests.post("https://api.moengage.com/v1/customer", json=profile)
|
|
48
|
+
|
|
49
|
+
if await orbit.consent.allowed_async(user.ref, "marketing"): # async (FastAPI, Starlette)
|
|
50
|
+
...
|
|
51
|
+
|
|
52
|
+
orbit.consent.record(user.ref, [{"purpose": "marketing", "action": "granted"}], channel="web", notice_version=3)
|
|
53
|
+
await orbit.consent.record_async(...) # same, from async code
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
- `granted` / `essential` → `True`, anything else → `False`. Cached 60 s per principal (LRU 10,000).
|
|
57
|
+
- Waits at most **1.5 s**. Orbit unreachable and nothing cached → `False` for consent purposes, `True` for essential
|
|
58
|
+
ones (fail safe); a stale cached answer is preferred to failing. After a failure, lookups skip the network for 15 s.
|
|
59
|
+
- An outbound call made later in the same request lists the purpose in `consentChecked`. Outside web requests (jobs,
|
|
60
|
+
consumers) wrap each unit of work: `with orbit.consent.scope(): …`.
|
|
61
|
+
- `record()` raises `orbit.OrbitError` if Orbit did not store the choice; requests that call it are counted as
|
|
62
|
+
`consentRecorded` against consent-looking form fields (`marketing_opt_in`, `agree_terms`, `newsletter`, …).
|
|
63
|
+
- Use an opaque principal reference (user id), not an email.
|
|
64
|
+
|
|
65
|
+
## Supported libraries
|
|
66
|
+
|
|
67
|
+
| Library | Tested | How | Explicit fallback |
|
|
68
|
+
|---|---|---|---|
|
|
69
|
+
| FastAPI / Starlette | 0.165.0 / 1.10.0 | `Starlette.__call__` wrapped (every app, mounted sub-apps once) | `app.add_middleware(orbit.ASGIMiddleware)` or `app = orbit.ASGIMiddleware(app)` (any ASGI app) |
|
|
70
|
+
| Flask | 3.1.3 | `before_request` / `teardown_request` added to every `Flask(...)` | `orbit.instrument_flask(app)` |
|
|
71
|
+
| Django (sync + async views) | 5.2.19 | middleware chain wrapped in `BaseHandler.load_middleware` | `MIDDLEWARE = ["orbit.DjangoMiddleware", …]` (first entry) |
|
|
72
|
+
| Django ORM | 5.2.19 | `connection.execute_wrappers` on every connection | — |
|
|
73
|
+
| SQLAlchemy | 2.1.9 | `before_cursor_execute` event on all engines | — |
|
|
74
|
+
| psycopg 3 (sync + async) | 3.3.9 | `Cursor` / `AsyncCursor` / server cursors `execute`, `executemany` | — |
|
|
75
|
+
| psycopg2 | 2.9.13 | `psycopg2.connect` installs a `cursor_factory` subclass | — |
|
|
76
|
+
| asyncpg | 0.32.0 | `Connection.execute/executemany/fetch/fetchrow/fetchval` | — |
|
|
77
|
+
| requests | 2.34.2 | `Session.send` | — |
|
|
78
|
+
| httpx (sync + async) | 0.28.1 | `Client.send`, `AsyncClient.send` | — |
|
|
79
|
+
| urllib3 | 2.8.0 | `HTTPConnectionPool.urlopen` (botocore and others) | — |
|
|
80
|
+
| aiohttp client | 3.14.5 | `ClientSession._request` | — |
|
|
81
|
+
| urllib.request | stdlib | `OpenerDirector.open` | — |
|
|
82
|
+
| logging | stdlib | `Logger.handle` (every logger) | — |
|
|
83
|
+
|
|
84
|
+
Libraries are patched right after they are imported (a `sys.meta_path` hook) or at `init` if already imported. An ORM
|
|
85
|
+
and the driver below it count a query once.
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
Everything below is the reference. Protocol: [docs/SDK.md](../../docs/SDK.md) (v1 + v1.1 policies/verification +
|
|
90
|
+
v1.2 consent fields).
|
|
91
|
+
|
|
92
|
+
## Explicit setup (instead of `import orbit.auto`)
|
|
93
|
+
|
|
94
|
+
```python
|
|
95
|
+
import orbit
|
|
96
|
+
orbit.init(key=os.environ["ORBIT_KEY"], service="patient-api")
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
| Argument | Env | Default | |
|
|
100
|
+
|---|---|---|---|
|
|
101
|
+
| `key` | `ORBIT_KEY` | — | App secret key (`sk_live_…`). Without it (and without `dry_run`) the SDK stays off. |
|
|
102
|
+
| `service` | `ORBIT_SERVICE` | project name / folder | Name shown in Orbit. |
|
|
103
|
+
| `environment` | `ORBIT_ENVIRONMENT` | `production` | |
|
|
104
|
+
| `release` | `ORBIT_RELEASE` | — | Your version string (v1.2: "fixed in release X"). |
|
|
105
|
+
| `endpoint` | `ORBIT_ENDPOINT` | `https://apidpdp-orbit.juricloud.co` | HTTPS only (plain http only for localhost). |
|
|
106
|
+
| `first_party_hosts` | | `()` | Your own hosts (suffix match); calls to them are not recorded. Orbit adds your app URLs. |
|
|
107
|
+
| `debug` | `ORBIT_DEBUG=1` | off | Prints every batch (already value-free) and swallowed SDK errors to stderr. |
|
|
108
|
+
| `dry_run` | | off | Records and aggregates, sends nothing, runs no tasks. |
|
|
109
|
+
| `disabled` | `ORBIT_DISABLED=1` | off | Everything off (the env var wins over code). |
|
|
110
|
+
| `enforcement` | `ORBIT_ENFORCEMENT=off` | on | `False`: policies never block locally; they warn. |
|
|
111
|
+
| `instrument` | | `True` | `False`: no library patching (use the explicit middlewares; logging is still covered). |
|
|
112
|
+
|
|
113
|
+
## What is collected
|
|
114
|
+
|
|
115
|
+
| Where | Sent to Orbit |
|
|
116
|
+
|---|---|
|
|
117
|
+
| Outbound HTTP | host, method, path template, body/query field names, categories, kinds, count, purposes consent-checked |
|
|
118
|
+
| Inbound requests | method, route template (`/v1/patients/:id`), body/query field names, categories, kinds, count, consent-like field names and how many requests recorded consent |
|
|
119
|
+
| Databases | engine, table, operation, column names, categories, kinds, count |
|
|
120
|
+
| Logs | logger name, level, categories, kinds, call site (`app/payments.py:88`), count — only when personal data is found |
|
|
121
|
+
| Consent | per purpose: allowed / denied / unknown counts |
|
|
122
|
+
| Policies | policy id, action, host, count |
|
|
123
|
+
|
|
124
|
+
**Never collected or sent:** any value (bodies, query values, SQL text, parameters, log messages, headers, cookies, your
|
|
125
|
+
users' IPs), path segments that look like ids or personal data (`:id`), object keys that look like personal data (`*`).
|
|
126
|
+
The only opt-in exception is `consent.record(…, email=…)`. Inbound bodies are read only when JSON or urlencoded,
|
|
127
|
+
with a `Content-Length` ≤ 64 KB, and only what your view itself read (ASGI) or Django/Flask cached.
|
|
128
|
+
|
|
129
|
+
Classification uses the Orbit server's own rules (`packages/domain`, ported and checked by `tests/test_parity.py`):
|
|
130
|
+
validated Aadhaar (Verhoeff), PAN, passport, GSTIN, card (Luhn), IFSC, UPI, email, Indian mobile, IPv4, coordinates;
|
|
131
|
+
plus field-name categories.
|
|
132
|
+
|
|
133
|
+
## Policies (enforcement)
|
|
134
|
+
|
|
135
|
+
Evaluated on every intercepted outbound call **before it is sent**: `consent_required`,
|
|
136
|
+
`no_recipient_without_contract`, `no_category_to_host`, `no_restricted_country`. Modes: **monitor** (record only,
|
|
137
|
+
default), **warn** (record, call listeners, one stderr line per policy per minute), **approve** (blocks until an
|
|
138
|
+
approver allows the host in Orbit; picked up on the next config refresh, ≤ 5 min), **block**.
|
|
139
|
+
|
|
140
|
+
```python
|
|
141
|
+
@orbit.on_policy
|
|
142
|
+
def on_policy(e: orbit.PolicyEvent) -> None:
|
|
143
|
+
metrics.increment("orbit.policy", tags={"policy": e.policy, "action": e.action})
|
|
144
|
+
|
|
145
|
+
try:
|
|
146
|
+
requests.post(url, json=payload)
|
|
147
|
+
except orbit.OrbitPolicyError as err: # err.code == "ORBIT_BLOCKED", err.policy_id, err.rule, err.host
|
|
148
|
+
...
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
`OrbitPolicyError` is not a `requests`/`httpx` exception: catch it where you send to third parties. Safeguards:
|
|
152
|
+
`ORBIT_ENFORCEMENT=off` downgrades block/approve to warn locally; evaluation faults fail open; a block/approve policy
|
|
153
|
+
whose config could not be refreshed for over an hour (Orbit down) only warns.
|
|
154
|
+
|
|
155
|
+
## Failure modes
|
|
156
|
+
|
|
157
|
+
| Situation | Effect on your app |
|
|
158
|
+
|---|---|
|
|
159
|
+
| Orbit down / refusing connections | None. Batches retried 3× (429/5xx, backoff), then dropped and counted; consent → cache or fail safe. |
|
|
160
|
+
| Orbit hanging or very slow | None on requests: all traffic to Orbit is on SDK daemon threads; consent waits ≤ 1.5 s once, then fails fast for 15 s. |
|
|
161
|
+
| Orbit returns 4xx for a batch | Batch dropped (`health()["lastError"]`). A pre-v1.2 server rejecting `consentFields` is detected; they are stripped. |
|
|
162
|
+
| SDK bug in a hook | Swallowed and counted (`health()["sdkErrors"]`); your call proceeds. Never raised into your code. |
|
|
163
|
+
| Process exit | `atexit` flush, bounded to 2 s. Serverless: call `orbit.flush()` at the end of each invocation. |
|
|
164
|
+
| Fork (gunicorn `--preload`, multiprocessing) | The child gets fresh locks, an empty window and its own threads. |
|
|
165
|
+
| Kill switch (Orbit → service → Disable) | On the next config fetch (≤ 5 min) recording stops and buffered data is dropped. `ORBIT_DISABLED=1` locally. |
|
|
166
|
+
| Memory | ≤ 2,000 aggregate keys per window (new keys beyond are dropped and counted), consent cache ≤ 10,000 principals. |
|
|
167
|
+
|
|
168
|
+
`orbit.health()` → `{enabled, queued, lastFlushAt, lastError, dropped, sdkErrors, auto}`.
|
|
169
|
+
`orbit.flush(timeout=5)` sends now; `orbit.close(timeout=2)` flushes and stops the threads.
|
|
170
|
+
|
|
171
|
+
## Performance
|
|
172
|
+
|
|
173
|
+
`.venv/bin/python scripts/bench_overhead.py` — 5,000 sequential calls per run, fresh process per run, median of 3,
|
|
174
|
+
without and with the SDK (dry run: classifies and aggregates exactly as in production). Python 3.13, Apple M-series:
|
|
175
|
+
|
|
176
|
+
```
|
|
177
|
+
outbound without SDK with SDK overhead requests POST, JSON body with personal data, keep-alive, local server
|
|
178
|
+
p50 0.454 ms 0.513 ms +59.0 µs
|
|
179
|
+
p95 0.603 ms 0.650 ms +47.1 µs
|
|
180
|
+
p99 0.713 ms 0.740 ms +27.3 µs
|
|
181
|
+
|
|
182
|
+
logging without SDK with SDK overhead logger.info with a personal-data argument (NullHandler)
|
|
183
|
+
p50 0.003 ms 0.045 ms +42.0 µs
|
|
184
|
+
p95 0.003 ms 0.053 ms +50.4 µs
|
|
185
|
+
|
|
186
|
+
sql without SDK with SDK overhead psycopg INSERT with personal-data parameters, local Postgres
|
|
187
|
+
p50 0.046 ms 0.053 ms +7.5 µs
|
|
188
|
+
p95 0.066 ms 0.074 ms +8.5 µs
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
The cost is fixed per call (~30–60 µs, mostly classifying the body fields). Against a real third-party API (20–300 ms)
|
|
192
|
+
it is 0.02–0.3 %, inside the < 2 % p95 budget. Log calls that are below the logger's level cost nothing; very chatty
|
|
193
|
+
INFO logging pays ~45 µs per call (Orbit can lower `sampleRate` per service).
|
|
194
|
+
|
|
195
|
+
## Security review checklist (for your security team)
|
|
196
|
+
|
|
197
|
+
- [ ] **Data minimisation:** read `src/orbit/_classify.py` — only names, categories and kinds leave `flatten` /
|
|
198
|
+
`template_path`; keys that look like personal data become `*`. `tests/test_novalues.py` feeds Aadhaar, PAN,
|
|
199
|
+
card, email, phone, IFSC, UPI, passport and GSTIN through every hook (outbound, inbound, SQL, logs, consent,
|
|
200
|
+
task errors) and asserts no ≥ 6-character substring of any value reaches a batch or the debug output.
|
|
201
|
+
- [ ] **Verify what is sent:** run with `ORBIT_DEBUG=1` in staging and read the batches.
|
|
202
|
+
- [ ] **Network:** the SDK talks only to `endpoint` with your secret key: `GET /sdk/v1/config`, `POST /sdk/v1/batch`,
|
|
203
|
+
`GET /sdk/v1/consent/:ref`, `GET|POST /sdk/v1/tasks`, `POST /c/v1/server/consents`. Egress can be pinned to that host.
|
|
204
|
+
- [ ] **Transport:** stdlib `http.client`; HTTPS required (http only for localhost); TLS verification and hostname
|
|
205
|
+
checks always on (own `ssl.create_default_context()`, unaffected by app settings); redirects never followed;
|
|
206
|
+
responses capped at 1 MB; gzip above 8 KB.
|
|
207
|
+
- [ ] **Secret handling:** the key is read from the argument/env and only sent in the `Authorization` header to
|
|
208
|
+
`endpoint`; it is never logged (the debug output prints batches, not headers).
|
|
209
|
+
- [ ] **No code loading / eval;** zero runtime dependencies (`pyproject.toml`); pure Python, readable source.
|
|
210
|
+
- [ ] **Failure isolation:** every hook is wrapped; SDK errors are counted, never raised into your code. Only
|
|
211
|
+
`OrbitPolicyError` (a policy you configured to block) and `OrbitError` from `consent.record` are raised on purpose.
|
|
212
|
+
- [ ] **Blocking is opt-in on the server** (default mode monitor) and can be turned off locally (`ORBIT_ENFORCEMENT=off`).
|
|
213
|
+
- [ ] **Rights tasks** run code *you* register; only summaries are returned; errors are redacted.
|
|
214
|
+
- [ ] **Kill switches:** server-side per service, `ORBIT_DISABLED=1` locally.
|
|
215
|
+
- [ ] **What is patched** (the table above) and nothing else; `sys.meta_path` gets one finder that only observes
|
|
216
|
+
imports of those modules (an import never fails or changes because of it).
|
|
217
|
+
|
|
218
|
+
## Limits
|
|
219
|
+
|
|
220
|
+
- Bodies: JSON or urlencoded only (no multipart, streamed/chunked bodies, generators, files), up to 64 KB. Inbound
|
|
221
|
+
ASGI bodies are seen only if your view reads them. Log arguments up to 8 KB, containers two levels deep, objects
|
|
222
|
+
other than str/numbers/dict/list/exceptions are not inspected (no `__str__` is called).
|
|
223
|
+
- Values are recognised only in validated shapes (e.g. an Aadhaar with a valid checksum); names cover the rest.
|
|
224
|
+
- psycopg2: cursors created with a per-call `cursor_factory=` (e.g. `RealDictCursor` passed to `conn.cursor()`) are not
|
|
225
|
+
instrumented; a factory set on the connection is.
|
|
226
|
+
- SQLAlchemy async over asyncpg may count a statement twice (greenlet context); sync engines count once.
|
|
227
|
+
- Starlette routes: plain Starlette apps get the route template by matching the app's top-level routes; routes inside
|
|
228
|
+
`Mount` fall back to a URL-derived template. FastAPI is exact.
|
|
229
|
+
- Start Orbit first (`import orbit.auto` at the top of `wsgi.py` / `asgi.py` / `manage.py` / `main.py`, or
|
|
230
|
+
`python -m orbit.run`). FastAPI/Starlette apps and SQLAlchemy engines created earlier are still covered (class-level
|
|
231
|
+
patches); a Flask app created earlier needs `orbit.instrument_flask(app)`, a Django handler built earlier needs the
|
|
232
|
+
`MIDDLEWARE` entry, and DB connections opened earlier are not instrumented.
|
|
233
|
+
- Consent context: in plain threads (no web request), a check stays attached to the thread until
|
|
234
|
+
`orbit.consent.scope()` is used.
|
|
235
|
+
- Not instrumented: `http.client` used directly, `pycurl`, gRPC, Celery task payloads, `print()`, loguru (bridge it to
|
|
236
|
+
logging), MySQL/SQLite drivers used without SQLAlchemy/Django.
|
|
237
|
+
- Free-threaded (no-GIL) CPython is untested.
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling>=1.21"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "orbit-sdk"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
description = "Orbit SDK by JuriCloud: runtime DPDP Act compliance tracking for Python back ends. No personal data leaves the process."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
license = { text = "Apache-2.0" }
|
|
12
|
+
authors = [{ name = "JuriCloud" }]
|
|
13
|
+
dependencies = []
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Programming Language :: Python :: 3",
|
|
16
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
17
|
+
"Typing :: Typed",
|
|
18
|
+
"Framework :: Django",
|
|
19
|
+
"Framework :: FastAPI",
|
|
20
|
+
"Framework :: Flask",
|
|
21
|
+
"Topic :: Security",
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
[tool.hatch.version]
|
|
25
|
+
path = "src/orbit/_core.py"
|
|
26
|
+
pattern = 'VERSION = "(?P<version>[^"]+)"'
|
|
27
|
+
|
|
28
|
+
[tool.hatch.build.targets.wheel]
|
|
29
|
+
packages = ["src/orbit"]
|
|
30
|
+
|
|
31
|
+
[tool.pytest.ini_options]
|
|
32
|
+
testpaths = ["tests"]
|
|
33
|
+
asyncio_mode = "auto"
|
|
34
|
+
asyncio_default_fixture_loop_scope = "function"
|
|
35
|
+
addopts = "-p no:cacheprovider"
|
|
36
|
+
|
|
37
|
+
[tool.ruff]
|
|
38
|
+
line-length = 160
|
|
39
|
+
target-version = "py39"
|
|
40
|
+
src = ["src", "tests"]
|
|
41
|
+
|
|
42
|
+
[tool.ruff.lint]
|
|
43
|
+
select = ["E", "F", "W", "I", "B", "UP", "S", "BLE", "RUF"]
|
|
44
|
+
ignore = [
|
|
45
|
+
"S311", # random is used for sampling and retry jitter, not secrets
|
|
46
|
+
"BLE001", # blind except is the design: an SDK fault must never reach customer code
|
|
47
|
+
"S110", # try/except/pass in fault paths
|
|
48
|
+
"S112",
|
|
49
|
+
"UP007", # Optional[...] reads clearer and works at runtime on 3.9
|
|
50
|
+
"UP045",
|
|
51
|
+
"RUF001",
|
|
52
|
+
"RUF002",
|
|
53
|
+
"RUF003",
|
|
54
|
+
]
|
|
55
|
+
|
|
56
|
+
[tool.ruff.lint.per-file-ignores]
|
|
57
|
+
"tests/**" = ["S101", "S105", "S106", "S108", "S311", "S603", "S607", "B011", "E501"]
|
|
58
|
+
"scripts/**" = ["S101", "S311", "S603", "S607", "E501"]
|
|
59
|
+
"src/orbit/_pii.py" = ["E501"]
|
|
60
|
+
"src/orbit/_trackers.py" = ["E501"]
|
|
61
|
+
|
|
62
|
+
[tool.mypy]
|
|
63
|
+
strict = true
|
|
64
|
+
python_version = "3.10" # oldest mypy can target; the code itself avoids 3.10+ syntax (checked by tests on 3.9)
|
|
65
|
+
files = ["src/orbit"]
|
|
66
|
+
warn_unused_ignores = true
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Test/dev dependencies (exact pins). The SDK itself has zero runtime dependencies.
|
|
2
|
+
# uv venv .venv && uv pip install -p .venv/bin/python -r requirements-test.txt -e .
|
|
3
|
+
fastapi==0.165.0
|
|
4
|
+
starlette==1.10.0
|
|
5
|
+
httpx==0.28.1
|
|
6
|
+
requests==2.34.2
|
|
7
|
+
urllib3==2.8.0
|
|
8
|
+
aiohttp==3.14.5
|
|
9
|
+
flask==3.1.3
|
|
10
|
+
django==5.2.19 # 5.2 LTS: Django 6 needs PostgreSQL 15+, the test machine runs 14
|
|
11
|
+
sqlalchemy==2.1.9
|
|
12
|
+
psycopg==3.3.9
|
|
13
|
+
psycopg-binary==3.3.9
|
|
14
|
+
psycopg2-binary==2.9.13
|
|
15
|
+
asyncpg==0.32.0
|
|
16
|
+
pytest==9.2.0
|
|
17
|
+
pytest-asyncio==1.5.0
|
|
18
|
+
ruff==0.17.6
|
|
19
|
+
mypy==2.4.1
|