No project description provided
Project description
Python Environment Variable Helper
This Python package provides an easy way to interact with environment variables in your Python applications. It is designed to simplify the process of loading and parsing various data types from environment variables.
Features
- Auto load environment variables from .env files based on application environment (
devortest). - Provide easy-to-use functions to access environment variables with type hinting.
- Support different data types including strings, lists, dictionaries, integers and booleans.
- Allow defaults for environment variables.
- Provide decorator
@depends_on_envfor user-defined functions to ensure environment variables are loaded.
Installation
Install the package from PyPi using pip:
pip install envutil
Usage
Import the package in your Python code as follows:
from envutil import env_str, env_csv, env_int, env_bool, env_list, env_dict
Access your environment variables:
# Access string variable
my_var = env_str('MY_VAR', default='default-value')
# Access comma separated value as a list
my_csv = env_csv('MY_CSV', default=[])
# Access integer variable
my_int = env_int('MY_INT', default=0)
# Access boolean variable
my_bool = env_bool('MY_BOOL', default=False)
# Access list variable
my_list = env_list('MY_LIST', default=[])
# Access dictionary variable
my_dict = env_dict('MY_DICT', default={})
Environment Configuration
By default, this package loads .env file. If the APP_ENV is set to test, it will load .env.test file. You can also specify a custom environment file by setting the APP_ENV_FILE environment variable.
Contributing
Your contributions are always welcome! Please have a look at the contribution guidelines first. 🎉
License
This package is released under the MIT License.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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 envutil-0.2.4.tar.gz.
File metadata
- Download URL: envutil-0.2.4.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.2 CPython/3.10.9 Darwin/22.5.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a1dcd2b2b73b875627a5114066bc3051fdac6a4ad026345f6259b94e99b8a80f
|
|
| MD5 |
1944d3ed6dcc52e79db3a666d1da45ed
|
|
| BLAKE2b-256 |
eddba4597c96ae83c16d6bac86f5cca8d9b78dcb647698e51fafb1189caa79ae
|
File details
Details for the file envutil-0.2.4-py3-none-any.whl.
File metadata
- Download URL: envutil-0.2.4-py3-none-any.whl
- Upload date:
- Size: 3.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.2 CPython/3.10.9 Darwin/22.5.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
60a9feccbaf50841a99baecd38c35e3330a2e63ae7cf62a490b1e4038e5b01a9
|
|
| MD5 |
c4fb52fb2e0217487b14dedd739f5689
|
|
| BLAKE2b-256 |
5ff349a530c7cf570300e1f36c6053afccc4580eec1b51809fbee59d01e70a14
|