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.1.tar.gz
(3.7 kB
view details)
Built Distribution
File details
Details for the file izienv-0.1.1.tar.gz
.
File metadata
- Download URL: izienv-0.1.1.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 | 8bc954f62bf06cab99c706b793a2fed9aa396ba524c30202472de3121546d513 |
|
MD5 | 5d1856fc2b5228089e834bc5e19f70d6 |
|
BLAKE2b-256 | d5babeb28e8a8b7f967d1b2b70dcc87420723498f3cea3c6a4cf7f6123ad5baf |
File details
Details for the file izienv-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: izienv-0.1.1-py3-none-any.whl
- Upload date:
- Size: 4.4 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 | 0f0f028c68d5f810e0b02b5b6375b0a4d58f26cdfceaf0acb1dd5c2d01bcd347 |
|
MD5 | 2ed6ceb6ae0d1d02f01ee1ecba8593d9 |
|
BLAKE2b-256 | ec633ab03e1e644c82c826745dfed96f6bfdf270a88ed9bc18c29d15e9e9a58d |