Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: resolve uvx when using a git client or IDE #98

Merged
merged 2 commits into from
Sep 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 30 additions & 2 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,16 @@ integration *FLAGS:
uv run pytest tests -m integration {{FLAGS}}

format:
uvx ruff check . --fix
uvx ruff format .
#!/usr/bin/env bash
UVX_PATH="$(which uvx)"

if [ -z "$UVX_PATH" ]; then
echo "[error]: unable to find uvx"
exit 1
fi
eval "$UVX_PATH ruff format ."
eval "$UVX_PATH ruff check . --fix"


coverage *FLAGS:
uv run coverage run -m pytest tests -m "not integration" {{FLAGS}}
Expand All @@ -19,6 +27,26 @@ coverage *FLAGS:
docs:
uv sync && uv run mkdocs serve

install-hooks:
#!/usr/bin/env bash
HOOKS_DIR="$(git rev-parse --git-path hooks)"

if [ ! -d "$HOOKS_DIR" ]; then
mkdir -p "$HOOKS_DIR"
fi

cat > "$HOOKS_DIR/pre-commit" <<EOF
#!/usr/bin/env bash

just format
EOF

if [ ! -f "$HOOKS_DIR/pre-commit" ]; then
echo "[error]: failed to create pre-commit hook at $HOOKS_DIR/pre-commit"
exit 1
fi
echo "installed pre-commit hook to $HOOKS_DIR"
chmod +x "$HOOKS_DIR/pre-commit"

ai-exchange-version:
curl -s https://pypi.org/pypi/ai-exchange/json | jq -r .info.version
Expand Down