Lightweight library to parse environment variables from shell, stdin or .env file in python.
Project description
Environment-Parser
A lightweight python library to parse environment variables from current shell or .env files.
Installation
Usage
Create a new environment parser from shell context.
from environment import Environment, SHELL
env = Environment(sources=[SHELL])
You can also create a new environment parser from variables starting with a given prefix.
For example, to find all variables starting with XDG_
, you could use the code below...
xdgenv = env.extract_child_from_prefix('XDG_', remove_prefix=True)
print(xdgenv)
... and this will output something like the following :
CONFIG_DIRS /etc/xdg/xdg-budgie-desktop:/etc/xdg
SESSION_PATH /org/freedesktop/DisplayManager/Session0
MENU_PREFIX gnome-
SESSION_DESKTOP budgie-desktop
SESSION_TYPE x11
GREETER_DATA_DIR /var/lib/lightdm-data/sylvan
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
Built Distribution
Close
Hashes for environment_parser-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c838134d3369a2fadd6b8a2d58c72338f27614c6e7c857a099d46857575ee916 |
|
MD5 | 989c482f101f7b18a9cf66ebe288c0d6 |
|
BLAKE2b-256 | 49d10d8b8b14c527a45d0f8a1f537268cc727f99c35c4fcd6de727aa6f618d02 |