-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add direnv configuration for virtual environment management
Add a new `.config/direnv/direnvrc` file with functions `layout_uv_venv` and `layout_uv` to automate virtual environment setup using `uv`. Include the `~/.config/direnv` directory in `install.conf.yaml` to ensure the configuration is linked during setup. These changes simplify virtual environment management and improve developer workflow by automating environment activation and setup. Signed-off-by: Marcelo Borges <me@marceloborges.dev>
- Loading branch information
1 parent
24ef9a8
commit 3547d39
Showing
2 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
layout_uv_venv() { | ||
if [[ -d ".venv" ]]; then | ||
VIRTUAL_ENV="$(pwd)/.venv" | ||
fi | ||
|
||
if [[ -z $VIRTUAL_ENV || ! -d $VIRTUAL_ENV ]]; then | ||
log_status "No virtual environment exists. Executing \`uv venv\` to create one." | ||
uv venv | ||
VIRTUAL_ENV="$(pwd)/.venv" | ||
fi | ||
|
||
PATH_add "$VIRTUAL_ENV/bin" | ||
export UV_ACTIVE=1 # or VENV_ACTIVE=1 | ||
export VIRTUAL_ENV | ||
} | ||
|
||
layout_uv() { | ||
if [[ -d ".venv" ]]; then | ||
VIRTUAL_ENV="$(pwd)/.venv" | ||
fi | ||
|
||
if [[ -z $VIRTUAL_ENV || ! -d $VIRTUAL_ENV ]]; then | ||
log_status "No uv project exists. Executing \`uv init\` to create one." | ||
uv init --no-readme | ||
rm hello.py | ||
uv venv | ||
VIRTUAL_ENV="$(pwd)/.venv" | ||
fi | ||
|
||
PATH_add "$VIRTUAL_ENV/bin" | ||
export UV_ACTIVE=1 # or VENV_ACTIVE=1 | ||
export VIRTUAL_ENV | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters