Skip to content

Commit

Permalink
Add direnv (#314)
Browse files Browse the repository at this point in the history
  • Loading branch information
araa47 authored Jul 10, 2024
1 parent 9a5a16a commit 95e1325
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
set -e

# Ensure pyenv is initialized
if command -v pyenv >/dev/null; then
eval "$(pyenv init -)"
fi
# Set the local Python version
if ! pyenv local $(cat .python-version); then
log_error "Failed to activate pyenv version $(cat .python-version)."
log_error "Please ensure pyenv works and has the required python version:"
log_error "# pyenv install $(cat .python-version) && direnv allow"
exit 1
fi
# Create a virtual environment if it doesn't exist
if [ ! -d ".venv" ]; then
python -m venv .venv
echo "Created virtual environment in .venv"
fi
# Activate the virtual environment
source .venv/bin/activate
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,4 @@ geckodriver.log
voxometadata/secrets
# Env vars
.env
.venv
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.8.12

0 comments on commit 95e1325

Please sign in to comment.