Read environment variables defined in a shell script into Python.
Project description
Read environment variables defined in a shell script into Python. This library uses the shell to get variable values, and handles multiline variables.
# Usage
Given a shell file: myvars.env:
`shell #!/bin/bash export VAR1=1 export VAR2="This is a multiline value" export VAR3=3 NOT_EXPORTED=4 `
## get_vars
`python >>> import shellvars >>> shellvars.get_vars('myvars.env') {'VAR1': '1', 'VAR2': 'This\nis\na\nmultiline value', 'VAR3': '3' } `
## list_vars Lists the variable names in the script. `python >>> import shellvars >>> shellvars.list_vars('myvars.env') ['VAR1', 'VAR2', 'VAR3'] `
This is equivalent to, but faster than `python >>> shellvars.get_vars('myvars.env').keys() `
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file shellvars-py-0.1.2.tar.gz
.
File metadata
- Download URL: shellvars-py-0.1.2.tar.gz
- Upload date:
- Size: 2.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
81d81e188129ad571ade763fa484522302eb78806b0eece4ed11b8115a295729
|
|
MD5 |
da7db78f751dd5d9ed1fabd53c0d376a
|
|
BLAKE2b-256 |
3a375f72c2aea402cd2dd1bf05c1eeee4fd089e22c51d279e0579f65f36faf44
|