Python

Python runtime

envless-env loads your encrypted environment when a Python app starts, decrypts it on the machine that runs it, and hands it to your code typed. The Python twin of @goenvless/env.

envless-env is the Envless runtime for Python. It fetches your environment when your app starts, decrypts it in the process, fills os.environ with every name that is safe to set, and gives your code an env object that reads each variable coerced to the type you set in Envless. No .env files on disk, no python-dotenv, no os.environ['X'] typo that only fails in production.

pip install envless-env
python
import envless_env.register  # noqa: F401
from envless_env.server import env

database_url = env.DATABASE_URL
port = env.PORT

It is the Python twin of @goenvless/env: the same loader, the same on-disk cache, the same rules for the process environment and the same error messages. A parity check in the Envless repository replays the same scenarios against both packages and one mock API before each release, from pagination and retries to which names are refused from os.environ. The one deliberate difference: the Python runtime reads ENVLESS_API_ENDPOINT when it runs, while the TypeScript package fixes its endpoint when it is built.

What this is, and what it is not

envless-envenvless-sdkenvless run
PurposeLoads variables into your running appAdministers a workspace from PythonInjects variables into any process
RunsInside your Python process, at bootIn scripts, back offices and CIIn front of your process, as the launcher
CredentialA machine key and a decryption keyAn API keyenvless login, or a machine key
Shapeenv.DATABASE_URLenvless.variables.create(...)envless run -- python app.py

Use envless-env when your app should fetch its own variables at boot, typically in production with a machine key. Use envless run when you would rather keep every credential in the launcher, and the Python SDK when you want to create projects or write variables from code. The two runtimes combine: inside envless run, the Python runtime reads the values the CLI injected and makes no request at all.

The surfaces

ImportWhat it gives you
envless_env.serverenv, optional, load, aload and override. Every variable, coerced. Use it in application code
envless_env.clientenv, optional and snapshot. Only the variables marked client, for templates and anything sent to a browser
envless_envenv, load, aload, the errors and the crypto helpers. env here sees every variable, like server
envless_env.registerNothing. Importing it loads, so put it first
envless_env.edgeload and aload with every input as an argument, for serverless functions
envless_env.cryptoencrypt, decrypt, encrypt_with_key, decrypt_with_key, workspace_key and the rest of the recipe
envless_env.django, .flask, .fastapi, .pydanticFramework integrations
python -m envless_env typesWrites envless_env_types.py, the views typed by name

Design

Typed reads

A whole number reads back as an int, a fractional one as a float, and a boolean as a bool. A missing name raises instead of returning None, unless you read it through optional.

Secrets stay put

The env objects refuse to be pickled, iterated or printed with their values, so a log line or a debug page shows a count, never a secret.

Ambient wins

A variable already set in the process environment is never overwritten, and names that change how a process executes code, such as PATH, LD_PRELOAD or PYTHONPATH, are never written at all.

Fast cold starts

The ciphertext is cached under ~/.envless/cache for 15 minutes, shared with @goenvless/env, so a restart with ENVLESS_KEY makes no request and still decrypts in memory.

Frameworks