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_SOME_STRING=my_var_1
NAME_ENV_SOME_PATH=/path/to/data
from izienv import BaseEnv, load_env_var, load_izienv
class MyEnv(BaseEnv):
@property
@load_env_var_str()
def SIMPLE_VAR(self) -> str:
return "SIMPLE_VAR"
@property
@load_env_var_str(name_left=True) # Set name_left to add the `NAME_ENV` to the variable.
def SOME_STRING(self) -> str:
return "SOME_STRING"
@property
@load_env_var_path(name_left=True) # Set name_left to add the `NAME_ENV` to the variable.
def SOME_PATH(self) -> str:
return "SOME_PATH"
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.SOME_STRING)
print(env.SOME_PATH)
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.1.2.tar.gz
(3.7 kB
view details)
Built Distribution
File details
Details for the file izienv-0.1.2.tar.gz
.
File metadata
- Download URL: izienv-0.1.2.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | abe0961463964d926c3191ad08078ed39f2093355caef55ed499f6637dffab54 |
|
MD5 | 34e18161303e43ba5e3392db95ebac96 |
|
BLAKE2b-256 | 1fa0d5be5a8738b591e1ca7b301512d39c4213550c7770123de9ccfb00d806ce |
File details
Details for the file izienv-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: izienv-0.1.2-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 | 900d927034082548bc25e7c5926ccc741ea3120328cebf23bf03b02a3765e40c |
|
MD5 | 895b08a69ea19e9b1a2f906a08183a84 |
|
BLAKE2b-256 | 3301a8e7c3648b9f30ecdd50307796fbcab1a0f68aa2373bb02d2aef20d9aecc |