Skip to content

Commit 7c7fadf

Browse files
author
codegen-bot
committed
Setup pre-commit
1 parent b9c09c9 commit 7c7fadf

File tree

5 files changed

+1043
-16
lines changed

5 files changed

+1043
-16
lines changed

.github/actions/setup/action.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: "Setup"
2+
description: "Setup tools for run"
3+
4+
runs:
5+
using: "composite"
6+
steps:
7+
8+
- name: Install UV
9+
uses: astral-sh/setup-uv@v5
10+
id: setup-uv
11+
with:
12+
enable-cache: false
13+
prune-cache: true
14+
version: '0.5.21'
15+
cache-dependency-glob: '**/uv.lock'
16+
17+
- name: Install dependencies
18+
shell: bash
19+
run: |
20+
uv sync --frozen

.github/workflows/pre-commit.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: pre-commit
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- "main"
7+
8+
jobs:
9+
pre-commit:
10+
# changing the following value will significantly affect github's billing. Be careful and consult with the team before changing it.
11+
runs-on: ubuntu-latest
12+
timeout-minutes: 10
13+
14+
steps:
15+
- name: Check out the repo
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
repository: ${{ github.event.pull_request.head.repo.full_name }}
20+
ref: ${{ github.event.pull_request.head.ref }}
21+
22+
- name: Setup backend
23+
id: setup
24+
uses: ./.github/actions/setup
25+
26+
- name: Setup-pre-commit
27+
run: uv tool install pre-commit --with pre-commit-uv --force-reinstall
28+
29+
- uses: actions/cache@v4
30+
with:
31+
path: |
32+
~/.cache/pre-commit
33+
~/.cache/uv
34+
key: pre-commit-3|${{ env.pythonLocation }}|${{ hashFiles('\.pre-commit-config.yaml') }}
35+
36+
- name: Run pre-commit
37+
run: uv run --frozen pre-commit run --show-diff-on-failure --color=always --all-files --source ${{ github.event.pull_request.base.sha }} --origin ${{ github.event.pull_request.head.sha }} --show-diff-on-failure --color=always
38+
shell: bash
39+
40+
- uses: stefanzweifel/git-auto-commit-action@v5
41+
# Always commit changes even if pre-commit failed
42+
if: always()
43+
with:
44+
commit_message: "Automated pre-commit update"

.pre-commit-config.yaml

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -48,26 +48,16 @@ repos:
4848
- id: codespell
4949
additional_dependencies:
5050
- tomli
51-
files: "docs/.*/.*.mdx"
51+
files: ".*"
5252

5353
- repo: https://github.com/fpgmaas/deptry.git
5454
rev: "0.23.0"
5555
hooks:
5656
- id: deptry
5757
pass_filenames: false
5858
always_run: true
59-
entry: bash -c "uv run --frozen --all-extras --dev deptry src --ignore DEP001"
60-
- repo: "local"
61-
hooks:
62-
- id: disallowed-words-check
63-
name: Check for disallowed words
64-
entry: scripts/disallowed-words-check.sh
65-
language: script
66-
files: '' # Check all files
67-
- repo: https://github.com/renovatebot/pre-commit-hooks
68-
rev: 39.120.4
69-
hooks:
70-
- id: renovate-config-validator
59+
entry: bash -c "uv run --frozen --all-extras --dev deptry . --ignore DEP001"
60+
7161
- repo: https://github.com/astral-sh/uv-pre-commit
7262
rev: "0.5.24"
7363
hooks:

pyproject.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ version = "0.0.0"
44
readme = "README.md"
55
requires-python = ">=3.12, <3.14"
66
dependencies = [
7-
"codegen==0.5.3"
7+
"codegen==0.5.3",
88
]
99
license = {file = "LICENSE"}
1010
classifiers = [
@@ -28,10 +28,13 @@ dev-dependencies = [
2828
"pre-commit>=4.0.1",
2929
"pre-commit-uv>=4.1.4",
3030
"uv>=0.4.25",
31+
"jupyterlab==4.3.4",
3132
]
3233

3334
[tool.pre-commit-uv]
34-
cache-keys = [{ git = { commit = true, tags = true } }]
3535
requirements = [
3636
"strict-requirements",
3737
]
38+
39+
[tool.deptry]
40+
package_module_name_map.codegen = "codegen"

0 commit comments

Comments
 (0)