Unified Demystify deployment profiles (Python mirror): typed profile models, the three canonical profiles as data, env-overlay loader, and the canonical tenancy migration profile pair.
Project description
platform-profiles — unified deployment profiles
@demystify/platform-profiles (TS) · demystify-platform-profiles (Py) · v0.2.0 · MIT
What it is / when to use it
One typed source for the cloud / onprem / demo deployment shapes that all six modules used to duplicate (DB driver + tenancy, Redis, provider aliases, residency, feature flags). Modules load a profile instead of re-deriving config from scattered env vars, and copy the canonical tenancy migration SQL from here instead of shipping their own. Leaf package (dep: zod / pydantic only). Keyless, offline, deterministic.
The Profile shape
type Profile = {
name: "cloud" | "onprem" | "demo";
db: { driver: "pglite"|"postgres"|"supabase"; tenancyProfile: "vanilla"|"supabase"; urlEnv: string; poolMax: number };
redis: { enabled: boolean; driver: "memory"|"redis"; urlEnv: string };
providers: { mode: "mock"|"gateway"|"direct"; aliases: Record<string, string> }; // alias -> "provider:model"
residency: "standard" | "strict";
features: Record<string, boolean>;
};
| profile | db | redis | providers | residency | offline |
|---|---|---|---|---|---|
| cloud | postgres · supabase tenancy · pool 20 | redis | gateway · openai/anthropic/deepgram/elevenlabs | standard | no |
| onprem | postgres · vanilla tenancy · pool 10 | redis | gateway · all local:* models |
strict | no |
| demo | pglite · vanilla tenancy · pool 1 | memory (disabled) | mock · all mock:* |
standard | yes |
SDK usage
import { loadProfile, tenancySqlFor } from "@demystify/platform-profiles";
const profile = loadProfile("onprem", process.env); // env overlays defaults
const sqlFile = tenancySqlFor(profile); // "profiles/vanilla.sql"
from demystify_platform_profiles import load_profile, tenancy_sql_for
import os
profile = load_profile("onprem", os.environ)
sql_file = tenancy_sql_for(profile) # "profiles/vanilla.sql"
Env overlay (precedence: explicit env > profile default)
| env var | overlays |
|---|---|
DMSTFY_RESIDENCY |
residency (standard|strict) |
DMSTFY_DB_DRIVER |
db.driver |
DMSTFY_DB_POOL_MAX |
db.poolMax (int > 0) |
DMSTFY_PROVIDERS_MODE |
providers.mode |
DMSTFY_REDIS_ENABLED |
redis.enabled; else REDIS_URL present ⇒ enabled + driver=redis |
DMSTFY_FEATURE_INTROSPECTION_CACHE |
features.introspectionCache |
DMSTFY_FEATURE_SPAN_EXPORTER |
features.spanExporter |
DMSTFY_FEATURE_DASHBOARD |
features.dashboardEnabled |
DMSTFY_FEATURE_OFFLINE |
features.offline |
After overlay, strict residency strips every cloud-only provider alias
(openai, anthropic, deepgram, elevenlabs, cartesia, google) so a strict deployment
physically cannot egress to a cloud provider.
Per-module env mapping (what each profile field sets)
Each module maps profile fields onto its existing env vars at boot (module-side glue, not done here):
| Profile field | module env it sets |
|---|---|
db.urlEnv (+ driver) |
DATABASE_URL (pglite path in demo) |
db.tenancyProfile |
migration --profile (vanilla|supabase) |
redis.enabled/urlEnv |
REDIS_URL / DMSTFY_<MODULE>_<SEAM>_DRIVER=redis|memory |
providers.mode |
DMSTFY_AUTH_MODE + gateway data-plane driver (mock|gateway) |
providers.aliases |
model-alias → concrete resolution the gateway/router uses |
residency |
disables cloud-only providers; toggles egress allowlists |
features.* |
INTROSPECTION_CACHE_*, span-exporter wiring, dashboard mount |
Migrations & platform profiles (canonical tenancy SQL)
This package ships the single canonical pair (CONVENTIONS.md §3):
profiles/supabase.sql (defines app.current_tenant_id() via auth.jwt()) and
profiles/vanilla.sql (via current_setting('app.tenant_id')). A profile binds to
one via db.tenancyProfile; tenancySqlFor(profile) returns the file path. Modules
copy/symlink these instead of duplicating them; keep the pair in sync when either
changes. auth.jwt( lives only in supabase.sql — the §7 boundary grep is satisfied.
Testing
make -C packages/platform-profiles setup lint test build. Unit only (offline).
Parity: TS and Py serialize PROFILES and must equal fixtures/profiles.json, and
both replay fixtures/overlay-cases.json through the loader identically.
v1 scope
Three profiles, env overlay, residency egress rule, tenancy SQL binding. No secret resolution (only env var names are stored, never values) and no per-module env emission (module glue owns that).
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
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 demystify_platform_profiles-0.3.0.tar.gz.
File metadata
- Download URL: demystify_platform_profiles-0.3.0.tar.gz
- Upload date:
- Size: 68.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
345aa7b70e9e4168f23cba8b5cedc1ddae936bca0ba9c1385733739482cc5924
|
|
| MD5 |
facb91f31f2c455a091bce07f837734a
|
|
| BLAKE2b-256 |
916b49d8a91052e0bbd89d6f232813b0d4b69c0f74ec07413bc59376be097927
|
Provenance
The following attestation bundles were made for demystify_platform_profiles-0.3.0.tar.gz:
Publisher:
publish-pypi.yml on demystify-systems/ai-services-tools
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
demystify_platform_profiles-0.3.0.tar.gz -
Subject digest:
345aa7b70e9e4168f23cba8b5cedc1ddae936bca0ba9c1385733739482cc5924 - Sigstore transparency entry: 2188359568
- Sigstore integration time:
-
Permalink:
demystify-systems/ai-services-tools@8a03d52d29b940de704d971b9c437493879613a4 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/demystify-systems
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@8a03d52d29b940de704d971b9c437493879613a4 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file demystify_platform_profiles-0.3.0-py3-none-any.whl.
File metadata
- Download URL: demystify_platform_profiles-0.3.0-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
efe4abf608eaac12408923de2ac2c47372883f375a85df13493b537f41d02664
|
|
| MD5 |
31d27642b4339c9d2ff437a266396428
|
|
| BLAKE2b-256 |
f1a367af072588d80c064b38ed3ed4646946c9bfdb00e5efc2b9984ab7ea7209
|
Provenance
The following attestation bundles were made for demystify_platform_profiles-0.3.0-py3-none-any.whl:
Publisher:
publish-pypi.yml on demystify-systems/ai-services-tools
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
demystify_platform_profiles-0.3.0-py3-none-any.whl -
Subject digest:
efe4abf608eaac12408923de2ac2c47372883f375a85df13493b537f41d02664 - Sigstore transparency entry: 2188359585
- Sigstore integration time:
-
Permalink:
demystify-systems/ai-services-tools@8a03d52d29b940de704d971b9c437493879613a4 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/demystify-systems
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@8a03d52d29b940de704d971b9c437493879613a4 -
Trigger Event:
workflow_dispatch
-
Statement type: