envstack 1.0.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- envstack/__init__.py +40 -0
- envstack/cli.py +478 -0
- envstack/config.py +108 -0
- envstack/encrypt.py +361 -0
- envstack/env.py +997 -0
- envstack/envshell.py +143 -0
- envstack/exceptions.py +82 -0
- envstack/logger.py +61 -0
- envstack/node.py +410 -0
- envstack/path.py +448 -0
- envstack/util.py +800 -0
- envstack-1.0.3.dist-info/LICENSE +12 -0
- envstack-1.0.3.dist-info/METADATA +177 -0
- envstack-1.0.3.dist-info/RECORD +17 -0
- envstack-1.0.3.dist-info/WHEEL +5 -0
- envstack-1.0.3.dist-info/entry_points.txt +3 -0
- envstack-1.0.3.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
envstack
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024-2026, Ryan Galloway (ryan@rsgalloway.com)
|
|
4
|
+
All rights reserved.
|
|
5
|
+
|
|
6
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
9
|
+
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
10
|
+
* Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
11
|
+
|
|
12
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: envstack
|
|
3
|
+
Version: 1.0.3
|
|
4
|
+
Summary: Environment variable composition layer for tools and processes.
|
|
5
|
+
Author-email: Ryan Galloway <ryan@rsgalloway.com>
|
|
6
|
+
License: BSD 3-Clause License
|
|
7
|
+
Project-URL: Homepage, https://github.com/rsgalloway/envstack
|
|
8
|
+
Project-URL: Repository, https://github.com/rsgalloway/envstack
|
|
9
|
+
Project-URL: Issues, https://github.com/rsgalloway/envstack/issues
|
|
10
|
+
Project-URL: Changelog, https://github.com/rsgalloway/envstack/blob/master/CHANGELOG.md
|
|
11
|
+
Project-URL: Documentation, https://github.com/rsgalloway/envstack/tree/master/docs
|
|
12
|
+
Keywords: environment,env,dotenv,configuration,config,environment-variables,cli,deployment,devops,pipeline,vfx,tooling
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.6
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
26
|
+
Requires-Python: >=3.6
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
License-File: LICENSE
|
|
29
|
+
Requires-Dist: PyYAML>=5.1.2
|
|
30
|
+
Requires-Dist: cryptography<47,>=43.0.1; python_version < "3.9"
|
|
31
|
+
Requires-Dist: cryptography>=43.0.1; python_version >= "3.9"
|
|
32
|
+
|
|
33
|
+
envstack
|
|
34
|
+
========
|
|
35
|
+
|
|
36
|
+
Environment variable composition and activation layer for tools and processes.
|
|
37
|
+
|
|
38
|
+
> envstack is what `.env` files wish they were when they grew up.
|
|
39
|
+
|
|
40
|
+
## Why envstack?
|
|
41
|
+
|
|
42
|
+
- Hierarchical environment composition
|
|
43
|
+
- Explicit precedence and overrides
|
|
44
|
+
- Late-bound environment activation
|
|
45
|
+
- Shared, policy-driven environments
|
|
46
|
+
- Inspectable and deterministic behavior
|
|
47
|
+
|
|
48
|
+
envstack environments are layered hierarchically, with later layers inheriting
|
|
49
|
+
from and overriding earlier ones.
|
|
50
|
+
|
|
51
|
+
```mermaid
|
|
52
|
+
flowchart LR
|
|
53
|
+
default[default.env] --> prod[prod.env]
|
|
54
|
+
prod --> dev[dev.env]
|
|
55
|
+
prod --> test[test.env]
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Later layers override earlier ones. Use envstack -t VAR to trace where a value
|
|
59
|
+
comes from. envstack focuses on **configuration and activation**, not dependency
|
|
60
|
+
resolution.
|
|
61
|
+
|
|
62
|
+
For the core concepts, see
|
|
63
|
+
[docs/index.md](https://github.com/rsgalloway/envstack/blob/master/docs/index.md).
|
|
64
|
+
|
|
65
|
+
## Installation
|
|
66
|
+
|
|
67
|
+
The easiest way to install:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
pip install -U envstack
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Quickstart
|
|
74
|
+
|
|
75
|
+
Start by getting the latest
|
|
76
|
+
[default.env](https://github.com/rsgalloway/envstack/blob/master/examples/default/default.env)
|
|
77
|
+
example file:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
curl -o \
|
|
81
|
+
default.env \
|
|
82
|
+
https://raw.githubusercontent.com/rsgalloway/envstack/master/examples/default/default.env
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Running `envstack` will launch a new shell session with the resolved environment:
|
|
86
|
+
|
|
87
|
+
```shell
|
|
88
|
+
$ envstack
|
|
89
|
+
🚀 Launching envstack shell... (CTRL+D or "exit" to quit)
|
|
90
|
+
(prod) ~$ echo $ENV
|
|
91
|
+
prod
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
To inspect the unresolved environment (before variable expansion):
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
$ envstack -u
|
|
98
|
+
DEPLOY_ROOT=${ROOT}/${ENV}
|
|
99
|
+
ENV=prod
|
|
100
|
+
ENVPATH=${DEPLOY_ROOT}/env:${ENVPATH}
|
|
101
|
+
LOG_LEVEL=${LOG_LEVEL:=INFO}
|
|
102
|
+
PATH=${DEPLOY_ROOT}/bin:${PATH}
|
|
103
|
+
PS1=\[\e[32m\](${ENV})\[\e[0m\] \w\$
|
|
104
|
+
PYTHONPATH=${DEPLOY_ROOT}/lib/python:${PYTHONPATH}
|
|
105
|
+
ROOT=/mnt/pipe
|
|
106
|
+
STACK=default
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
$ envstack -r DEPLOY_ROOT
|
|
111
|
+
DEPLOY_ROOT=/mnt/pipe/prod
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## How envstack finds environments
|
|
115
|
+
|
|
116
|
+
envstack discovers environment definitions via the `ENVPATH` environment variable.
|
|
117
|
+
`ENVPATH` is to envstack what `PATH` is to executables:
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
ENVPATH=/path/to/dev/env:/path/to/prod/env
|
|
121
|
+
```
|
|
122
|
+
In this case, environments in dev override or layer on top of environments in
|
|
123
|
+
prod.
|
|
124
|
+
|
|
125
|
+
## Converting `.env` files
|
|
126
|
+
|
|
127
|
+
Convert existing `.env` files to envstack by piping them into envstack:
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
cat .env | envstack --set -o out.env
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Running Commands
|
|
134
|
+
|
|
135
|
+
To run any command line executable inside of an environment stack, where
|
|
136
|
+
`[COMMAND]` is the command to run:
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
$ envstack [STACK] -- [COMMAND]
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
For example:
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
$ envstack -- echo {ENV}
|
|
146
|
+
prod
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Example of injecting environment into a subprocess:
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
$ echo "console.log('Hello ' + process.env.ENV)" > index.js
|
|
153
|
+
$ node index.js
|
|
154
|
+
Hello undefined
|
|
155
|
+
$ envstack -- node index.js
|
|
156
|
+
Hello prod
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## Secrets and encryption
|
|
160
|
+
|
|
161
|
+
envstack supports optional encryption of environment values when writing
|
|
162
|
+
environment files, allowing sensitive configuration to be safely stored,
|
|
163
|
+
committed, or distributed.
|
|
164
|
+
|
|
165
|
+
Encryption protects values **at rest** and integrates with environment stacks and
|
|
166
|
+
includes. envstack does not attempt to be a full secret management system.
|
|
167
|
+
|
|
168
|
+
See [docs/secrets.md](https://github.com/rsgalloway/envstack/blob/master/docs/secrets.md) for details.
|
|
169
|
+
|
|
170
|
+
## Documentation
|
|
171
|
+
|
|
172
|
+
- [Design & philosophy](https://github.com/rsgalloway/envstack/blob/master/docs/design.md)
|
|
173
|
+
- [Examples & patterns](https://github.com/rsgalloway/envstack/blob/master/docs/examples.md)
|
|
174
|
+
- [Tool comparisons](https://github.com/rsgalloway/envstack/blob/master/docs/comparison.md)
|
|
175
|
+
- [Secrets and encryption](https://github.com/rsgalloway/envstack/blob/master/docs/secrets.md)
|
|
176
|
+
- [FAQ & gotchas](https://github.com/rsgalloway/envstack/blob/master/docs/faq.md)
|
|
177
|
+
- [API docs](https://github.com/rsgalloway/envstack/blob/master/docs/api.md)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
envstack/__init__.py,sha256=PVKv9hgzvAsqOuFMF9vHr8PyJB8WkZI9vZVVUBNirN8,1820
|
|
2
|
+
envstack/cli.py,sha256=VIMXt6v3IwJVtwI03md8qja5fGxncbczNc4s5plFfdU,15104
|
|
3
|
+
envstack/config.py,sha256=8tFD-P-F6XGUqFv2_LJqM8KDYYnMkE1gqB859bfcL-Q,3473
|
|
4
|
+
envstack/encrypt.py,sha256=Hkcs7NoFhDiJTLrttDZA7moU9AWXBC9eog4E2ZzHTPk,12071
|
|
5
|
+
envstack/env.py,sha256=JWDdFvEmoUoZB5Fvjvom8u561ps8QtLjPeHj2c0pPzQ,31621
|
|
6
|
+
envstack/envshell.py,sha256=xEjVWiU6kOaF-JNLB6G8ps03ws_AeMBzKEZpkU1pxGo,5091
|
|
7
|
+
envstack/exceptions.py,sha256=hgY4hr7MrUCd00lpocVfN3obyJXj19ldG0gkIWCuPEE,2458
|
|
8
|
+
envstack/logger.py,sha256=4F6mXvFCJ4shtps25Hhyakz55QA978PZyYf5QyJSCSQ,2396
|
|
9
|
+
envstack/node.py,sha256=lJySBt6ac_RnGB93lKe28fW4K9ZIgWQoJSZhGj7bI58,13261
|
|
10
|
+
envstack/path.py,sha256=XLvNVllAN4ESEyQTGuzvP_79Awppx1X2zveGZCTRzlg,14518
|
|
11
|
+
envstack/util.py,sha256=hAH9eIC8zyXy-ka7QAUL8tJBpEtdfaGkVoehZFMdXyY,25900
|
|
12
|
+
envstack-1.0.3.dist-info/LICENSE,sha256=pu1bPGLr3aPFe-qDp9f1TA9GNjzx9B-0fa77BWeQXhw,1518
|
|
13
|
+
envstack-1.0.3.dist-info/METADATA,sha256=I0eLXdkMsBvx3wS-MxlvMYLRlbajjxCHrfXG-zjmUSE,5348
|
|
14
|
+
envstack-1.0.3.dist-info/WHEEL,sha256=BNRMDyzLkkcmlv0J8ppDQkk2VED33SesJDynr9ED1gc,91
|
|
15
|
+
envstack-1.0.3.dist-info/entry_points.txt,sha256=l39kgZ2nBY-ZtO1YlTApA-c-ddLDeSsVvAJuKmmeUK8,80
|
|
16
|
+
envstack-1.0.3.dist-info/top_level.txt,sha256=3P8NrN4Uu0--SWJIq_p8NBt0cEon_FLpaRipVSs0dk8,9
|
|
17
|
+
envstack-1.0.3.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
envstack
|