Skip to main content

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 dotenv 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 test.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.

stringObj = load_env(stringIO = True, auto_close = True)
contents = stringObj.getvalue()

Command Line Tool

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
  -i, --ignore BOOLEAN    Ignore special characters in variable values
  --version               Show the version and exit.
  --help                  Show this message and exit.

Metadata

Release files for pydotenvs 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pydotenvs 0.1.1
File Size Uploaded Provenance Actions
pydotenvs-0.1.1.tar.gz 3.6 kB Without provenance Details for pydotenvs-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pydotenvs 0.1.1
File Interpreter ABI Platform Actions
pydotenvs-0.1.1-py3-none-any.whl Python 3 none any Details for pydotenvs-0.1.1-py3-none-any.whl

Total release size: 8.9 kB

Release files / pydotenvs-0.1.1.tar.gz

Download URL pydotenvs-0.1.1.tar.gz
Size 3.6 kB
Tags Source
SHA-256 checksum
How to use checksums
564711d776a82bf4626ff989f53bf8930a019d336594df0498c00aef15682559
BLAKE2b-256 checksum
How to use checksums
47ba063448f0c86838d25f5f958d9dfa7c3afb0e125a68f94c68b5f8204e101a
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.1-py3-none-any.whl

Download URL pydotenvs-0.1.1-py3-none-any.whl
Size 5.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8a80d038b51a244d34a47e5b4449514d1eb7e9c13d71a195573d935e7e0d1a94
BLAKE2b-256 checksum
How to use checksums
1bd4285f2377c5bb0fb17001c2916c8c043501d95cfa9990d9e0d4baa3687858
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

Security for pydotenvs 0.1.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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page