Skip to main content

Build Status Latest Version Python Support

Run your script with your env

Ultra simple runner that injects vars from the implicit .env file into your commands of choice.

denv COMMAND [ARGS]

Expects a .env file in the current directory of format:

KEY=VALUE
FOO=BAR
AGE=29
host=hostname=foo user=bar password=false

Examples

Create an .env file holding your vars

$ cat .env
CONNECTION_STRING=host=foo user=bar password=baz

Use them in posix commands:

$ denv env | grep CONNECTION_STRING
host=foo user=bar password=baz

Use them when running python scripts:

$ denv python -c 'import os;print(os.environ["host"])'
foo user=bar password=baz

Why?

At Trustpilot we strictly follow the 12-factors of designing software-as-a-service apps, especially the concept of isolating your configuration outside your app.

Using environment vars is the accepted practice for injecting these configs into apps during deployment. But running locally i wanted something very simple to inject these env-vars into the runtime myself.

Looking around you will quickly find many implementations:

But i tend to disagree with them in two ways:

  1. They tend to aim for being a replacement for your runtimes default environment lib and just overload with reading from a file

  2. Some of them lack support for connection-strings where there can be many =’s per line.

I wanted to seperate it completely so the runtime only cared about env-vars and its standard way of accessing these, and then have the runner inject these vars as the only thing it did.

- `sloev <sloev.github.io>`__

Metadata

Release files for denv 2.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for denv 2.0.1
File Size Uploaded
denv-2.0.1.tar.gz 3.1 kB Details

Release files / denv-2.0.1.tar.gz

Download URL denv-2.0.1.tar.gz
Size 3.1 kB
Tags Source
SHA-256 checksum
How to use checksums
57355ed95fe969dcd444dc5ef8a4f10fb3aa74f3d4271a5f43e6676e33a9c7b2
BLAKE2b-256 checksum
How to use checksums
e47493a0667549399e401fe2f297e822537aab8112c25320ce0b45873701c4db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.0 CPython/2.7.14

Release history Release notifications | RSS feed

This release

2.0.1 This release

1 release file

2.0.0

1 release file

1.4.2

1 release file

1.4.1

1 release file

1.1.3

1 release file

1.1.2

1 release file

1.1.1

1 release file

1.1.0

1 release file

1.0.5

1 release file

1.0.4

1 release file

1.0.3

1 release file

1.0.2

1 release file

1.0.1

1 release file

1.0.0

1 release file

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