Seamlessly and securely inject Doppler secrets into Google Colab interactive environments.
When working in ephemeral environments like Google Colab, managing secrets securely is a challenge. doppler-colab natively integrates with Colab's built-in Secrets management to securely fetch your environment variables from the Doppler API and inject them silently into os.environ.
No CLI dependencies, no leaking print statements, and downstream libraries instantly work.
Install the package directly inside your Colab notebook:
!pip install -q doppler-colab- Generate a Service Token inside your Doppler dashboard. (Service tokens enforce scoping and ensure you safely access the correct environment).
- Open your Google Colab notebook.
- Click the 🔑 Secrets icon on the left sidebar.
- Add a new secret with the name
DOPPLER_TOKENand paste in your Service Token (dp.st...). - Ensure the "Notebook access" toggle is explicitly switched ON next to the token, enabling read-access for your environment.
(Fallback: If you are not in Colab, or are on Colab Enterprise the package will automatically check os.environ["DOPPLER_TOKEN"] as a fallback).
Invoke the package manually to fetch and load your secrets:
import doppler_colab
doppler_colab.load()
# ✅ Successfully injected 14 secrets from Doppler [Project: your-project] into the environment.For a cleaner interactive workflow, use the %doppler_load magic command at the top of your cells:
import doppler_colab
%doppler_load- Silent Payloads:
doppler-colabwill never print the returned payload or tokens. You only receive a safe confirmation of the number of imported parameters. - Service Token Enforcement:
doppler-colabenforces the use of scoped Service Tokens (dp.st.*). Personal tokens, CLI tokens, and other token types are rejected with a clear error message.
Please note: This is a community-driven project and is not an official Doppler product, nor is it officially endorsed by Doppler.
This refactoring and adaptation to Google Colab would not have been possible without the foundational work of the original authors at Doppler on the python-doppler-env package.
For bug reports or feature requests specifically related to this Colab adaptation, please create an issue on this repository.