envstack


Nameenvstack JSON
Version 0.7.3 PyPI version JSON
download
home_pagehttp://github.com/rsgalloway/envstack
SummaryStacked environment variable management system
upload_time2024-12-17 15:15:20
maintainerNone
docs_urlNone
authorRyan Galloway
requires_python>=3.6
licenseBSD 3-Clause License
keywords
VCS
bugtrack_url
requirements PyYAML
Travis-CI No Travis.
coveralls test coverage No coveralls.
            envstack
========

Environment variable management system.

| Feature | Description |
|---------|-------------|
| Namespaced environments | Environments in envstack are namespaced, allowing you to organize and manage variables based on different contexts or projects. Each environment stack can have its own set of variables, providing a clean separation and avoiding conflicts between different environments. |
| Environment stacks | Allows you to manage environment variables using .env files called environment stacks. These stacks provide a hierarchical and contextual approach to managing variables. |
| Hierarchical structure | Stacks can be combined and have a defined order of priority. Variables defined in higher scope stacks flow from higher scope to lower scope, left to right. |
| Variable expansion modifiers | Supports bash-like variable expansion modifiers, allowing you to set default values for variables and override them in the environment or by higher scope stacks. |
| Platform-specific variables | Stacks can have platform-specific variables and values. This allows you to define different values for variables based on the platform. |
| Variable references | Variables can reference other variables, allowing for more flexibility and dynamic value assignment. |
| Multi-line values | Supports variables with multi-line values. |
| Includes | Stack files can include other stacks, making it easy to reuse and combine different stacks. |
| Python API | Provides a Python API that allows you to initialize and work with environment stacks programmatically. Easily initialize pre-defined environments with Python scripts, tools, and wrappers. |
| Running commands | Allows you to run command line executables inside an environment stack, providing a convenient way to execute commands with a pre-defined environment. |
| Wrappers | Supports wrappers, which are command line executable scripts that automatically run a given command in the environment stack. This allows for easy customization and management of environments. |
| Shell integration | Provides instructions for sourcing the environment stack in your current shell, allowing you to set and clear the environment easily. |

## Installation

The easiest way to install:

```bash
$ pip install -U envstack
```

Alternatively,

```bash
$ git clone https://github.com/rsgalloway/envstack
$ cd envstack
$ python setup.py install
```

#### distman

If installing from source to a network location, you can use
[distman](https://github.com/rsgalloway/distman) to
install envstack using the provided `dist.json` file:

```bash
$ ENVPATH=./env distman [-d]
```

Using distman will deploy the targets defined in the `dist.json` file to the
root folder defined by `${DEPLOY_ROOT}` (defined in `env/default.env`).

## Quickstart

Envstack looks for .env files in directories specified by `${ENVPATH}` and i
the current working directory. Start by getting the latest `default.env` 
environment stack file:

```bash
$ wget -O default.env \
https://raw.githubusercontent.com/rsgalloway/envstack/master/env/default.env
```

Set `$ENVPATH` to the directory containing your environment stack files:

```bash
$ export ENVPATH=/path/to/env/stack/files
```

Define as many paths as you want, and envstack will search for stack file in
order from left to right, for example:

```bash
$ export ENVPATH=/mnt/pipe/dev/env:/mnt/pipe/prod/env
```

In the case above, stack files in `/mnt/pipe/dev/env` will take precedence over those
found in `/mnt/pipe/prod/env`.

#### Basic Usage

Running the `envstack` command will show you the default environment stack,
defined in the `default.env` stack file:

```bash
$ envstack
DEPLOY_ROOT=${ROOT}/${ENV}
ENV=prod
ENVPATH=${DEPLOY_ROOT}/env:${ENVPATH}
HELLO=${HELLO:=world}
LOG_LEVEL=${LOG_LEVEL:=INFO}
PATH=${DEPLOY_ROOT}/bin:${PATH}
PYTHONPATH=${DEPLOY_ROOT}/lib/python:${PYTHONPATH}
ROOT=/mnt/pipe
STACK=default
```

If you are not seeing the above output, make sure the `default.env`
stack file is in your `$ENVPATH` or current working directory.

> NOTE: The name of the current stack will always be stored in `${STACK}`.

To see stacks, pass the stack name as the first arg. Environment stacks can be
combined, in order of priority (variables defined in stacks flow from higher
scope to lower scope, left to right):

```bash
$ envstack [STACK [STACK ...]]
```

#### Executing Scripts

Environment stack files are also executable scripts that can be run directly:


```bash
$ ./env/test.env
DEPLOY_ROOT=${ROOT}/${STACK}
ENV=${STACK}
ENVPATH=${DEPLOY_ROOT}/env:${ROOT}/prod/env
HELLO=${HELLO:=world}
LOG_LEVEL=DEBUG
PATH=${DEPLOY_ROOT}/bin:${ROOT}/prod/bin:${PATH}
PYTHONPATH=${DEPLOY_ROOT}/lib/python:${ROOT}/prod/lib/python:${PYTHONPATH}
ROOT=/mnt/pipe
STACK=test
```

Run commands inside a specific environment stack file:

```bash
$ ./env/test.env -- <command>
```

For example:

```bash
$ ./env/hello.env -- echo {HELLO}
world
```

Export a specific environment stack file:

```bash
$ ./env/hello.env --export
```

## Setting Values

Envstack uses bash-like variable expansion modifiers. Setting `$VAR` to a fixed
value means `$VAR` will always use that value. Using an expansion modifier
allows you to override the value:

| Value | Description |
|---------------------|-------------|
| value |  'value' |
| ${VAR:-default} | os.environ.get('VAR', 'default') |
| ${VAR:=default} | VAR = VAR or 'default' |
| ${VAR:?error message} | if not VAR: raise ValueError() |

Without the expansion modifier, values are set and do not change (but can be
overridden by lower scope stacks, i.e. a lower scope stack file may override
a higher one). 

If we define `$HELLO` like this:

```yaml
HELLO: world
```

Then the value is set and cannot be modified (except by lower scope stacks):

```bash
$ envstack -- echo {HELLO}
world
$ HELLO=goodbye envstack -- echo {HELLO}
world
```

With an expansion modifier, variables have a default value and can also be
overridden in the environment, or by higher scope stacks:

```yaml
HELLO: ${HELLO:=world}
```

Here we show the default value, and how we can override it in the environment:

```bash
$ envstack -- echo {HELLO}
world
$ HELLO=goodbye envstack -- echo {HELLO}
goodbye
```

## Creating Stacks

Several example or starter stacks are available in the [env folder of the
envstack repo](https://github.com/rsgalloway/envstack/tree/master/env).

To create a blank environment stack, create a new envstack file and declare some
variables.

Create a new stack file called "foobar.env" and make it executable (note: at
least one VAR needs to be defined under all):

#### foobar.env

```yaml
#!/usr/bin/env envstack

all: &default
  FOO: bar
  BAR: ${FOO}
darwin:
  <<: *default
linux:
  <<: *default
windows:
  <<: *default
```

Make it executable

```bash
$ chmod +x ./foobar.env
```

To see the resolved environment for the `foobar` stack, run:

```bash
$ envstack foobar
FOO=bar
BAR=$FOO
```

or execute it directly:

```bash
$ ./foobar.env
```

To see resolved values:

```bash
$ ./foobar.env -r
FOO=bar
BAR=bar
```

#### More Details

Variables can be platform specific:

```yaml
darwin:
  <<: *default
  HELLO: olleh
linux:
  <<: *default
  HELLO: world
windows:
  <<: *default
  HELLO: goodbye
```

Variables can reference other variables:

```yaml
all: &default
  FOO: ${BAR}
  BAR: ${BAZ}
  BAZ: ${BIZ}
  BIZ: ${BIZ:=foo}
```

As you might expect, the above resolves to:

```bash
$ envstack -r
BAR=foo
BAZ=foo
BIZ=foo
FOO=foo
```

#### Includes

Environment stack files can include other namespaced environments (you should
probably always include the `default` stack):

```yaml
include: [default, test]
```

## Usage

To see the unresolved environment for one or more environment stacks (values are
defined in the stacks from left to right):

```bash
$ envstack [STACK [STACK ...]]
```

To resolve one or more environment vars for a given stack:

```bash
$ envstack [STACK] -r [VAR [VAR ...]]
```

To trace where one or more environment vars is being set:

```bash
$ envstack [STACK] -t [VAR [VAR ...]]
```

To get the list of source files for a given stack:

```bash
$ envstack [STACK] --sources
```

## Python API

To initialize the environment stack in Python, use the `init` function:

```python
>>> envstack.init()
>>> os.getenv("HELLO")
'world'
```

To initialize the "dev" stack:

```python
>>> envstack.init("dev")
>>> os.getenv("ENV")
'dev'
```

To revert the original environment:

```python
>>> envstack.revert()
>>> os.getenv("HELLO")
>>> 
```

Creating and resolving environments:

```python
>>> from envstack.env import Env, resolve_environ
>>> env = Env({"BAR": "${FOO}", "FOO": "foo"})
>>> resolve_environ(env)
{'BAR': 'foo', 'FOO': 'foo'}
```

Loading and resolving predefined environments from stack files:

```python
>>> from envstack.env import load_environ, resolve_environ
>>> env = resolve_environ(load_environ(name))
```

## Running Commands

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

```bash
$ envstack [STACK] -- [COMMAND]
```

For example:

```bash 
$ envstack -- echo {HELLO}
world
```

Running a node command:

```bash
$ echo "console.log('Hello ' + process.env.HELLO)" > index.js
$ node index.js 
Hello undefined
$ envstack hello -- node index.js 
Hello world
```

Running Python commands in the default stack:

```bash
$ envstack -- python -c "import os; print(os.environ['HELLO'])"
world
```

Overriding values in the stack:

```bash
$ HELLO=goodbye envstack -- python -c "import os; print(os.environ['HELLO'])"
goodbye
```

Same command but using the "thing" stack"

```bash
$ envstack thing -- python -c "import os; print(os.environ['FOO'])"
bar
```

## Wrappers

Wrappers are command line executable scripts that automatically run a given
command in the environment stack.

Here is a simple example that runs a `python -c` command in the `hello`
environment stack that sets a value for `${PYEXE}`:

#### hello.env
```yaml
all: &default
  PYEXE: /usr/bin/python
```

#### bin/hello
```python
import sys
from envstack.wrapper import Wrapper

class HelloWrapper(Wrapper):
    def __init__(self, *args, **kwargs):
        super(HelloWrapper, self).__init__(*args, **kwargs)

    def executable(self):
        """Return the command to run."""
        return "${PYEXE} -c 'import os,sys;print(os.getenv(sys.argv[1]))'"

if __name__ == "__main__":
    hello = HelloWrapper("hello", sys.argv[1:])
    hello.launch()
```

Running the wrapper:

```bash
$ hello HELLO
world
```

## Shells

In order to set an environment stack in your current shell, the stack must be
sourced (that's because Python processes and subshells cannot alter the
environment of the parent process).

To source the environment in your current shell, create an alias that sources
the output of the `--export` command:

#### bash
```bash
alias envstack-init='source <(envstack --export)';
```

#### cmd
```cmd
doskey envstack-set=for /f "usebackq" %i in (`envstack --export $*`) do %%i
```

Then you can set the environment stack in your shell with the `envstack-init`
command. To clear the environment in your current shell, create an alias that
sources the output of the `--clear` command:

#### bash
```bash
alias envstack-clear='source <(envstack --clear)';
```

#### cmd
```cmd
doskey envstack-clear=for /f "usebackq" %i in (`envstack --clear $*`) do %%i
```

## Config

The following environment variables are used to help manage functionality:

| Name | Description |
|------|-------------|
| ENVPATH | Colon-separated paths to search for stack files |
| IGNORE_MISSING | Ignore missing stack files when resolving environments |
| STACK | Name of the current environment stack |

# Tests

Unit tests can be run using pytest (currently only tested on linux):

```bash
$ pytest tests -s
```

            

Raw data

            {
    "_id": null,
    "home_page": "http://github.com/rsgalloway/envstack",
    "name": "envstack",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": null,
    "author": "Ryan Galloway",
    "author_email": "ryan@rsgalloway.com",
    "download_url": "https://files.pythonhosted.org/packages/b3/57/608484fc1097fd8b8caa37d8fc025527e56913456be84ec77f72d843b38c/envstack-0.7.3.tar.gz",
    "platform": null,
    "description": "envstack\n========\n\nEnvironment variable management system.\n\n| Feature | Description |\n|---------|-------------|\n| Namespaced environments | Environments in envstack are namespaced, allowing you to organize and manage variables based on different contexts or projects. Each environment stack can have its own set of variables, providing a clean separation and avoiding conflicts between different environments. |\n| Environment stacks | Allows you to manage environment variables using .env files called environment stacks. These stacks provide a hierarchical and contextual approach to managing variables. |\n| Hierarchical structure | Stacks can be combined and have a defined order of priority. Variables defined in higher scope stacks flow from higher scope to lower scope, left to right. |\n| Variable expansion modifiers | Supports bash-like variable expansion modifiers, allowing you to set default values for variables and override them in the environment or by higher scope stacks. |\n| Platform-specific variables | Stacks can have platform-specific variables and values. This allows you to define different values for variables based on the platform. |\n| Variable references | Variables can reference other variables, allowing for more flexibility and dynamic value assignment. |\n| Multi-line values | Supports variables with multi-line values. |\n| Includes | Stack files can include other stacks, making it easy to reuse and combine different stacks. |\n| Python API | Provides a Python API that allows you to initialize and work with environment stacks programmatically. Easily initialize pre-defined environments with Python scripts, tools, and wrappers. |\n| Running commands | Allows you to run command line executables inside an environment stack, providing a convenient way to execute commands with a pre-defined environment. |\n| Wrappers | Supports wrappers, which are command line executable scripts that automatically run a given command in the environment stack. This allows for easy customization and management of environments. |\n| Shell integration | Provides instructions for sourcing the environment stack in your current shell, allowing you to set and clear the environment easily. |\n\n## Installation\n\nThe easiest way to install:\n\n```bash\n$ pip install -U envstack\n```\n\nAlternatively,\n\n```bash\n$ git clone https://github.com/rsgalloway/envstack\n$ cd envstack\n$ python setup.py install\n```\n\n#### distman\n\nIf installing from source to a network location, you can use\n[distman](https://github.com/rsgalloway/distman) to\ninstall envstack using the provided `dist.json` file:\n\n```bash\n$ ENVPATH=./env distman [-d]\n```\n\nUsing distman will deploy the targets defined in the `dist.json` file to the\nroot folder defined by `${DEPLOY_ROOT}` (defined in `env/default.env`).\n\n## Quickstart\n\nEnvstack looks for .env files in directories specified by `${ENVPATH}` and i\nthe current working directory. Start by getting the latest `default.env` \nenvironment stack file:\n\n```bash\n$ wget -O default.env \\\nhttps://raw.githubusercontent.com/rsgalloway/envstack/master/env/default.env\n```\n\nSet `$ENVPATH` to the directory containing your environment stack files:\n\n```bash\n$ export ENVPATH=/path/to/env/stack/files\n```\n\nDefine as many paths as you want, and envstack will search for stack file in\norder from left to right, for example:\n\n```bash\n$ export ENVPATH=/mnt/pipe/dev/env:/mnt/pipe/prod/env\n```\n\nIn the case above, stack files in `/mnt/pipe/dev/env` will take precedence over those\nfound in `/mnt/pipe/prod/env`.\n\n#### Basic Usage\n\nRunning the `envstack` command will show you the default environment stack,\ndefined in the `default.env` stack file:\n\n```bash\n$ envstack\nDEPLOY_ROOT=${ROOT}/${ENV}\nENV=prod\nENVPATH=${DEPLOY_ROOT}/env:${ENVPATH}\nHELLO=${HELLO:=world}\nLOG_LEVEL=${LOG_LEVEL:=INFO}\nPATH=${DEPLOY_ROOT}/bin:${PATH}\nPYTHONPATH=${DEPLOY_ROOT}/lib/python:${PYTHONPATH}\nROOT=/mnt/pipe\nSTACK=default\n```\n\nIf you are not seeing the above output, make sure the `default.env`\nstack file is in your `$ENVPATH` or current working directory.\n\n> NOTE: The name of the current stack will always be stored in `${STACK}`.\n\nTo see stacks, pass the stack name as the first arg. Environment stacks can be\ncombined, in order of priority (variables defined in stacks flow from higher\nscope to lower scope, left to right):\n\n```bash\n$ envstack [STACK [STACK ...]]\n```\n\n#### Executing Scripts\n\nEnvironment stack files are also executable scripts that can be run directly:\n\n\n```bash\n$ ./env/test.env\nDEPLOY_ROOT=${ROOT}/${STACK}\nENV=${STACK}\nENVPATH=${DEPLOY_ROOT}/env:${ROOT}/prod/env\nHELLO=${HELLO:=world}\nLOG_LEVEL=DEBUG\nPATH=${DEPLOY_ROOT}/bin:${ROOT}/prod/bin:${PATH}\nPYTHONPATH=${DEPLOY_ROOT}/lib/python:${ROOT}/prod/lib/python:${PYTHONPATH}\nROOT=/mnt/pipe\nSTACK=test\n```\n\nRun commands inside a specific environment stack file:\n\n```bash\n$ ./env/test.env -- <command>\n```\n\nFor example:\n\n```bash\n$ ./env/hello.env -- echo {HELLO}\nworld\n```\n\nExport a specific environment stack file:\n\n```bash\n$ ./env/hello.env --export\n```\n\n## Setting Values\n\nEnvstack uses bash-like variable expansion modifiers. Setting `$VAR` to a fixed\nvalue means `$VAR` will always use that value. Using an expansion modifier\nallows you to override the value:\n\n| Value | Description |\n|---------------------|-------------|\n| value |  'value' |\n| ${VAR:-default} | os.environ.get('VAR', 'default') |\n| ${VAR:=default} | VAR = VAR or 'default' |\n| ${VAR:?error message} | if not VAR: raise ValueError() |\n\nWithout the expansion modifier, values are set and do not change (but can be\noverridden by lower scope stacks, i.e. a lower scope stack file may override\na higher one). \n\nIf we define `$HELLO` like this:\n\n```yaml\nHELLO: world\n```\n\nThen the value is set and cannot be modified (except by lower scope stacks):\n\n```bash\n$ envstack -- echo {HELLO}\nworld\n$ HELLO=goodbye envstack -- echo {HELLO}\nworld\n```\n\nWith an expansion modifier, variables have a default value and can also be\noverridden in the environment, or by higher scope stacks:\n\n```yaml\nHELLO: ${HELLO:=world}\n```\n\nHere we show the default value, and how we can override it in the environment:\n\n```bash\n$ envstack -- echo {HELLO}\nworld\n$ HELLO=goodbye envstack -- echo {HELLO}\ngoodbye\n```\n\n## Creating Stacks\n\nSeveral example or starter stacks are available in the [env folder of the\nenvstack repo](https://github.com/rsgalloway/envstack/tree/master/env).\n\nTo create a blank environment stack, create a new envstack file and declare some\nvariables.\n\nCreate a new stack file called \"foobar.env\" and make it executable (note: at\nleast one VAR needs to be defined under all):\n\n#### foobar.env\n\n```yaml\n#!/usr/bin/env envstack\n\nall: &default\n  FOO: bar\n  BAR: ${FOO}\ndarwin:\n  <<: *default\nlinux:\n  <<: *default\nwindows:\n  <<: *default\n```\n\nMake it executable\n\n```bash\n$ chmod +x ./foobar.env\n```\n\nTo see the resolved environment for the `foobar` stack, run:\n\n```bash\n$ envstack foobar\nFOO=bar\nBAR=$FOO\n```\n\nor execute it directly:\n\n```bash\n$ ./foobar.env\n```\n\nTo see resolved values:\n\n```bash\n$ ./foobar.env -r\nFOO=bar\nBAR=bar\n```\n\n#### More Details\n\nVariables can be platform specific:\n\n```yaml\ndarwin:\n  <<: *default\n  HELLO: olleh\nlinux:\n  <<: *default\n  HELLO: world\nwindows:\n  <<: *default\n  HELLO: goodbye\n```\n\nVariables can reference other variables:\n\n```yaml\nall: &default\n  FOO: ${BAR}\n  BAR: ${BAZ}\n  BAZ: ${BIZ}\n  BIZ: ${BIZ:=foo}\n```\n\nAs you might expect, the above resolves to:\n\n```bash\n$ envstack -r\nBAR=foo\nBAZ=foo\nBIZ=foo\nFOO=foo\n```\n\n#### Includes\n\nEnvironment stack files can include other namespaced environments (you should\nprobably always include the `default` stack):\n\n```yaml\ninclude: [default, test]\n```\n\n## Usage\n\nTo see the unresolved environment for one or more environment stacks (values are\ndefined in the stacks from left to right):\n\n```bash\n$ envstack [STACK [STACK ...]]\n```\n\nTo resolve one or more environment vars for a given stack:\n\n```bash\n$ envstack [STACK] -r [VAR [VAR ...]]\n```\n\nTo trace where one or more environment vars is being set:\n\n```bash\n$ envstack [STACK] -t [VAR [VAR ...]]\n```\n\nTo get the list of source files for a given stack:\n\n```bash\n$ envstack [STACK] --sources\n```\n\n## Python API\n\nTo initialize the environment stack in Python, use the `init` function:\n\n```python\n>>> envstack.init()\n>>> os.getenv(\"HELLO\")\n'world'\n```\n\nTo initialize the \"dev\" stack:\n\n```python\n>>> envstack.init(\"dev\")\n>>> os.getenv(\"ENV\")\n'dev'\n```\n\nTo revert the original environment:\n\n```python\n>>> envstack.revert()\n>>> os.getenv(\"HELLO\")\n>>> \n```\n\nCreating and resolving environments:\n\n```python\n>>> from envstack.env import Env, resolve_environ\n>>> env = Env({\"BAR\": \"${FOO}\", \"FOO\": \"foo\"})\n>>> resolve_environ(env)\n{'BAR': 'foo', 'FOO': 'foo'}\n```\n\nLoading and resolving predefined environments from stack files:\n\n```python\n>>> from envstack.env import load_environ, resolve_environ\n>>> env = resolve_environ(load_environ(name))\n```\n\n## Running Commands\n\nTo run any command line executable inside of an environment stack, where\n`[COMMAND]` is the command to run:\n\n```bash\n$ envstack [STACK] -- [COMMAND]\n```\n\nFor example:\n\n```bash \n$ envstack -- echo {HELLO}\nworld\n```\n\nRunning a node command:\n\n```bash\n$ echo \"console.log('Hello ' + process.env.HELLO)\" > index.js\n$ node index.js \nHello undefined\n$ envstack hello -- node index.js \nHello world\n```\n\nRunning Python commands in the default stack:\n\n```bash\n$ envstack -- python -c \"import os; print(os.environ['HELLO'])\"\nworld\n```\n\nOverriding values in the stack:\n\n```bash\n$ HELLO=goodbye envstack -- python -c \"import os; print(os.environ['HELLO'])\"\ngoodbye\n```\n\nSame command but using the \"thing\" stack\"\n\n```bash\n$ envstack thing -- python -c \"import os; print(os.environ['FOO'])\"\nbar\n```\n\n## Wrappers\n\nWrappers are command line executable scripts that automatically run a given\ncommand in the environment stack.\n\nHere is a simple example that runs a `python -c` command in the `hello`\nenvironment stack that sets a value for `${PYEXE}`:\n\n#### hello.env\n```yaml\nall: &default\n  PYEXE: /usr/bin/python\n```\n\n#### bin/hello\n```python\nimport sys\nfrom envstack.wrapper import Wrapper\n\nclass HelloWrapper(Wrapper):\n    def __init__(self, *args, **kwargs):\n        super(HelloWrapper, self).__init__(*args, **kwargs)\n\n    def executable(self):\n        \"\"\"Return the command to run.\"\"\"\n        return \"${PYEXE} -c 'import os,sys;print(os.getenv(sys.argv[1]))'\"\n\nif __name__ == \"__main__\":\n    hello = HelloWrapper(\"hello\", sys.argv[1:])\n    hello.launch()\n```\n\nRunning the wrapper:\n\n```bash\n$ hello HELLO\nworld\n```\n\n## Shells\n\nIn order to set an environment stack in your current shell, the stack must be\nsourced (that's because Python processes and subshells cannot alter the\nenvironment of the parent process).\n\nTo source the environment in your current shell, create an alias that sources\nthe output of the `--export` command:\n\n#### bash\n```bash\nalias envstack-init='source <(envstack --export)';\n```\n\n#### cmd\n```cmd\ndoskey envstack-set=for /f \"usebackq\" %i in (`envstack --export $*`) do %%i\n```\n\nThen you can set the environment stack in your shell with the `envstack-init`\ncommand. To clear the environment in your current shell, create an alias that\nsources the output of the `--clear` command:\n\n#### bash\n```bash\nalias envstack-clear='source <(envstack --clear)';\n```\n\n#### cmd\n```cmd\ndoskey envstack-clear=for /f \"usebackq\" %i in (`envstack --clear $*`) do %%i\n```\n\n## Config\n\nThe following environment variables are used to help manage functionality:\n\n| Name | Description |\n|------|-------------|\n| ENVPATH | Colon-separated paths to search for stack files |\n| IGNORE_MISSING | Ignore missing stack files when resolving environments |\n| STACK | Name of the current environment stack |\n\n# Tests\n\nUnit tests can be run using pytest (currently only tested on linux):\n\n```bash\n$ pytest tests -s\n```\n",
    "bugtrack_url": null,
    "license": "BSD 3-Clause License",
    "summary": "Stacked environment variable management system",
    "version": "0.7.3",
    "project_urls": {
        "Homepage": "http://github.com/rsgalloway/envstack"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b357608484fc1097fd8b8caa37d8fc025527e56913456be84ec77f72d843b38c",
                "md5": "2e522627c16cee8cbddb2984f33d15db",
                "sha256": "b436b248e5680fbf3d7816cdf089d5b3d681c130f7171f7ef87fd0c5799cbc72"
            },
            "downloads": -1,
            "filename": "envstack-0.7.3.tar.gz",
            "has_sig": false,
            "md5_digest": "2e522627c16cee8cbddb2984f33d15db",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 32264,
            "upload_time": "2024-12-17T15:15:20",
            "upload_time_iso_8601": "2024-12-17T15:15:20.814516Z",
            "url": "https://files.pythonhosted.org/packages/b3/57/608484fc1097fd8b8caa37d8fc025527e56913456be84ec77f72d843b38c/envstack-0.7.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-17 15:15:20",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "rsgalloway",
    "github_project": "envstack",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "PyYAML",
            "specs": [
                [
                    "==",
                    "5.1.2"
                ]
            ]
        }
    ],
    "lcname": "envstack"
}
        
Elapsed time: 0.44989s