forked from netbox-community/Device-Type-Library-Import
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy path.envrc.example
More file actions
34 lines (30 loc) · 1.07 KB
/
.envrc.example
File metadata and controls
34 lines (30 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# direnv configuration — copy to .envrc and run `direnv allow` to enable.
#
# Review this file before enabling. It ONLY:
# 1. Loads secrets from .env (NETBOX_URL, NETBOX_TOKEN, etc.) into the shell
# 2. Creates a uv virtual environment if one does not exist
# 3. Syncs Python dependencies via `uv sync`
#
# Prerequisites: direnv (https://direnv.net) and uv (https://docs.astral.sh/uv/)
# Source .env file if it exists (contains secrets, not in git)
if [[ -f .env ]]; then
log_status "Loading .env variables..."
dotenv .env
fi
# Create and activate uv virtual environment
if command -v uv &> /dev/null; then
# Create venv if it doesn't exist
if [[ ! -d .venv ]]; then
log_status "Creating virtual environment with uv..."
uv venv .venv
fi
# Sync dependencies
if [[ -f pyproject.toml ]]; then
log_status "Syncing dependencies with uv..."
uv sync --quiet --native-tls
fi
# Activate the virtual environment
source .venv/bin/activate
else
log_error "uv not found. Please install uv: https://docs.astral.sh/uv/"
fi