Skip to main content

Read environment variables defined in a shell script into Python.

Project description

cmdvars

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:

#!/bin/bash
export VAR1=1
export VAR2="This
is
a
multiline value"
export VAR3=3
NOT_EXPORTED=4

get_vars

>>> 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.

>>> import shellvars
>>> shellvars.list_vars('myvars.env')
['VAR1', 'VAR2', 'VAR3']

This is equivalent to, but faster than

>>> shellvars.get_vars('myvars.env').keys()

Project details


Download files

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

Source Distribution

cmdvars-0.1.3.tar.gz (19.0 kB view details)

Uploaded Source

Built Distribution

cmdvars-0.1.3-py2.py3-none-any.whl (5.0 kB view details)

Uploaded Python 2Python 3

File details

Details for the file cmdvars-0.1.3.tar.gz.

File metadata

  • Download URL: cmdvars-0.1.3.tar.gz
  • Upload date:
  • Size: 19.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for cmdvars-0.1.3.tar.gz
Algorithm Hash digest
SHA256 97a14000d66eccf51c30fefa6241eadae825390d5f4d4420f0ada1a5a429e5b1
MD5 f93aa658df394cd938393f4718285bdc
BLAKE2b-256 84c0ff5d9364e11d46c10e67bcde69ab1918ab09cea5c1c2480936bdd7d1e39c

See more details on using hashes here.

File details

Details for the file cmdvars-0.1.3-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for cmdvars-0.1.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 99f1da66c5d1beae73b933f841d95fc59cb78884a4e14f5fdec4f03bdc6c5be9
MD5 544aae86b28c497d3e4e542d00d94448
BLAKE2b-256 c462947f816007282854f69b6a5cd000bfc1edd29957dadc43fbd23591d305fd

See more details on using hashes here.

Supported by

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