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
.envloading withDoppler.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:
SecretsandSecretsClient - SDK exception types exported from
better_python_doppler
Supported secrets workflows:
listlist_namesgetget_rawas_dictsetset_manyupdateas a compatibility wrapperdeleteupdate_notedownload
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.Secretsreturns the same cached object asclient.secretsSecretsremains a top-level compatibility aliasSecretsClientremains 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:
DopplerErrorDopplerConfigErrorDopplerTransportErrorDopplerResponseErrorDopplerAPIErrorDopplerAuthErrorDopplerNotFoundErrorDopplerValidationError
Offline Examples
The scripts in examples/ are intentionally offline. They use a fake transport so they do not call the live Doppler API.
examples/direct_token_usage.pyexamples/explicit_env_lookup.pyexamples/from_env_workflow.pyexamples/single_secret_get_set.pyexamples/multi_secret_set_update.pyexamples/download_usage.pyexamples/example_secrets.py
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)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| better_python_doppler-2.1.0.tar.gz | 19.8 kB | Without provenance | Details for better_python_doppler-2.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| better_python_doppler-2.1.0-py3-none-any.whl | Python 3 | none | any | Details for better_python_doppler-2.1.0-py3-none-any.whl |
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
|
Security for better-python-doppler 2.1.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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.