PY.Env
Import environment variables from your .env file or run as command line tool; PyDotEnv Cli.
- Python 2 & 3
- Command line tool
How to use
pip install pydotenvs
or
git clone https://github.com/ableinc/pyenv.git
cd pyenv
pip install --upgrade .
Now import into any python project you have
from pydotenvs import load_env
load_env()
or
load_env('.myEnvFile')
or
envObj = load_env_object()
envObj['myEnv']
That's it!
Test
Run this to see a working example
python example/demo.py
StringIO
You can load your local .env file as a StringIO object. By default you are responsible for closing the StringIO object. Though, There is an option to auto close upon program termination.
from pydotenvs import load_env
stringObj = load_env(stringIO = True, auto_close = True)
contents = stringObj.getvalue()
Command Line Tool - CLI
You can use PyEnv as a command line tool. All the same features apply. It would be common to use the client tool for the Dictionary & StringIO features of PyEnv.
You can run a command that requires your local environment variables with PyEnv command line tool. Your variables will only exist in that one instance.
pyenv --command 'echo $MY_VARIABLE'
Usage: pyenv [OPTIONS]
Options:
-f, --envpath PATH Location of .env file, defaults to .env in current
working directory [required]
-c, --command TEXT Run a command that requires local enviornment
variables for one instance
-l, --loadobj BOOLEAN Load .env file as object instead of environment
variable
-s, --stringio BOOLEAN Load .env file as StringIO object instead of
environment variable
-v, --verbose BOOLEAN Verbose
--version Show the version and exit.
--help Show this message and exit.
Metadata
Release files for pydotenvs 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pydotenvs-0.1.3.tar.gz | 3.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pydotenvs-0.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.8 kB
Release files / pydotenvs-0.1.3.tar.gz
| Download URL | pydotenvs-0.1.3.tar.gz |
|---|---|
| Size | 3.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
16872c1f7873e3bcaafd77ec783ce32beaac60a0eae4843fec08015312116484
|
|
BLAKE2b-256 checksum How to use checksums |
ea7268c1de5ed1381f65057f7985646241e94b5ec1ef1dad3d420441503639fa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.8
|
Release files / pydotenvs-0.1.3-py3-none-any.whl
| Download URL | pydotenvs-0.1.3-py3-none-any.whl |
|---|---|
| Size | 5.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
12736a46c020f31fc86197ab1f688c2aeac3a6040f0ef91ca2686b40791fb9e6
|
|
BLAKE2b-256 checksum How to use checksums |
6c02c4cb82daac154be13a6dc263381f77f1cf988447439a9a9275012eba0060
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.8
|