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.9.tar.gz
(3.6 kB
view details)
Built Distribution
File details
Details for the file izienv-0.0.9.tar.gz
.
File metadata
- Download URL: izienv-0.0.9.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 | cb6c237fa4b8702e3c12182a00ecc05301621cd8c4d4b9b7a6e224cc54e42bc5 |
|
MD5 | f248b9ce36e3c8b8b619b2894f662957 |
|
BLAKE2b-256 | 222b697242d86d3b2f569e59477381a02fb283f8eae8a2d0cfa471fb7a01c70b |
File details
Details for the file izienv-0.0.9-py3-none-any.whl
.
File metadata
- Download URL: izienv-0.0.9-py3-none-any.whl
- Upload date:
- Size: 4.3 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 | 86c1e3781c7dd92c866e2b2f4f6c71fc6b124f349528faca3af1fb5f72fa867c |
|
MD5 | 09a48da3454fdc2668469d1cce3103d1 |
|
BLAKE2b-256 | c06efb0259871b16eacb1454a12c99bb80e2440665d6eea5664b3d5e432952fa |