bidict/init_dev_env

31 lines
911 B
Bash
Executable File

#!/usr/bin/env bash
#
# Copyright 2009-2024 Joshua Bronson. All rights reserved.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# shellcheck disable=SC1091
set -euo pipefail
declare -r hint="Hint: Use 'nix develop' to bootstrap a development environment"
source "$BIDICT_ROOT_DIR/dev-deps/dev.env"
for cmd in uv pre-commit "$DEFAULT_PY"; do
if ! type "$cmd"; then
>&2 echo "Error: No '$cmd' on PATH. $hint"
exit 1
fi
done
pre-commit install -f
test -d "$VENV_DIR" || uv venv --python="$DEFAULT_PY" "$VENV_DIR"
uv pip sync dev-deps/*.txt
uv pip show -q bidict || uv pip install -e "$BIDICT_ROOT_DIR"
echo "Development virtualenv initialized: $VENV_DIR"
echo "To activate, run: source $VENV_DIR/bin/activate (or equivalent for your shell)"