# pyconfigvar
Manage required and optional environment variables in your Python scripts.
## Example
`sh $ REQUIRED_VAR="something" python `
`python >>> import pyconfigvar >>> pyconfigvar.requiredvar('REQUIRED_VAR') 'something' >>> pyconfigvar.requiredvar('MISSING_VAR') >>> pyconfigvar.requiredvar('MISSING_VAR') MISSING_VAR was not supplied in the environment. <drop back to shell> `
## Usage
There are four functions available:
### requiredvar(var)
Returns the contents of the environment variable var. If var is not present in the environment, sys.exit() is invoked to terminate the interpreter.
### optionalvar(var, default)
Like requiredvar(), but instead of terminating, default is returned.
### requiredbool(var)
Like requiredvar(), but will coerce the value of var into a boolean and return that. Essentially, anything non-zero or non-empty will return True, otherwise it will return False.
### optionalbool(var, default)
Like requiredbool(), but will return default rather than terminate the interpreter.
## Contributing
Pull request away!
Metadata
Release files for pyconfigvar 1.0.0
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 | Actions Reset |
|---|---|---|---|---|
| pyconfigvar-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for pyconfigvar-1.0.0-py3-none-any.whl |
Release files / pyconfigvar-1.0.0-py3-none-any.whl
| Download URL | pyconfigvar-1.0.0-py3-none-any.whl |
|---|---|
| Size | 3.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
43e7b373903ca3e464ca6efaea8eb2131eb26f2a1c4f7254c15e5795c653ed1e
|
|
BLAKE2b-256 checksum How to use checksums |
f158680633a8d2f54a28189f24d3bcfaaa234f998c9b922371469c5a5a81ba4d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for pyconfigvar 1.0.0
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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.