A simple module to load environment variables from a .env file
Project description
dotvar, a Python module to load environment variables from a .env file
A simple Python module to load environment variables from a .env file.
Installation
pip install dotvar
Simple Usage
import dotvar
# Load environment variables from the nearest .env file
dotvar.load_env()
# Or specify the path to the .env file
dotvar.load_env(env_path="/path/to/your/.env")
A Detailed Example
import dotvar
# Load environment variables from the nearest .env file
dotvar.load_env()
# Now you can access the variables via os.environ
import os
database_url = os.environ.get("DATABASE_URL")
secret_key = os.environ.get("SECRET_KEY")
debug_mode = os.environ.get("DEBUG")
print(f"Database URL: {database_url}")
print(f"Secret Key: {secret_key}")
print(f"Debug Mode: {debug_mode}")
To Develop:
Description of Makefile Targets
- help: Displays available Makefile targets.
- install: Installs or upgrades the necessary packaging tools (
pip,setuptools,wheel, andtwine). - test: Runs the test suite using
unittest. - build: Builds the source and wheel distribution packages.
- clean: Removes build artifacts to ensure a clean state.
- upload: Uploads the built distribution packages to PyPI using
twine. This target depends on thebuildtarget.
Usage
To use the Makefile, open your terminal, navigate to your project directory (where the Makefile is located), and run the desired target. For example:
- To install dependencies:
make install - To run tests:
make test
- To build the package:
make build - To upload the package to PyPI:
make upload - To clean build artifacts:
make clean
License
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
dotvar-0.1.0.tar.gz
(3.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dotvar-0.1.0.tar.gz.
File metadata
- Download URL: dotvar-0.1.0.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.8.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6837477bef24376a37508923f7743c82759fdba299cc236af006f8d71d113ae9
|
|
| MD5 |
525a4d5834bf4782612df2332a240667
|
|
| BLAKE2b-256 |
f15af141f433b8685741737b496fa03409404bd34c46835de842f188d92a348c
|
File details
Details for the file dotvar-0.1.0-py3-none-any.whl.
File metadata
- Download URL: dotvar-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.8.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8841dbb0f8dc221d287605e461c7ddd93cb10ea767fc1dc750042e50c5439499
|
|
| MD5 |
7b13fb5efa83cc80dffa45c351521241
|
|
| BLAKE2b-256 |
103b0c09128652ba2bdb6ae3aed259f138faf91da839225707d1e3d707fc79f8
|