envirun
Load environment from file and run any program with this loaded environment.
This is useful if you want to easily run program with different environment, or troubleshoot systemd services which reads environment from /etc/default/ files.
Installation
pip3 install envirun
Example Usage
/tmp/x.sh:
#!/bin/sh
echo X: $X
echo $*
/tmp/x1.env: X=1
/tmp/x2.env: X=2
$ envirun.py /tmp/x1.env /tmp/x.sh some args
X: 1
some args
$ envirun.py /tmp/x2.env /tmp/x.sh some other args --foo --bar
X: 2
some other args --foo --bar
Source code
See environ.py, it's very simple. Main code is just three lines:
load_dotenv(dotenv_path=sys.argv[1], override=True)
rc = subprocess.run(sys.argv[2:])
sys.exit(rc.returncode)
More details
Environment files are loaded using dotenv load_dotenv(), overriding existing env variables. Environment lines may start with export. See dotenv documentation if you want more details.
See also similar project: envrun
How to achieve same result without envirun in bash (with few more commands):
$ set -a
$ . /tmp/x1.env # Load environment from /tmp/x1.env file
$ set +a
$ /tmp/x.sh some args
X: 1
some args
Metadata
Release files for envirun 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| envirun-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Release files / envirun-0.0.1-py3-none-any.whl
| Download URL | envirun-0.0.1-py3-none-any.whl |
|---|---|
| Size | 2.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
53b17ca531db751d130b9b147d3e5a482a60c93f259b13adda0722bb4e497886
|
|
BLAKE2b-256 checksum How to use checksums |
19daf30a876660e1a3126213c82d7351ca454873e85e47e1389191a9f6cc44b8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.2
|
Security for envirun 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.