envstack 0.6.0__tar.gz → 0.6.2__tar.gz

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.
Files changed (25) hide show
  1. {envstack-0.6.0 → envstack-0.6.2}/PKG-INFO +29 -11
  2. {envstack-0.6.0 → envstack-0.6.2}/README.md +16 -10
  3. envstack-0.6.2/dev.env +23 -0
  4. envstack-0.6.2/dist.json +29 -0
  5. {envstack-0.6.0 → envstack-0.6.2}/lib/envstack/__init__.py +1 -1
  6. {envstack-0.6.0 → envstack-0.6.2}/lib/envstack/wrapper.py +18 -3
  7. {envstack-0.6.0 → envstack-0.6.2}/lib/envstack.egg-info/PKG-INFO +29 -11
  8. {envstack-0.6.0 → envstack-0.6.2}/lib/envstack.egg-info/SOURCES.txt +2 -0
  9. {envstack-0.6.0 → envstack-0.6.2}/setup.py +20 -2
  10. {envstack-0.6.0 → envstack-0.6.2}/stack.env +6 -6
  11. {envstack-0.6.0 → envstack-0.6.2}/LICENSE +0 -0
  12. {envstack-0.6.0 → envstack-0.6.2}/lib/envstack/cli.py +0 -0
  13. {envstack-0.6.0 → envstack-0.6.2}/lib/envstack/config.py +0 -0
  14. {envstack-0.6.0 → envstack-0.6.2}/lib/envstack/env.py +0 -0
  15. {envstack-0.6.0 → envstack-0.6.2}/lib/envstack/exceptions.py +0 -0
  16. {envstack-0.6.0 → envstack-0.6.2}/lib/envstack/logger.py +0 -0
  17. {envstack-0.6.0 → envstack-0.6.2}/lib/envstack/path.py +0 -0
  18. {envstack-0.6.0 → envstack-0.6.2}/lib/envstack.egg-info/dependency_links.txt +0 -0
  19. {envstack-0.6.0 → envstack-0.6.2}/lib/envstack.egg-info/entry_points.txt +0 -0
  20. {envstack-0.6.0 → envstack-0.6.2}/lib/envstack.egg-info/not-zip-safe +0 -0
  21. {envstack-0.6.0 → envstack-0.6.2}/lib/envstack.egg-info/requires.txt +0 -0
  22. {envstack-0.6.0 → envstack-0.6.2}/lib/envstack.egg-info/top_level.txt +0 -0
  23. {envstack-0.6.0 → envstack-0.6.2}/setup.cfg +0 -0
  24. {envstack-0.6.0 → envstack-0.6.2}/tests/test_env.py +0 -0
  25. {envstack-0.6.0 → envstack-0.6.2}/tests/test_path.py +0 -0
@@ -1,10 +1,22 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: envstack
3
- Version: 0.6.0
3
+ Version: 0.6.2
4
4
  Summary: Stacked environment variable management system
5
5
  Home-page: http://github.com/rsgalloway/envstack
6
6
  Author: Ryan Galloway
7
7
  Author-email: ryan@rsgalloway.com
8
+ License: BSD 3-Clause License
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Topic :: Software Development :: Libraries
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.6
14
+ Classifier: Programming Language :: Python :: 3.7
15
+ Classifier: Programming Language :: Python :: 3.8
16
+ Classifier: Programming Language :: Python :: 3.9
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Requires-Python: >=3.6
8
20
  Description-Content-Type: text/markdown
9
21
  License-File: LICENSE
10
22
  Requires-Dist: PyYAML>=5.1.2
@@ -45,13 +57,15 @@ sitecustomize.py module may override `$DEFAULT_ENV_DIR`.
45
57
 
46
58
  If installing from source to a network location, you can use
47
59
  [distman](https://github.com/rsgalloway/distman) to
48
- install envstack and the default `stack.env` file using the provided
49
- `dist.json` file:
60
+ install envstack using the provided `dist.json` file:
50
61
 
51
62
  ```bash
52
63
  $ distman [-d]
53
64
  ```
54
65
 
66
+ Using distman will deploy the targets defined in the `dist.json` file to the
67
+ root folder defined by `$DEPLOY_ROOT` (defined in `stack.env`).
68
+
55
69
  ## Quickstart
56
70
 
57
71
  The `stack` namespace is the default environment stack. Running the `envstack`
@@ -64,21 +78,25 @@ HELLO=world
64
78
  LOG_LEVEL=INFO
65
79
  DEFAULT_ENV_DIR=${DEPLOY_ROOT}/env
66
80
  DEPLOY_ROOT=${ROOT}/${ENV}
67
- ROOT=${HOME}/.local/envstack
81
+ ROOT=${HOME}/.local/pipe
82
+ BIN=${DEPLOY_ROOT}/bin
83
+ LIB=${DEPLOY_ROOT}/lib/python
84
+ PATH=${BIN}:${PATH}
85
+ PYTHONPATH=${LIB}:${PYTHONPATH}
68
86
  ```
69
87
 
70
88
  You can override anything in the environment stack by setting values in the
71
89
  local environment first:
72
90
 
73
91
  ```bash
74
- $ envstack -- echo \$ENV
75
- prod
76
- $ ENV=dev envstack -- echo \$ENV
77
- dev
92
+ $ envstack -- echo {HELLO}
93
+ world
94
+ $ HELLO=goodbye envstack -- echo {HELLO}
95
+ goodbye
78
96
  ```
79
97
 
80
- Modify the environment stack by editing `stack.env` or by creating new
81
- contextual `stack.env` files up on the filesystem.
98
+ Modify the environment stack by editing `stack.env` or by creating additional
99
+ contextual `stack.env` files in parent folders on the filesystem.
82
100
 
83
101
  ## Creating Stacks
84
102
 
@@ -195,7 +213,7 @@ $ envstack [STACK] -- [COMMAND]
195
213
  For example:
196
214
 
197
215
  ```bash
198
- $ envstack -- echo \$HELLO
216
+ $ envstack -- echo {HELLO}
199
217
  world
200
218
  ```
201
219
 
@@ -34,13 +34,15 @@ sitecustomize.py module may override `$DEFAULT_ENV_DIR`.
34
34
 
35
35
  If installing from source to a network location, you can use
36
36
  [distman](https://github.com/rsgalloway/distman) to
37
- install envstack and the default `stack.env` file using the provided
38
- `dist.json` file:
37
+ install envstack using the provided `dist.json` file:
39
38
 
40
39
  ```bash
41
40
  $ distman [-d]
42
41
  ```
43
42
 
43
+ Using distman will deploy the targets defined in the `dist.json` file to the
44
+ root folder defined by `$DEPLOY_ROOT` (defined in `stack.env`).
45
+
44
46
  ## Quickstart
45
47
 
46
48
  The `stack` namespace is the default environment stack. Running the `envstack`
@@ -53,21 +55,25 @@ HELLO=world
53
55
  LOG_LEVEL=INFO
54
56
  DEFAULT_ENV_DIR=${DEPLOY_ROOT}/env
55
57
  DEPLOY_ROOT=${ROOT}/${ENV}
56
- ROOT=${HOME}/.local/envstack
58
+ ROOT=${HOME}/.local/pipe
59
+ BIN=${DEPLOY_ROOT}/bin
60
+ LIB=${DEPLOY_ROOT}/lib/python
61
+ PATH=${BIN}:${PATH}
62
+ PYTHONPATH=${LIB}:${PYTHONPATH}
57
63
  ```
58
64
 
59
65
  You can override anything in the environment stack by setting values in the
60
66
  local environment first:
61
67
 
62
68
  ```bash
63
- $ envstack -- echo \$ENV
64
- prod
65
- $ ENV=dev envstack -- echo \$ENV
66
- dev
69
+ $ envstack -- echo {HELLO}
70
+ world
71
+ $ HELLO=goodbye envstack -- echo {HELLO}
72
+ goodbye
67
73
  ```
68
74
 
69
- Modify the environment stack by editing `stack.env` or by creating new
70
- contextual `stack.env` files up on the filesystem.
75
+ Modify the environment stack by editing `stack.env` or by creating additional
76
+ contextual `stack.env` files in parent folders on the filesystem.
71
77
 
72
78
  ## Creating Stacks
73
79
 
@@ -184,7 +190,7 @@ $ envstack [STACK] -- [COMMAND]
184
190
  For example:
185
191
 
186
192
  ```bash
187
- $ envstack -- echo \$HELLO
193
+ $ envstack -- echo {HELLO}
188
194
  world
189
195
  ```
190
196
 
envstack-0.6.2/dev.env ADDED
@@ -0,0 +1,23 @@
1
+ # Stacked environment variable management system.
2
+ #
3
+ # Environment variables are declared in namespaced .env files using yaml syntax.
4
+ # The default stack declares env variables in stack.env files.
5
+ # Create any new stack by creating new .env files, e.g. to create a new stack
6
+ # called "thing", just create thing.env files in any given context.
7
+ #
8
+ # $ pip install envstack
9
+
10
+ all: &default
11
+ ENV: dev
12
+ LOG_LEVEL: DEBUG
13
+ PATH: "${ROOT}/dev/bin:${ROOT}/prod/bin:${PATH}"
14
+ PYTHONPATH: "${ROOT}/dev/lib/python:${ROOT}/prod/lib/python:${PYTHONPATH}"
15
+
16
+ darwin:
17
+ <<: *default
18
+
19
+ linux:
20
+ <<: *default
21
+
22
+ windows:
23
+ <<: *default
@@ -0,0 +1,29 @@
1
+ {
2
+ "author": "ryan@rsg.io",
3
+ "targets": {
4
+ "env-envstack": {
5
+ "source": "stack.env",
6
+ "destination": "{DEPLOY_ROOT}/env/stack.env"
7
+ },
8
+ "env-dev": {
9
+ "source": "dev.env",
10
+ "destination": "{DEPLOY_ROOT}/env/dev.env"
11
+ },
12
+ "bin-envstack": {
13
+ "source": "bin/envstack",
14
+ "destination": "{DEPLOY_ROOT}/bin/envstack"
15
+ },
16
+ "bat-envstack": {
17
+ "source": "bin/envstack.bat",
18
+ "destination": "{DEPLOY_ROOT}/bin/envstack.bat"
19
+ },
20
+ "bin-hello": {
21
+ "source": "bin/hello",
22
+ "destination": "{DEPLOY_ROOT}/bin/hello"
23
+ },
24
+ "lib-envstack": {
25
+ "source": "lib/envstack",
26
+ "destination": "{DEPLOY_ROOT}/lib/python/envstack"
27
+ }
28
+ }
29
+ }
@@ -34,6 +34,6 @@ Stacked environment variable management system.
34
34
  """
35
35
 
36
36
  __prog__ = "envstack"
37
- __version__ = "0.6.0"
37
+ __version__ = "0.6.2"
38
38
 
39
39
  from envstack.env import Env, getenv, init, load_file
@@ -49,6 +49,14 @@ def to_args(cmd):
49
49
  return shlex.split(cmd)
50
50
 
51
51
 
52
+ def shell_join(args):
53
+ """Joins a list of arguments into a single quoted shell string."""
54
+ try:
55
+ return shlex.join(args)
56
+ except AttributeError:
57
+ return " ".join(shlex.quote(arg) for arg in args)
58
+
59
+
52
60
  class Wrapper(object):
53
61
  """Wrapper class for executables. Subprocessed with preconfigured environment.
54
62
 
@@ -233,15 +241,22 @@ def run_command(command, namespace=config.DEFAULT_NAMESPACE):
233
241
 
234
242
  >>> run_command(['ls', '-l'], 'my-stack')
235
243
 
244
+ - Automatically detects the shell to use based on the config.SHELL value.
245
+ - Converts {VAR} to $VAR for bash, sh, zsh, and %VAR% for cmd.
246
+
236
247
  :param command: command to run as a list of arguments
237
248
  :param namespace: environment stack namespace (default: 'stack')
238
- :returns: exit code
249
+ :returns: command exit code
239
250
  """
240
251
  logger.setup_stream_handler()
241
252
  if config.SHELL in ["bash", "sh", "zsh"]:
242
- cmd = ShellWrapper(namespace, shlex.join(command))
253
+ # convert {VAR} to ${VAR}, e.g. 'echo {VAR}' -> 'echo ${VAR}'
254
+ command = re.sub(r"\{(\w+)\}", r"${\1}", shell_join(command))
255
+ cmd = ShellWrapper(namespace, command)
243
256
  elif config.SHELL in ["cmd"]:
244
- cmd = CmdWrapper(namespace, " ".join(command))
257
+ # convert {VAR} to %VAR%, e.g. 'echo {VAR}' -> 'echo %VAR%'
258
+ command = re.sub(r"\{(\w+)\}", r"%\1%", " ".join(command))
259
+ cmd = CmdWrapper(namespace, command)
245
260
  else:
246
261
  cmd = CommandWrapper(namespace, command)
247
262
  return cmd.launch()
@@ -1,10 +1,22 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: envstack
3
- Version: 0.6.0
3
+ Version: 0.6.2
4
4
  Summary: Stacked environment variable management system
5
5
  Home-page: http://github.com/rsgalloway/envstack
6
6
  Author: Ryan Galloway
7
7
  Author-email: ryan@rsgalloway.com
8
+ License: BSD 3-Clause License
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Topic :: Software Development :: Libraries
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.6
14
+ Classifier: Programming Language :: Python :: 3.7
15
+ Classifier: Programming Language :: Python :: 3.8
16
+ Classifier: Programming Language :: Python :: 3.9
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Requires-Python: >=3.6
8
20
  Description-Content-Type: text/markdown
9
21
  License-File: LICENSE
10
22
  Requires-Dist: PyYAML>=5.1.2
@@ -45,13 +57,15 @@ sitecustomize.py module may override `$DEFAULT_ENV_DIR`.
45
57
 
46
58
  If installing from source to a network location, you can use
47
59
  [distman](https://github.com/rsgalloway/distman) to
48
- install envstack and the default `stack.env` file using the provided
49
- `dist.json` file:
60
+ install envstack using the provided `dist.json` file:
50
61
 
51
62
  ```bash
52
63
  $ distman [-d]
53
64
  ```
54
65
 
66
+ Using distman will deploy the targets defined in the `dist.json` file to the
67
+ root folder defined by `$DEPLOY_ROOT` (defined in `stack.env`).
68
+
55
69
  ## Quickstart
56
70
 
57
71
  The `stack` namespace is the default environment stack. Running the `envstack`
@@ -64,21 +78,25 @@ HELLO=world
64
78
  LOG_LEVEL=INFO
65
79
  DEFAULT_ENV_DIR=${DEPLOY_ROOT}/env
66
80
  DEPLOY_ROOT=${ROOT}/${ENV}
67
- ROOT=${HOME}/.local/envstack
81
+ ROOT=${HOME}/.local/pipe
82
+ BIN=${DEPLOY_ROOT}/bin
83
+ LIB=${DEPLOY_ROOT}/lib/python
84
+ PATH=${BIN}:${PATH}
85
+ PYTHONPATH=${LIB}:${PYTHONPATH}
68
86
  ```
69
87
 
70
88
  You can override anything in the environment stack by setting values in the
71
89
  local environment first:
72
90
 
73
91
  ```bash
74
- $ envstack -- echo \$ENV
75
- prod
76
- $ ENV=dev envstack -- echo \$ENV
77
- dev
92
+ $ envstack -- echo {HELLO}
93
+ world
94
+ $ HELLO=goodbye envstack -- echo {HELLO}
95
+ goodbye
78
96
  ```
79
97
 
80
- Modify the environment stack by editing `stack.env` or by creating new
81
- contextual `stack.env` files up on the filesystem.
98
+ Modify the environment stack by editing `stack.env` or by creating additional
99
+ contextual `stack.env` files in parent folders on the filesystem.
82
100
 
83
101
  ## Creating Stacks
84
102
 
@@ -195,7 +213,7 @@ $ envstack [STACK] -- [COMMAND]
195
213
  For example:
196
214
 
197
215
  ```bash
198
- $ envstack -- echo \$HELLO
216
+ $ envstack -- echo {HELLO}
199
217
  world
200
218
  ```
201
219
 
@@ -1,5 +1,7 @@
1
1
  LICENSE
2
2
  README.md
3
+ dev.env
4
+ dist.json
3
5
  setup.py
4
6
  stack.env
5
7
  lib/envstack/__init__.py
@@ -74,13 +74,30 @@ class PostInstallCommand(install):
74
74
 
75
75
  setup(
76
76
  name="envstack",
77
- version="0.6.0",
77
+ version="0.6.2",
78
78
  description="Stacked environment variable management system",
79
79
  long_description=long_description,
80
80
  long_description_content_type="text/markdown",
81
81
  author="Ryan Galloway",
82
82
  author_email="ryan@rsgalloway.com",
83
83
  url="http://github.com/rsgalloway/envstack",
84
+ license="BSD 3-Clause License",
85
+ classifiers=[
86
+ # How mature is this project? Common values are
87
+ # 3 - Alpha
88
+ # 4 - Beta
89
+ # 5 - Production/Stable
90
+ "Development Status :: 4 - Beta",
91
+ "Intended Audience :: Developers",
92
+ "Topic :: Software Development :: Libraries",
93
+ "Programming Language :: Python :: 3",
94
+ "Programming Language :: Python :: 3.6",
95
+ "Programming Language :: Python :: 3.7",
96
+ "Programming Language :: Python :: 3.8",
97
+ "Programming Language :: Python :: 3.9",
98
+ "Programming Language :: Python :: 3.10",
99
+ "Programming Language :: Python :: 3.11",
100
+ ],
84
101
  package_dir={"": "lib"},
85
102
  packages=find_packages("lib"),
86
103
  entry_points={
@@ -91,7 +108,8 @@ setup(
91
108
  install_requires=[
92
109
  "PyYAML>=5.1.2",
93
110
  ],
94
- data_files=[(".", ["stack.env"])],
111
+ python_requires=">=3.6",
112
+ data_files=[(".", ["stack.env", "dev.env", "dist.json"])],
95
113
  cmdclass={"install": PostInstallCommand},
96
114
  zip_safe=False,
97
115
  )
@@ -20,15 +20,15 @@ all: &default
20
20
 
21
21
  darwin:
22
22
  <<: *default
23
- ROOT: "${HOME}/Library/Application Support/envstack"
24
- # ROOT: /Volumes/tools
23
+ ROOT: "${HOME}/Library/Application Support/pipe"
24
+ # ROOT: /Volumes/pipe
25
25
 
26
26
  linux:
27
27
  <<: *default
28
- ROOT: ${HOME}/.local/envstack
29
- # ROOT: /mnt/tools
28
+ ROOT: ${HOME}/.local/pipe
29
+ # ROOT: /mnt/pipe
30
30
 
31
31
  windows:
32
32
  <<: *default
33
- ROOT: C:/ProgramData/envstack
34
- # ROOT: //server/tools
33
+ ROOT: C:/ProgramData/pipe
34
+ # ROOT: //server/pipe
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes