Skip to content

Commit c7ceb2a

Browse files
authored
Use --github--pull-request--pre-commit (#169)
1 parent 1c8d5f6 commit c7ceb2a

10 files changed

Lines changed: 103 additions & 102 deletions

File tree

.bumpversion.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99
search = "version = \"{current_version}\""
1010

1111
[[tool.bumpversion.files]]
12-
filename = "src/template_python/__init__.py"
12+
filename = "src/dycw_template_python/__init__.py"
1313
replace = "__version__ = \"{new_version}\""
1414
search = "__version__ = \"{current_version}\""
Lines changed: 41 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,56 @@
1+
name: pull-request
2+
on:
3+
pull_request:
4+
branches:
5+
- master
6+
schedule:
7+
- cron: 0 0 * * *
18
jobs:
2-
pyright:
3-
name: pyright
9+
pre-commit:
410
runs-on: ubuntu-latest
511
steps:
6-
- uses: actions/checkout@v6
7-
- uses: astral-sh/setup-uv@v7
12+
- name: Run 'pre-commit'
13+
uses: dycw/action-pre-commit@latest
814
with:
9-
enable-cache: true
10-
version: latest
11-
- uses: actions/setup-python@v6
12-
with:
13-
python-version-file: .python-version
14-
- run: uv sync
15-
- run: uv run pyright
16-
ruff:
17-
name: ruff
15+
token: ${{ secrets.GITHUB_TOKEN }}
16+
repos: |-
17+
dycw/pre-commit-hook-nitpick
18+
pre-commit/pre-commit-hooks
19+
pyright:
1820
runs-on: ubuntu-latest
1921
steps:
20-
- uses: actions/checkout@v6
21-
- uses: astral-sh/ruff-action@v3
22-
- run: ruff check --fix
23-
- run: ruff format
24-
test:
25-
name: test / ${{ matrix.os }}
22+
- name: Run 'pyright'
23+
uses: dycw/action-pyright@latest
24+
with:
25+
token: ${{ secrets.GITHUB_TOKEN }}
26+
python-version: "3.14"
27+
pytest:
28+
env:
29+
CI: "1"
30+
name: pytest (${{ matrix.os }}, ${{ matrix.python-version }}, ${{
31+
matrix.resolution }})
2632
runs-on: ${{ matrix.os }}
2733
steps:
28-
- uses: actions/checkout@v6
29-
- uses: astral-sh/setup-uv@v7
34+
- name: Run 'pytest'
35+
uses: dycw/action-pytest@latest
3036
with:
31-
enable-cache: true
32-
version: latest
33-
- uses: actions/setup-python@v6
34-
with:
35-
python-version-file: .python-version
36-
- run: uv sync
37-
- run: uv run pytest -n=auto
37+
token: ${{ secrets.GITHUB_TOKEN }}
38+
python-version: ${{ matrix.python-version }}
39+
resolution: ${{ matrix.resolution }}
3840
strategy:
3941
fail-fast: false
4042
matrix:
4143
os:
4244
- macos-latest
4345
- ubuntu-latest
44-
timeout-minutes: 60
45-
name: pull-request
46-
"on":
47-
pull_request:
48-
branches:
49-
- master
46+
python-version:
47+
- "3.14"
48+
resolution:
49+
- highest
50+
ruff:
51+
runs-on: ubuntu-latest
52+
steps:
53+
- name: Run 'ruff'
54+
uses: dycw/action-ruff@latest
55+
with:
56+
token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/push.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
name: push
2+
on:
3+
push:
4+
branches:
5+
- master
16
jobs:
27
tag:
38
runs-on: ubuntu-latest
@@ -6,8 +11,3 @@ jobs:
611
uses: dycw/action-tag@latest
712
with:
813
token: ${{ secrets.GITHUB_TOKEN }}
9-
name: push
10-
"on":
11-
push:
12-
branches:
13-
- master

.pre-commit-config.yaml

Lines changed: 47 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,76 @@
11
repos:
2-
- hooks:
3-
- args:
4-
- --fix
5-
id: ruff-check
6-
- id: ruff-format
7-
repo: https://github.com/astral-sh/ruff-pre-commit
8-
rev: v0.14.10
9-
- hooks:
10-
- args:
11-
- --upgrade
12-
id: uv-lock
13-
repo: https://github.com/astral-sh/uv-pre-commit
14-
rev: 0.9.18
15-
- hooks:
16-
- args:
17-
- --option
18-
- indent_tables=true
19-
- --option
20-
- indent_entries=true
21-
- --option
22-
- reorder_keys=true
23-
id: taplo-format
24-
repo: https://github.com/compwa/taplo-pre-commit
25-
rev: v0.9.3
26-
- hooks:
2+
- repo: https://github.com/dycw/pre-commit-hook-nitpick
3+
rev: 0.7.3
4+
hooks:
275
- args:
286
- --description=Template for Python packages
7+
- --github--pull-request--pre-commit
8+
- --github--pull-request--pyright
9+
- --github--pull-request--pytest--os--macos
10+
- --github--pull-request--pytest--os--ubuntu
11+
- --github--pull-request--pytest--python-version--default
12+
- --github--pull-request--pytest--resolution--highest
13+
- --github--pull-request--ruff
2914
- --github--push--tag
30-
- --package-name=dycw-template
15+
- --package-name=dycw-template-python
3116
- --pre-commit--prettier
3217
- --pre-commit--ruff
3318
- --pre-commit--taplo
3419
- --pre-commit--uv
3520
- --pyproject
3621
- --pyright
37-
- --pyright--include=src
3822
- --pytest
39-
- --pytest--test-paths=src/tests
40-
- --python-package-name=template_python
4123
- --readme
4224
- --repo-name=template-python
4325
- --ruff
4426
id: nitpick
45-
repo: https://github.com/dycw/pre-commit-hook-nitpick
46-
rev: 0.5.0
47-
- hooks:
48-
- id: format-requirements
49-
- id: replace-sequence-str
50-
repo: https://github.com/dycw/pre-commit-hooks
51-
rev: 0.13.26
52-
- hooks:
27+
- repo: https://github.com/pre-commit/pre-commit-hooks
28+
rev: v6.0.0
29+
hooks:
5330
- id: check-executables-have-shebangs
5431
- id: check-merge-conflict
5532
- id: check-symlinks
5633
- id: destroyed-symlinks
5734
- id: detect-private-key
5835
- id: end-of-file-fixer
59-
- args:
36+
- id: mixed-line-ending
37+
args:
6038
- --fix=lf
61-
id: mixed-line-ending
6239
- id: no-commit-to-branch
63-
- args:
40+
- id: pretty-format-json
41+
args:
6442
- --autofix
65-
id: pretty-format-json
6643
- id: trailing-whitespace
67-
repo: https://github.com/pre-commit/pre-commit-hooks
68-
rev: v6.0.0
69-
- hooks:
70-
- entry: npx prettier --write
71-
id: prettier
72-
language: system
44+
- repo: local
45+
hooks:
46+
- id: prettier
7347
name: prettier
48+
entry: npx prettier --write
49+
language: system
7450
types_or:
7551
- markdown
7652
- yaml
77-
repo: local
53+
- repo: https://github.com/astral-sh/ruff-pre-commit
54+
rev: v0.14.10
55+
hooks:
56+
- id: ruff-check
57+
args:
58+
- --fix
59+
- id: ruff-format
60+
- repo: https://github.com/compwa/taplo-pre-commit
61+
rev: v0.9.3
62+
hooks:
63+
- id: taplo-format
64+
args:
65+
- --option
66+
- indent_tables=true
67+
- --option
68+
- indent_entries=true
69+
- --option
70+
- reorder_keys=true
71+
- repo: https://github.com/astral-sh/uv-pre-commit
72+
rev: 0.9.18
73+
hooks:
74+
- id: uv-lock
75+
args:
76+
- --upgrade

pyproject.toml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,7 @@
99
authors = [{ email = "d.wan@icloud.com", name = "Derek Wan" }]
1010
dependencies = []
1111
description = "Template for Python packages"
12-
name = "dycw-template"
12+
name = "dycw-template-python"
1313
readme = "README.md"
1414
requires-python = ">= 3.14"
1515
version = "0.1.0"
16-
17-
[tool.uv.build-backend]
18-
module-name = "template_python"
19-
module-root = "src"

pyrightconfig.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"deprecateTypingAliases": true,
33
"enableReachabilityAnalysis": false,
44
"include": [
5-
"script.py",
65
"src"
76
],
87
"pythonVersion": "3.14",

src/tests/test_main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from __future__ import annotations
22

3-
from template_python import __version__
3+
from dycw_template_python import __version__
44

55

66
class TestMain:

uv.lock

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)