pysetenv
pysetenv is a simple Python-based program to allow users to set environment variables before executing a command, similar to the POSIX `env <https://pubs.opengroup.org/onlinepubs/9699919799/utilities/env.html>`__ command.
Why?
pysetenv is designed as a support package to help authors of other Python packages create command-line strings like you’d expect from sh or the env command. Generally, pysetenv will only be installed on Windows systems, with POSIX systems using sh or env. For example, in your setup.py, you would write:
setup(
# ...
install_requires=['pysetenv;platform_system=="Windows"'],
)
Then somewhere in your code, you could call pysetenv:
subprocess.call(['pysetenv', ...])
Command-line reference
Usage: pysetenv [OPTION]... [NAME=VALUE]... [--] [COMMAND [ARG]...]
pysetenv supports a subset of common options available to various implementations of env. It executes COMMAND with any supplied arguments (ARG) after modifying the environment as specified by the previous arguments. Any arguments of the form NAME=VALUE will set an environment variable NAME to the value of VALUE. If COMMAND is not specified, pysetenv will print the resulting environment instead.
In addition, the following options are supported:
-i: Ignore any environment variables inherited by this process
-u NAME: Unset the environment variable NAME
-h, --help: Show a help message and exit
--version: Show the current version and exit
As an extension to the env command, the options above and the variable definitions can be separated from the section for defining the command to run with --:
pysetenv -uFOO BAR=value -- echo hello
License
This project is licensed under the BSD 3-clause license.
Metadata
Release files for pysetenv 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pysetenv-1.0.1.tar.gz | 4.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pysetenv-1.0.1-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 9.3 kB
Release files / pysetenv-1.0.1.tar.gz
| Download URL | pysetenv-1.0.1.tar.gz |
|---|---|
| Size | 4.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
381a3e52e550e22618cbb8fffa889fcb9bbf2bf079e0a055c0eb03c9d8431580
|
|
BLAKE2b-256 checksum How to use checksums |
07347fa97b0f9bf13cdcc756c0c5a93dc8967b4c0a5b75873adb93d731af0273
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.41.0 CPython/2.7.15rc1
|
Release files / pysetenv-1.0.1-py2.py3-none-any.whl
| Download URL | pysetenv-1.0.1-py2.py3-none-any.whl |
|---|---|
| Size | 4.4 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
d77afb3d53927bff0b8385ccfcf79db60ab024625582a5d5e221462e5029f927
|
|
BLAKE2b-256 checksum How to use checksums |
fc25b294313d1d4245065a51d7a8878cbffbb801b842a2fe475e915378e85017
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.41.0 CPython/2.7.15rc1
|