-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathinitial_setup.sh
More file actions
executable file
·69 lines (53 loc) · 2.14 KB
/
Copy pathinitial_setup.sh
File metadata and controls
executable file
·69 lines (53 loc) · 2.14 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/env bash
# Verify uv is installed and meets minimum version
MIN_UV_VERSION="0.11.8"
if ! command -v uv &> /dev/null; then
echo "ERROR: uv is not installed."
echo "Install uv: brew install uv"
echo " or: curl -LsSf https://astral.sh/uv/install.sh | sh"
exit 1
fi
CURRENT_UV_VERSION=$(uv --version | awk '{print $2}')
if [ "$(printf '%s\n' "$MIN_UV_VERSION" "$CURRENT_UV_VERSION" | sort -V | head -n1)" != "$MIN_UV_VERSION" ]; then
echo "ERROR: uv version $CURRENT_UV_VERSION is too old. Minimum required: $MIN_UV_VERSION"
echo "Upgrade with: uv self update"
echo " or: brew upgrade uv"
exit 1
fi
echo "Found uv $CURRENT_UV_VERSION, using uv for dependency management."
# The Debian VMs on GCP already have cmake and
# MacOS openssl is fussy, so we only run this
# on Macs.
if uname -a | grep --ignore-case darwin
then
echo "Running MacOS specific installation of cmake."
# Ensure openssl is linked properly
export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"
# Install cmake to avoid qdldl build error: 'RuntimeError: CMake must be
# installed to build qdldl'
brew install cmake
else
echo "Not running on MacOS. Skipping cmake install."
fi
# Add hooks
cp -R githooks/ .git/hooks/
chmod +x .git/hooks/*
# Set git blame to ignore noisy commits
git config blame.ignoreRevsFile .git-blame-ignore-revs
# Sync dependencies
echo "Syncing dependencies with uv..."
uv sync --all-extras
# Install pre-commit hooks
echo "Installing pre-commit hooks..."
uv run pre-commit install --overwrite
# Install pylint which is not currently managed by pyproject.toml
# There is a not easily-solved requirement conflict on `dill` between `apache-beam` and `pylint`
# More details can be found here: https://recidiviz.slack.com/archives/C028X32LRH7/p1701458677360479
# TODO(apache/beam#22893): This can be moved into pyproject.toml once Beam moves to cloudpickle or upgrades dill
echo "Installing pylint..."
uv pip install pylint --python .venv/bin/python
echo ""
echo "Setup complete!"
echo "You can run commands with: uv run <command>"
echo "Or activate the environment with: source .venv/bin/activate"