Skip to content

Added uv sync to git pre-commit hook script.#857

Merged
terrycojones merged 2 commits intoacorg:masterfrom
terrycojones:uv-lock
Apr 9, 2026
Merged

Added uv sync to git pre-commit hook script.#857
terrycojones merged 2 commits intoacorg:masterfrom
terrycojones:uv-lock

Conversation

@terrycojones
Copy link
Copy Markdown
Member

No description provided.

@terrycojones terrycojones requested a review from imLew April 9, 2026 13:34
Copy link
Copy Markdown
Collaborator

@imLew imLew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, but could be optimized, see comments.

Comment thread bin/pre-commit.sh Outdated
if command -v uv >/dev/null
then
uv run ruff check --fix --extend-select I $FILES > $tmp 2>&1
uv sync
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need to run uv sync because uv run will have updated the lockfile already.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

Comment thread bin/pre-commit.sh
Comment on lines +24 to +25
if test uv.lock -nt $tmp
then
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is kinda neat

Comment thread bin/pre-commit.sh
@@ -17,6 +19,12 @@ FILES=$(git diff-index --cached --name-status HEAD | egrep -v '^D' | egrep '\.py
if command -v uv >/dev/null
then
uv run ruff check --fix --extend-select I $FILES > $tmp 2>&1
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could use uv run --locked, which will fail if the lock file is not up to date.
https://docs.astral.sh/uv/concepts/projects/sync/

@terrycojones terrycojones merged commit e98e85b into acorg:master Apr 9, 2026
3 checks passed
@terrycojones terrycojones deleted the uv-lock branch April 9, 2026 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants