Metadata-Version: 2.4
Name: envless-env
Version: 0.0.1
Summary: The Envless runtime for Python. Load your encrypted environment when your app starts, decrypt it on the machine that runs it, and read it typed, with a server and client split.
Project-URL: Homepage, https://envless.cloud
Project-URL: Documentation, https://envless.cloud/docs/env-python/overview
Project-URL: Reference, https://envless.cloud/docs/env-python/reference
Project-URL: Changelog, https://envless.cloud/docs/env-python/changelog
Project-URL: Dashboard, https://envless.cloud/dashboard
Project-URL: Status, https://status.envless.cloud
Author: Envless
License-Expression: LicenseRef-Proprietary
Keywords: config,django,dotenv,encrypted secrets,env,env vars,environment variables,envless,fastapi,flask,pydantic-settings,secret management,secrets,settings
Classifier: Development Status :: 3 - Alpha
Classifier: Framework :: Django
Classifier: Framework :: FastAPI
Classifier: Framework :: Flask
Classifier: Framework :: Pydantic
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Security :: Cryptography
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.10
Requires-Dist: anyio>=3.7
Requires-Dist: envless-sdk<0.1,>=0.0.1
Description-Content-Type: text/markdown

<div align='center'>
   <a href='https://envless.cloud'>
        <img
            src='https://cdn-prod.envless.cloud/assets/npm/logo.svg'
            alt='Envless Logo'
            width='180'
        />
   </a>

   <br />
</div>

<p align='center'>
    Load your encrypted environment when your Python app starts, decrypted on the machine that runs it.
</p>

<p align='center'>
    <a href='https://envless.cloud'>
        <b>
            Website
        </b>
    </a>
    •
    <a href='https://envless.cloud/dashboard'>
        <b>
            Dashboard
        </b>
    </a>
    •
    <a href='https://envless.cloud/docs/env-python/overview'>
        <b>
            Documentation
        </b>
    </a>
    •
    <a href='https://status.envless.cloud'>
        <b>
            Services Status
        </b>
    </a>
</p>

<br />

## Envless runtime for Python

`envless-env` fetches your environment from Envless when your app starts, decrypts it on the machine that runs it, and hands it to your code typed. It is the Python twin of `@goenvless/env`: the same loader, the same cache, the same rules for the process environment and the same errors. A parity check in the Envless repository replays the same scenarios against both packages before each release.

It runs on Python 3.10 and newer, and depends on `envless-sdk` for the HTTP client and the crypto, plus `anyio`.

### Installing

```bash
pip install envless-env
```

Or `uv add envless-env`, or `poetry add envless-env`. The package installs as `envless-env` and imports as `envless_env`.

### Loading at boot

Import `envless_env.register` before anything reads a variable. It fetches, decrypts and fills `os.environ` with every name that is safe to set, and raises if it cannot.

```python
import envless_env.register  # noqa: F401
from envless_env.server import env

database_url = env.DATABASE_URL
```

Set `ENVLESS_TOKEN` to a machine key (`ev_sk_…`) and `ENVLESS_KEY` or `ENVLESS_PASSPHRASE` to decrypt. The project and environment come from `ENVLESS_PROJECT` and `ENVLESS_ENV`, or from the `.envless` file that `envless link` writes. Under `envless run` none of that is needed: the values are already in the environment and nothing is fetched.

### Reading

```python
from envless_env.server import env, optional

port = env.PORT
sentry_dsn = optional.SENTRY_DSN
```

`env.NAME` is coerced to the type you set in Envless: a whole `number` comes back as an `int` and a fractional one as a `float`, a `boolean` is `True` only for `true` or `1`, and everything else is a `str`. A name that is not set raises `MissingVariableError`, and `optional` returns `None` instead. `envless_env.client.env` sees only the variables marked client, for anything you hand to a browser or a template.

`python -m envless_env types` writes `envless_env_types.py`, the same views typed by name from your variables in Envless, so mypy and pyright catch a misspelt name or a server variable read on the client.

The `env` objects refuse to be pickled, iterated or printed with their values, so a stray `repr()` in a log line or a debug page shows a count, never a secret. `load()` returns a plain `dict` you own when you need every value at once.

### Frameworks

```python
from fastapi import FastAPI

from envless_env.fastapi import lifespan

app = FastAPI(lifespan=lifespan)
```

`envless_env.django.context_processor` hands client variables to Django templates, `envless_env.flask.init_app` loads into a Flask app's config, and `envless_env.pydantic.EnvlessSettingsSource` feeds pydantic-settings. For serverless functions, `envless_env.edge.load` takes every input as an argument and touches nothing on disk.

The rest, the cache, the server and client split, every framework recipe and every export, lives in the [documentation](https://envless.cloud/docs/env-python/overview).
