Skip to content
Merged
Show file tree
Hide file tree
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
24 changes: 12 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,21 +64,21 @@ jobs:

- uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: ~/.cache/pre-commit
path: ~/.cache/prek
key: cache-epoch-1|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml', 'uv.lock') }}

- name: Install pre-commit
run: pre-commit install-hooks
- name: Install prek
run: .venv/bin/prek prepare-hooks

- name: Run pre-commit
- name: Run prek
run: |
if [ "${{ github.event_name }}" = "push" ]; then
# On main branch, run on all files to catch any formatting drift
pre-commit run --all-files
.venv/bin/prek run --all-files
else
# On PRs, run only on changed files
jq '.[]' --raw-output <<< '${{steps.changes.outputs.all_files}}' |
xargs pre-commit run --files
xargs .venv/bin/prek run --files
fi

python-client-lint:
Expand All @@ -98,7 +98,7 @@ jobs:

- name: Skip if no Python client changes
if: steps.changes.outputs.python != 'true'
run: echo "No Python client files changed, skipping pre-commit checks"
run: echo "No Python client files changed, skipping prek checks"

- uses: astral-sh/setup-uv@5a7eac68fb9809dea845d802897dc5c723910fa3 # v7.1.3
if: steps.changes.outputs.python == 'true'
Expand All @@ -115,18 +115,18 @@ jobs:
- uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
if: steps.changes.outputs.python == 'true'
with:
path: ~/.cache/pre-commit
path: ~/.cache/prek
key: cache-epoch-1|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml', 'uv.lock') }}

- name: Install pre-commit
- name: Install prek
if: steps.changes.outputs.python == 'true'
run: pre-commit install-hooks
run: .venv/bin/prek prepare-hooks

- name: Run pre-commit on Python client files
- name: Run prek on Python client files
if: steps.changes.outputs.python == 'true'
run: |
jq '.[]' --raw-output <<< '${{steps.changes.outputs.python_files}}' |
xargs pre-commit run --files
xargs .venv/bin/prek run --files

python-client-test:
name: Python Client Tests
Expand Down
3 changes: 1 addition & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
- repo: builtin
hooks:
- id: check-case-conflict
- id: check-executables-have-shebangs
Expand Down
2 changes: 1 addition & 1 deletion clients/python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ dev = [
"devservices>=1.2.1",
"sentry-devenv>=1.22.2",
"black==26.10.1",
"pre-commit>=4.2.0",
"prek>=0.5.10",
"pytest>=8.3.3",
"pytest-cov>=4.0.0",
"flake8>=7.3.0",
Expand Down
4 changes: 2 additions & 2 deletions devenv/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def main(context: dict[str, str]) -> int:
),
)

print("installing pre-commit hooks ...")
proc.run((f"{reporoot}/.venv/bin/pre-commit", "install", "--install-hooks"))
print("installing prek hooks ...")
proc.run((f"{reporoot}/.venv/bin/prek", "install", "--prepare-hooks", "-f"))

return 0
2 changes: 1 addition & 1 deletion integration_tests/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ version = "0.0.0"
dev = [
"black==26.10.1",
"devservices>=1.2.1",
"pre-commit>=4.2.0",
"prek>=0.5.10",
"pytest>=8.3.3",
"sentry-devenv>=1.22.2",
"confluent_kafka>=2.3.0",
Expand Down
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ requires-python = ">=3.11"
dev = [
"black==26.10.1",
"devservices>=1.2.1",
"pre-commit>=4.2.0",
"prek>=0.5.10",
"pytest>=9.0.3",
"sentry-devenv>=1.22.2",
"confluent_kafka>=2.3.0",
Expand All @@ -29,6 +29,9 @@ dev = [
[tool.uv]
environments = ["sys_platform == 'darwin' or sys_platform == 'linux'"]

[tool.uv.sources]
prek = { index = "sfw" }

[[tool.uv.index]]
name = "sentry-pypi"
url = "https://pypi.devinfra.sentry.io/simple"
Expand Down
87 changes: 17 additions & 70 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading