Skip to main content

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).

Metadata

Release files for demystify-platform-profiles 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for demystify-platform-profiles 0.3.0
File Size Uploaded Provenance Actions
demystify_platform_profiles-0.3.0.tar.gz 68.1 kB With provenance Details for demystify_platform_profiles-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for demystify-platform-profiles 0.3.0
File Interpreter ABI Platform Actions
demystify_platform_profiles-0.3.0-py3-none-any.whl Python 3 none any Details for demystify_platform_profiles-0.3.0-py3-none-any.whl

Total release size: 76.1 kB

Release files / demystify_platform_profiles-0.3.0.tar.gz

Download URL demystify_platform_profiles-0.3.0.tar.gz
Size 68.1 kB
Tags Source
SHA-256 checksum
How to use checksums
345aa7b70e9e4168f23cba8b5cedc1ddae936bca0ba9c1385733739482cc5924
BLAKE2b-256 checksum
How to use checksums
916b49d8a91052e0bbd89d6f232813b0d4b69c0f74ec07413bc59376be097927
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 17, 2026.

Transparency log

Release files / demystify_platform_profiles-0.3.0-py3-none-any.whl

Download URL demystify_platform_profiles-0.3.0-py3-none-any.whl
Size 8.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
efe4abf608eaac12408923de2ac2c47372883f375a85df13493b537f41d02664
BLAKE2b-256 checksum
How to use checksums
f1a367af072588d80c064b38ed3ed4646946c9bfdb00e5efc2b9984ab7ea7209
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 17, 2026.

Transparency log

Security for demystify-platform-profiles 0.3.0

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for demystify_platform_profiles-0.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 17, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page