Python package to handle multiple files with environment variables.
Project description
Python package to handle multiple files with environment variables.
- TODO: Ver si puedo instalarlo en global para manejar las variables dentro de arch.
Quickstart
- Crear folder
.envs/
en la raiz del proyecto.
cd /path/to/project
mkdir -p .envs
touch .envs/name_env.env
- Editar las variables de entorno, deberán llamarse
{NAME_ENV}_{VAR}
.
SIMPLE_VAR=my_cats_are_beautiful
NAME_ENV_VAR_1=my_var_1
NAME_ENV_VAR_2=my_var_2
from izienv import BaseEnv, load_env_var, load_izienv
class MyEnv(BaseEnv):
@property
@load_env_var()
def SIMPLE_VAR(self) -> str:
return "SIMPLE_VAR"
@property
@load_env_var(name_pre=True) # Set name_pre to add the `NAME_ENV` to the variable.
def VAR_1(self) -> str:
return "VAR_1"
@property
@load_env_var(name_pre=True) # Set name_pre to add the `NAME_ENV` to the variable.
def VAR_2(self) -> str:
return "VAR_2"
NAME = 'name_env'
load_izienv(name=NAME, path_envs=Path(".envs"))
# You need .envs/ folder with envs. Or set `path_envs`.
env = MyEnv(name=NAME)
print(env.SIMPLE_VAR)
print(env.VAR_1)
print(env.VAR_2)
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
izienv-0.0.8.tar.gz
(3.6 kB
view details)
Built Distribution
File details
Details for the file izienv-0.0.8.tar.gz
.
File metadata
- Download URL: izienv-0.0.8.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | eefa880b49e40acda081c0fbbaac30202fcc1dec031bb0e2297c90b17431d298 |
|
MD5 | 1e9bebdbbd47565c9502dc9fbe37268c |
|
BLAKE2b-256 | 49f4ff3b11e85b3774c5637302ccf21efaf631ea0baf6771104ed17aec6b41c4 |
File details
Details for the file izienv-0.0.8-py3-none-any.whl
.
File metadata
- Download URL: izienv-0.0.8-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ca16f1de89f48b60fafd101a506f8e467500e325438cd757af6409a9570b066d |
|
MD5 | 64850d4282655ca7176645147272b0e0 |
|
BLAKE2b-256 | d15f476683328cf85ea1d98a6a7197161a3edcb4ca47d0bacec7b943ce5bf9ea |