Skip to main content

Better Python Doppler

Better Python Doppler is a lightweight, sync, secrets-first Python SDK for the Doppler API.

The supported public surface today is secrets management. This repo is not yet documenting or claiming first-class public support for projects, configs, or environments.

Related repo docs:

Installation

This project currently requires Python 3.12 or newer.

The package name is better-python-doppler.

pip install better-python-doppler

Runtime dependencies are declared in pyproject.toml, including requests and python-dotenv.

For a source checkout, the verified local install path is:

pip install -e .[test]

Current Scope

Supported and documented today:

  • direct token auth with Doppler(service_token="...")
  • explicit environment lookup with Doppler(service_token_environ_name="...")
  • explicit .env loading with Doppler.from_env(...)
  • client-level scoped defaults with client.set_scope(project_name, config_name)
  • secrets access through client.secrets
  • compatibility access through client.Secrets
  • top-level compatibility exports: Secrets and SecretsClient
  • SDK exception types exported from better_python_doppler

Supported secrets workflows:

  • list
  • list_names
  • get
  • get_raw
  • as_dict
  • set
  • set_many
  • update as a compatibility wrapper
  • delete
  • update_note
  • download

Not documented as supported public SDK surface yet:

  • projects client
  • configs client
  • environments client

Authentication

Direct Token

from better_python_doppler import Doppler

client = Doppler(service_token="dp.st.example-token")

Explicit Environment Lookup

from better_python_doppler import Doppler

client = Doppler(service_token_environ_name="DOPPLER_SERVICE_TOKEN")

This reads the named environment variable directly. It does not implicitly load .env.

Explicit .env Workflow

from better_python_doppler import Doppler

client = Doppler.from_env(
    "DOPPLER_SERVICE_TOKEN",
    dotenv_path=".env",
    override=False,
)

Use from_env(...) when you want .env loading to be explicit instead of hidden in the base constructor.

Secrets Usage

Recommended usage goes through client.secrets.

from better_python_doppler import Doppler

client = Doppler(service_token="dp.st.example-token")

secret = client.secrets.get("my-project", "dev", "API_KEY")
print(secret.name)
print(secret.value.raw)

raw_value = client.secrets.get_raw("my-project", "dev", "API_KEY")
print(raw_value)

Scoped Defaults

If you are repeatedly targeting the same project and config, set a client scope once and omit them from later secrets calls.

from better_python_doppler import Doppler

client = Doppler(service_token="dp.st.example-token").set_scope(
    "my-project",
    "dev",
)

print(client.secrets.list_names())
print(client.secrets.get_raw("API_KEY"))
client.secrets.set("API_KEY", "next-value")

client.clear_scope()

Single Secret Set/Get

updated = client.secrets.set(
    "my-project",
    "dev",
    "API_KEY",
    "next-value",
)

print(updated.value.raw)
print(client.secrets.get_raw("my-project", "dev", "API_KEY"))

Multi-Secret Set/Update

updated = client.secrets.set_many(
    "my-project",
    "dev",
    {
        "API_KEY": "next-value",
        "TIMEOUT": "30",
    },
)

compatibility_result = client.Secrets.update(
    "my-project",
    "dev",
    secrets={
        "API_KEY": "rotated-value",
        "TIMEOUT": "60",
    },
)

set and set_many are the preferred write methods. update(...) remains available for compatibility.

Download

as_json = client.secrets.download("my-project", "dev", format="json")
as_env = client.secrets.download(
    "my-project",
    "dev",
    format="env",
    secrets=["API_KEY", "TIMEOUT"],
)

download(..., format="json") and download(..., format="dotnet-json") return dictionaries. Text formats such as env, yaml, docker, and env-no-quotes return strings.

Compatibility

These compatibility paths are still preserved:

  • client.Secrets returns the same cached object as client.secrets
  • Secrets remains a top-level compatibility alias
  • SecretsClient remains a top-level export

Example:

from better_python_doppler import Doppler

client = Doppler(service_token="dp.st.example-token")
assert client.Secrets is client.secrets

Exceptions

The SDK exports its own exception types:

  • DopplerError
  • DopplerConfigError
  • DopplerTransportError
  • DopplerResponseError
  • DopplerAPIError
  • DopplerAuthError
  • DopplerNotFoundError
  • DopplerValidationError

Offline Examples

The scripts in examples/ are intentionally offline. They use a fake transport so they do not call the live Doppler API.

License

This project is licensed under the Apache 2.0 License. See the LICENSE file for details.

Metadata

Release files for better-python-doppler 2.1.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 better-python-doppler 2.1.0
File Size Uploaded
better_python_doppler-2.1.0.tar.gz 19.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for better-python-doppler 2.1.0
File Interpreter ABI Platform
better_python_doppler-2.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 36.6 kB

Release files / better_python_doppler-2.1.0.tar.gz

Download URL better_python_doppler-2.1.0.tar.gz
Size 19.8 kB
Tags Source
SHA-256 checksum
How to use checksums
600755a298fea5786cdf9f33cda55442197098ad5cf1f640d6a9acb47ebf3507
BLAKE2b-256 checksum
How to use checksums
14ba34c05798080dc4017e43ac145a33b108cbb18946e998f71021e52e925dbd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Release files / better_python_doppler-2.1.0-py3-none-any.whl

Download URL better_python_doppler-2.1.0-py3-none-any.whl
Size 16.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a15d5d9958da310431cfaaabad0f1f8c476ace5dce8688424ae2f3d88ac1e7ab
BLAKE2b-256 checksum
How to use checksums
3ff4f7d533cb638b1c71b784f3b1ff84fee31c7167a8d8126861f2c74b9c42f9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Release history Release notifications | RSS feed

This release

2.1.0 This release

2 release files

2.0.0

2 release files

1.0.0

2 release files

0.1.0

2 release files

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