Project level environment variable management utility.
Project description
Envidia
Envidia is a command-line interface (CLI) tool for loading project-level environment variables and simplifying the setting of long environment variables with aliases.
Table of Contents
Install
To install Envidia, use pip:
pip install envidia
Features
1. Loading .env from a directory
Envidia allows you to load environment variables from a directory, replacing long and verbose declarations with simple commands.
2. Set Environment Variables via Alias
Setting environment variables manually can be cumbersome. Envidia provides a convenient way to set them via alias.
❌: export CUDA_VISIBLE_DEVICES="0"
✅: source <(e --cuda 0) or simply es --cuda 0 if you have eval $(envidia install) in your .bashrc or .zshrc.
Put the following line in your .bashrc or .zshrc:
eval "$(envidia install --alias es)"
Specify which option is related to which environment variable in env.d/bootstrap.py:
from envidia import register_option
register_option("cuda", "CUDA_VISIBLE_DEVICES", default="0")
Use es to set environment variables specified in env.d. ( es is short for "env set").
3. Integration with Cookiecutter
Pack your project environment variables as a cookiecutter template to reuse them across different projects.
4. Pre-load and Post-load Hooks
Use hooks to verify path variables or add extra variables into the environment.
# env.d/bootstrap.py
from pathlib import Path
from envidia import Loader, register_option
register_option("cuda", "CUDA_VISIBLE_DEVICES", default="0")
register_option("foo", "FOO_PATH", default=".")
def pre_load(loader: Loader):
# add extra variable into the environment
# if hf_transfer is installed, set HF_TRANSFER=1
if is_package_installed("hf_transfer"):
loader.env_registry["HF_TRANSFER"] = "1"
else:
loader.env_registry["HF_TRANSFER"] = "0"
def post_load(loader: Loader):
# validate a path must exist
if not Path(loader.env_registry.get("FOO_PATH", "")).exists():
raise RuntimeError("FOO_PATH must exist")
License
This project is licensed under the MIT License - see the LICENSE file for details.
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 envidia-0.1.1.tar.gz.
File metadata
- Download URL: envidia-0.1.1.tar.gz
- Upload date:
- Size: 211.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef7e103839e64e671cf49265867d9b999762fe0bf42eb58023240e01bc5e92b9
|
|
| MD5 |
221c51ae7e3060a7fae2bda8bd08f697
|
|
| BLAKE2b-256 |
c12f91c4782c55263466c89d5717a87f1074b4caa45f57e785f9a4bbcf49e9a5
|
Provenance
The following attestation bundles were made for envidia-0.1.1.tar.gz:
Publisher:
release.yml on fkcptlst/envidia
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
envidia-0.1.1.tar.gz -
Subject digest:
ef7e103839e64e671cf49265867d9b999762fe0bf42eb58023240e01bc5e92b9 - Sigstore transparency entry: 190069493
- Sigstore integration time:
-
Permalink:
fkcptlst/envidia@9dcc2f896ac43c65560a083e671ee33735fa4709 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/fkcptlst
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@9dcc2f896ac43c65560a083e671ee33735fa4709 -
Trigger Event:
release
-
Statement type:
File details
Details for the file envidia-0.1.1-py3-none-any.whl.
File metadata
- Download URL: envidia-0.1.1-py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
97a9e294d6d48ab8d390cb4480b656f46bd63cf88265ce2d39a4c2ae215acd05
|
|
| MD5 |
af837754e13abc05abd94d424517b3f9
|
|
| BLAKE2b-256 |
ca2f18fa1c6d062d00ac836caaf503cba2c75ba36d9c7d8065eec70a8cd79d89
|
Provenance
The following attestation bundles were made for envidia-0.1.1-py3-none-any.whl:
Publisher:
release.yml on fkcptlst/envidia
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
envidia-0.1.1-py3-none-any.whl -
Subject digest:
97a9e294d6d48ab8d390cb4480b656f46bd63cf88265ce2d39a4c2ae215acd05 - Sigstore transparency entry: 190069495
- Sigstore integration time:
-
Permalink:
fkcptlst/envidia@9dcc2f896ac43c65560a083e671ee33735fa4709 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/fkcptlst
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@9dcc2f896ac43c65560a083e671ee33735fa4709 -
Trigger Event:
release
-
Statement type: