Skip to main content
Yanked

This release has been yanked by its maintainers, and will be ignored by installers, except when explicitly specified.
Consider using release 1.0.4 instead.
Reason given by maintainers: bad build

envstack

Environment variable composition and activation layer for tools and processes.

envstack is what .env files wish they were when they grew up.

Why envstack?

  • Hierarchical environment composition
  • Explicit precedence and overrides
  • Late-bound environment activation
  • Shared, policy-driven environments
  • Inspectable and deterministic behavior

envstack environments are layered hierarchically, with later layers inheriting from and overriding earlier ones.

flowchart LR
  default[default.env] --> prod[prod.env]
  prod --> dev[dev.env]
  prod --> test[test.env]

Later layers override earlier ones. Use envstack -t VAR to trace where a value comes from. envstack focuses on configuration and activation, not dependency resolution.

For the core concepts, see docs/index.md.

Installation

The easiest way to install:

pip install -U envstack

Quickstart

Start by getting the latest default.env example file:

curl -o \
default.env \
https://raw.githubusercontent.com/rsgalloway/envstack/master/examples/default/default.env

Running envstack will launch a new shell session with the resolved environment:

$ envstack
🚀 Launching envstack shell... (CTRL+D or "exit" to quit)
(prod) ~$ echo $ENV
prod

To inspect the unresolved environment (before variable expansion):

$ envstack -u
DEPLOY_ROOT=${ROOT}/${ENV}
ENV=prod
ENVPATH=${DEPLOY_ROOT}/env:${ENVPATH}
LOG_LEVEL=${LOG_LEVEL:=INFO}
PATH=${DEPLOY_ROOT}/bin:${PATH}
PS1=\[\e[32m\](${ENV})\[\e[0m\] \w\$ 
PYTHONPATH=${DEPLOY_ROOT}/lib/python:${PYTHONPATH}
ROOT=/mnt/pipe
STACK=default
$ envstack -r DEPLOY_ROOT
DEPLOY_ROOT=/mnt/pipe/prod

How envstack finds environments

envstack discovers environment definitions via the ENVPATH environment variable. ENVPATH is to envstack what PATH is to executables:

ENVPATH=/path/to/dev/env:/path/to/prod/env

In this case, environments in dev override or layer on top of environments in prod.

Converting .env files

Convert existing .env files to envstack by piping them into envstack:

cat .env | envstack --set -o out.env

Running Commands

To run any command line executable inside of an environment stack, where [COMMAND] is the command to run:

$ envstack [STACK] -- [COMMAND]

For example:

$ envstack -- echo {ENV}
prod

Example of injecting environment into a subprocess:

$ echo "console.log('Hello ' + process.env.ENV)" > index.js
$ node index.js 
Hello undefined
$ envstack -- node index.js 
Hello prod

Secrets and encryption

envstack supports optional encryption of environment values when writing environment files, allowing sensitive configuration to be safely stored, committed, or distributed.

Encryption protects values at rest and integrates with environment stacks and includes. envstack does not attempt to be a full secret management system.

See docs/secrets.md for details.

Documentation

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

envstack-1.0.3.tar.gz (60.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

envstack-1.0.3-py3-none-any.whl (44.6 kB view details)

Uploaded Python 3

File details

Details for the file envstack-1.0.3.tar.gz.

File metadata

  • Download URL: envstack-1.0.3.tar.gz
  • Upload date:
  • Size: 60.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.8.10

File hashes

Hashes for envstack-1.0.3.tar.gz
Algorithm Hash digest
SHA256 bb4bed908a8cbb49b915f530c7ac08d86233f08f66269a8cc4195125ed8b9cc7
MD5 ce84cce79dcee833bbe2c629bee1dcf1
BLAKE2b-256 4fddec5c309a1b1236614030644993098dd31fd66025dcbad44ca2684dcb556c

See more details on using hashes here.

File details

Details for the file envstack-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: envstack-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 44.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.8.10

File hashes

Hashes for envstack-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 34d68a2eb2b18e2656cc23b1601d69c20aea33f6baffddd458d480de49b5d38e
MD5 6a5dfa3093f07103972d269ff2f875f9
BLAKE2b-256 e6a447b826553f783c32f84c61a0b38cf25cbe895f2e373659bd30b96b3c6972

See more details on using hashes here.

Release history Release notifications | RSS feed

1.0.4

2 files

This release

1.0.3 This release

2 files

1.0.2

1 file

1.0.1

1 file

1.0.0

1 file

0.9.6

1 file

0.9.5

1 file

0.9.4

1 file

0.9.3

1 file

0.9.2

1 file

0.9.1

1 file

0.9.0

1 file

0.8.9

1 file

0.8.8

1 file

0.8.7

1 file

0.8.6

1 file

0.8.5

1 file

0.8.4

1 file

0.8.3

1 file

0.8.2

1 file

0.8.1

1 file

0.8.0

1 file

0.7.5

1 file

0.7.4

1 file

0.7.3

1 file

0.7.2

1 file

0.7.1

1 file

0.7.0

1 file

0.6.4

1 file

0.6.3

1 file

0.6.2

1 file

0.6.1

1 file

0.6.0

1 file

0.5.4

1 file

0.5.3

1 file

0.5.2

1 file

0.5.1

1 file

0.5.0

1 file

0.4.2

1 file

0.4.1

1 file

0.4.0

1 file

0.3.0

1 file

0.2.6

1 file

0.2.5

1 file

0.2.4

1 file

0.2.3

1 file

0.2.2

1 file

0.2.1

1 file

0.2.0

1 file

0.1.1

1 file

0.1.0

1 file

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page