-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
35 lines (33 loc) · 1.37 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
35 lines (33 loc) · 1.37 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
# Pre-commit hooks for the Python SDK (packages/python-sdk).
#
# Opt-in. From the repo root:
# pip install -e "packages/python-sdk[dev]" # provides ruff + unasync
# pip install pre-commit && pre-commit install
#
# Hooks use the tools from that dev env (language: system), so versions match CI
# and there's no second ruff to drift. All hooks are scoped to packages/python-sdk
# — JS packages are untouched.
default_stages: [pre-commit]
repos:
- repo: local
hooks:
# Regenerate the sync client when the async source OR the generator itself
# changes, so you can't commit a stale _sync/ (CI checks this too, but later).
- id: py-sdk-generate-sync
name: regenerate sync client (python-sdk)
entry: python3 packages/python-sdk/scripts/generate_sync.py
language: system
pass_filenames: false
files: ^packages/python-sdk/(upstash_box/_async/.*\.py|scripts/generate_sync\.py)$
- id: py-sdk-ruff
name: ruff (python-sdk)
entry: ruff check --fix --config packages/python-sdk/pyproject.toml
language: system
types: [python]
files: ^packages/python-sdk/.*\.py$
- id: py-sdk-ruff-format
name: ruff format (python-sdk)
entry: ruff format --config packages/python-sdk/pyproject.toml
language: system
types: [python]
files: ^packages/python-sdk/.*\.py$