pyproject-pre-commit 0.3.4__tar.gz → 0.4.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pyproject_pre_commit-0.3.4 → pyproject_pre_commit-0.4.0}/.github/workflows/pypi.yml +6 -8
- {pyproject_pre_commit-0.3.4 → pyproject_pre_commit-0.4.0}/.github/workflows/test.yml +4 -4
- pyproject_pre_commit-0.4.0/.mise.toml +2 -0
- {pyproject_pre_commit-0.3.4 → pyproject_pre_commit-0.4.0}/.pre-commit-config.yaml +6 -1
- {pyproject_pre_commit-0.3.4 → pyproject_pre_commit-0.4.0}/.pre-commit-hooks.yaml +9 -0
- {pyproject_pre_commit-0.3.4 → pyproject_pre_commit-0.4.0}/PKG-INFO +81 -39
- {pyproject_pre_commit-0.3.4 → pyproject_pre_commit-0.4.0}/README.md +28 -14
- {pyproject_pre_commit-0.3.4 → pyproject_pre_commit-0.4.0}/pyproject.toml +71 -23
- {pyproject_pre_commit-0.3.4 → pyproject_pre_commit-0.4.0}/src/pyproject_pre_commit/pyproject_pre_commit.py +14 -2
- {pyproject_pre_commit-0.3.4 → pyproject_pre_commit-0.4.0}/tests/test_pyproject_pre_commit.py +5 -3
- {pyproject_pre_commit-0.3.4 → pyproject_pre_commit-0.4.0}/uv.lock +517 -360
- {pyproject_pre_commit-0.3.4 → pyproject_pre_commit-0.4.0}/.github/FUNDING.yml +0 -0
- {pyproject_pre_commit-0.3.4 → pyproject_pre_commit-0.4.0}/.gitignore +0 -0
- {pyproject_pre_commit-0.3.4 → pyproject_pre_commit-0.4.0}/LICENSE +0 -0
- {pyproject_pre_commit-0.3.4 → pyproject_pre_commit-0.4.0}/renovate.json +0 -0
- {pyproject_pre_commit-0.3.4 → pyproject_pre_commit-0.4.0}/src/pyproject_pre_commit/__init__.py +0 -0
- {pyproject_pre_commit-0.3.4 → pyproject_pre_commit-0.4.0}/src/pyproject_pre_commit/__version__.py +0 -0
- {pyproject_pre_commit-0.3.4 → pyproject_pre_commit-0.4.0}/src/pyproject_pre_commit/py.typed +0 -0
- {pyproject_pre_commit-0.3.4 → pyproject_pre_commit-0.4.0}/tests/__init__.py +0 -0
- {pyproject_pre_commit-0.3.4 → pyproject_pre_commit-0.4.0}/tests/test_version.py +0 -0
@@ -24,11 +24,11 @@ jobs:
|
|
24
24
|
run: |
|
25
25
|
git pull --tags
|
26
26
|
last_tag=$(git tag --sort=version:refname | tail -n1)
|
27
|
-
echo $last_tag
|
28
|
-
if [ -n "$(git diff $last_tag src pyproject.toml)" ];then
|
29
|
-
echo "flag=1" >> $GITHUB_OUTPUT
|
27
|
+
echo "$last_tag"
|
28
|
+
if [ -n "$(git diff "$last_tag" src pyproject.toml)" ];then
|
29
|
+
echo "flag=1" >> "$GITHUB_OUTPUT"
|
30
30
|
else
|
31
|
-
echo "flag=0" >> $GITHUB_OUTPUT
|
31
|
+
echo "flag=0" >> "$GITHUB_OUTPUT"
|
32
32
|
fi
|
33
33
|
- name: Update tag
|
34
34
|
id: update
|
@@ -41,11 +41,9 @@ jobs:
|
|
41
41
|
new_tag_no_v=${new_tag#v}
|
42
42
|
sed -i"" "s/^version.*$/version = \"${new_tag_no_v}\"/" pyproject.toml
|
43
43
|
if [ -n "$(git diff)" ];then
|
44
|
-
echo "flag=1" >> $GITHUB_OUTPUT
|
45
|
-
echo "lat_tag=${last_tag}" >> $GITHUB_OUTPUT
|
46
|
-
echo "new_tag=${new_tag}" >> $GITHUB_OUTPUT
|
44
|
+
{ echo "flag=1"; "lat_tag=${last_tag}"; "new_tag=${new_tag}"; } >> "$GITHUB_OUTPUT"
|
47
45
|
else
|
48
|
-
echo "flag=0" >> $GITHUB_OUTPUT
|
46
|
+
echo "flag=0" >> "$GITHUB_OUTPUT"
|
49
47
|
fi
|
50
48
|
- name: Commit and push
|
51
49
|
if: ${{ steps.check.outputs.flag == 1 && steps.update.outputs.flag == 1 }}
|
@@ -62,10 +62,10 @@ jobs:
|
|
62
62
|
id: is_main
|
63
63
|
run: |
|
64
64
|
if [ "${{ github.ref }}" = "refs/heads/${{ env.MAIN_BRANCH }}" ] && [ "${{ matrix.os }}" = "${{ env.MAIN_OS }}" ] && [ "${{ matrix.python-version }}" = "${{ env.MAIN_PY_VER }}" ];then
|
65
|
-
echo "IS_MAIN=1" >> $GITHUB_ENV
|
65
|
+
echo "IS_MAIN=1" >> "$GITHUB_ENV"
|
66
66
|
is_main=1
|
67
67
|
else
|
68
|
-
echo "IS_MAIN=0" >> $GITHUB_ENV
|
68
|
+
echo "IS_MAIN=0" >> "$GITHUB_ENV"
|
69
69
|
is_main=0
|
70
70
|
fi
|
71
71
|
if [ "${{ env.TMATE }}" = "true" ];then
|
@@ -73,9 +73,9 @@ jobs:
|
|
73
73
|
echo "Tmate is enabled and this is not main, skip tests"
|
74
74
|
exit 1
|
75
75
|
fi
|
76
|
-
echo "DEBUG=1" >> $GITHUB_ENV
|
76
|
+
echo "DEBUG=1" >> "$GITHUB_ENV"
|
77
77
|
else
|
78
|
-
echo "DEBUG=0" >> $GITHUB_ENV
|
78
|
+
echo "DEBUG=0" >> "$GITHUB_ENV"
|
79
79
|
fi
|
80
80
|
- uses: rcmdnk/python-action@v3
|
81
81
|
with:
|
@@ -196,11 +196,16 @@ repos:
|
|
196
196
|
entry: mdformat
|
197
197
|
language: system
|
198
198
|
types: [markdown]
|
199
|
+
- id: actionlint
|
200
|
+
name: actionlint
|
201
|
+
entry: actionlint
|
202
|
+
language: system
|
203
|
+
types: [yaml]
|
204
|
+
files: "^.github/workflows/"
|
199
205
|
- id: validate-pyproject
|
200
206
|
name: validate-pyproject
|
201
207
|
entry: validate-pyproject
|
202
208
|
language: system
|
203
|
-
types: []
|
204
209
|
files: ^pyproject.toml$
|
205
210
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
206
211
|
rev: v5.0.0
|
@@ -255,6 +255,15 @@
|
|
255
255
|
language: system
|
256
256
|
types: [markdown]
|
257
257
|
require_serial: true
|
258
|
+
- id: actionlint
|
259
|
+
# https://github.com/Mateusz-Grzelinski/actionlint-py
|
260
|
+
name: actionlint
|
261
|
+
description: Lint GitHub workflows with actionlint
|
262
|
+
entry: actionlint
|
263
|
+
language: system
|
264
|
+
types: [yaml]
|
265
|
+
files: "^.github/workflows/"
|
266
|
+
require_serial: true
|
258
267
|
- id: validate-pyproject
|
259
268
|
# https://github.com/abravalheri/validate-pyproject
|
260
269
|
name: validate-pyproject
|
@@ -1,11 +1,14 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.4
|
2
2
|
Name: pyproject-pre-commit
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.4.0
|
4
4
|
Summary: pre-commit hooks for python projects using pyproject.toml.
|
5
|
-
Project-URL:
|
6
|
-
Project-URL:
|
7
|
-
Project-URL:
|
5
|
+
Project-URL: Repository, https://github.com/rcmdnk/pyproject-pre-commit
|
6
|
+
Project-URL: Documentation, https://github.com/rcmdnk/pyproject-pre-commit
|
7
|
+
Project-URL: Homepage, https://github.com/rcmdnk/pyproject-pre-commit
|
8
|
+
Project-URL: Issue, https://github.com/rcmdnk/pyproject-pre-commit/issues
|
8
9
|
Author-email: rcmdnk <rcmdnk@gmail.com>
|
10
|
+
License-Expression: Apache-2.0
|
11
|
+
License-File: LICENSE
|
9
12
|
Keywords: pre-commit,pyproject.toml,uv
|
10
13
|
Classifier: Development Status :: 3 - Alpha
|
11
14
|
Classifier: Environment :: Console
|
@@ -15,24 +18,7 @@ Classifier: Topic :: Software Development
|
|
15
18
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
16
19
|
Classifier: Topic :: Utilities
|
17
20
|
Requires-Python: >=3.9.0
|
18
|
-
Requires-Dist:
|
19
|
-
Requires-Dist: autopep8>=2.0.4
|
20
|
-
Requires-Dist: bandit[toml]>=1.7.5
|
21
|
-
Requires-Dist: black>=24.3.0
|
22
|
-
Requires-Dist: blacken-docs>=1.16.0
|
23
|
-
Requires-Dist: flake8-annotations-complexity>=0.0.8
|
24
|
-
Requires-Dist: flake8-bugbear>=24.0.0
|
25
|
-
Requires-Dist: flake8-builtins>=2.1.0
|
26
|
-
Requires-Dist: flake8-comprehensions>=3.14.0
|
27
|
-
Requires-Dist: flake8-debugger>=4.1.2
|
28
|
-
Requires-Dist: flake8-docstrings>=1.7.0
|
29
|
-
Requires-Dist: flake8-executable>=2.1.3
|
30
|
-
Requires-Dist: flake8-pep3101>=2.0.0
|
31
|
-
Requires-Dist: flake8-print>=5.0.0
|
32
|
-
Requires-Dist: flake8-pyproject>=1.2.3
|
33
|
-
Requires-Dist: flake8-rst-docstrings>=0.3.0
|
34
|
-
Requires-Dist: flake8-string-format>=0.3.0
|
35
|
-
Requires-Dist: isort>=5.12.0
|
21
|
+
Requires-Dist: actionlint-py>=1.7.7.23
|
36
22
|
Requires-Dist: mdformat-config>=0.2.1
|
37
23
|
Requires-Dist: mdformat-footnote>=0.1.1
|
38
24
|
Requires-Dist: mdformat-frontmatter>=2.0.1
|
@@ -45,11 +31,53 @@ Requires-Dist: mdformat-web>=0.2.0
|
|
45
31
|
Requires-Dist: mdformat>=0.7.17
|
46
32
|
Requires-Dist: mypy>=1.5.1
|
47
33
|
Requires-Dist: numpydoc>=1.8.0
|
48
|
-
Requires-Dist: pep8-naming>=0.14.0
|
49
34
|
Requires-Dist: pre-commit>=4.0.0
|
50
|
-
Requires-Dist: pycodestyle>=2.11.0
|
51
35
|
Requires-Dist: shellcheck-py>=0.9.0.5
|
52
36
|
Requires-Dist: validate-pyproject[all]>=0.22
|
37
|
+
Provides-Extra: all
|
38
|
+
Requires-Dist: autoflake>=2.2.1; extra == 'all'
|
39
|
+
Requires-Dist: autopep8>=2.0.4; extra == 'all'
|
40
|
+
Requires-Dist: bandit[toml]>=1.7.5; extra == 'all'
|
41
|
+
Requires-Dist: black>=24.3.0; extra == 'all'
|
42
|
+
Requires-Dist: blacken-docs>=1.16.0; extra == 'all'
|
43
|
+
Requires-Dist: flake8-annotations-complexity>=0.0.8; extra == 'all'
|
44
|
+
Requires-Dist: flake8-bugbear>=24.0.0; extra == 'all'
|
45
|
+
Requires-Dist: flake8-builtins>=2.1.0; extra == 'all'
|
46
|
+
Requires-Dist: flake8-comprehensions>=3.14.0; extra == 'all'
|
47
|
+
Requires-Dist: flake8-debugger>=4.1.2; extra == 'all'
|
48
|
+
Requires-Dist: flake8-docstrings>=1.7.0; extra == 'all'
|
49
|
+
Requires-Dist: flake8-executable>=2.1.3; extra == 'all'
|
50
|
+
Requires-Dist: flake8-pep3101>=2.0.0; extra == 'all'
|
51
|
+
Requires-Dist: flake8-print>=5.0.0; extra == 'all'
|
52
|
+
Requires-Dist: flake8-pyproject>=1.2.3; extra == 'all'
|
53
|
+
Requires-Dist: flake8-rst-docstrings>=0.3.0; extra == 'all'
|
54
|
+
Requires-Dist: flake8-string-format>=0.3.0; extra == 'all'
|
55
|
+
Requires-Dist: isort>=5.12.0; extra == 'all'
|
56
|
+
Requires-Dist: mdformat-ruff>=0.1.3; extra == 'all'
|
57
|
+
Requires-Dist: pep8-naming>=0.14.0; extra == 'all'
|
58
|
+
Requires-Dist: pycodestyle>=2.11.0; extra == 'all'
|
59
|
+
Requires-Dist: ruff>=0.7.2; extra == 'all'
|
60
|
+
Provides-Extra: black
|
61
|
+
Requires-Dist: autoflake>=2.2.1; extra == 'black'
|
62
|
+
Requires-Dist: autopep8>=2.0.4; extra == 'black'
|
63
|
+
Requires-Dist: bandit[toml]>=1.7.5; extra == 'black'
|
64
|
+
Requires-Dist: black>=24.3.0; extra == 'black'
|
65
|
+
Requires-Dist: blacken-docs>=1.16.0; extra == 'black'
|
66
|
+
Requires-Dist: flake8-annotations-complexity>=0.0.8; extra == 'black'
|
67
|
+
Requires-Dist: flake8-bugbear>=24.0.0; extra == 'black'
|
68
|
+
Requires-Dist: flake8-builtins>=2.1.0; extra == 'black'
|
69
|
+
Requires-Dist: flake8-comprehensions>=3.14.0; extra == 'black'
|
70
|
+
Requires-Dist: flake8-debugger>=4.1.2; extra == 'black'
|
71
|
+
Requires-Dist: flake8-docstrings>=1.7.0; extra == 'black'
|
72
|
+
Requires-Dist: flake8-executable>=2.1.3; extra == 'black'
|
73
|
+
Requires-Dist: flake8-pep3101>=2.0.0; extra == 'black'
|
74
|
+
Requires-Dist: flake8-print>=5.0.0; extra == 'black'
|
75
|
+
Requires-Dist: flake8-pyproject>=1.2.3; extra == 'black'
|
76
|
+
Requires-Dist: flake8-rst-docstrings>=0.3.0; extra == 'black'
|
77
|
+
Requires-Dist: flake8-string-format>=0.3.0; extra == 'black'
|
78
|
+
Requires-Dist: isort>=5.12.0; extra == 'black'
|
79
|
+
Requires-Dist: pep8-naming>=0.14.0; extra == 'black'
|
80
|
+
Requires-Dist: pycodestyle>=2.11.0; extra == 'black'
|
53
81
|
Provides-Extra: ruff
|
54
82
|
Requires-Dist: mdformat-ruff>=0.1.3; extra == 'ruff'
|
55
83
|
Requires-Dist: ruff>=0.7.2; extra == 'ruff'
|
@@ -72,7 +100,6 @@ all necessary tools are installed as dependencies.
|
|
72
100
|
- [Requirement](#requirement)
|
73
101
|
- [Usage](#usage)
|
74
102
|
- [Install pyproject-pre-commit](#install-pyproject-pre-commit)
|
75
|
-
- [Install pyproject-pre-commit with ruff](#install-pyproject-pre-commit-with-ruff)
|
76
103
|
- [Prepare .pre-commit-config.yaml](#prepare-pre-commit-configyaml)
|
77
104
|
- [Run pre-commit](#run-pre-commit)
|
78
105
|
- [Available ids](#available-ids)
|
@@ -84,7 +111,6 @@ all necessary tools are installed as dependencies.
|
|
84
111
|
## Requirement<a name="requirement"></a>
|
85
112
|
|
86
113
|
- Python >= 3.9.0
|
87
|
-
- Poetry (For development)
|
88
114
|
|
89
115
|
## Usage<a name="usage"></a>
|
90
116
|
|
@@ -93,32 +119,40 @@ all necessary tools are installed as dependencies.
|
|
93
119
|
If your project uses poetry, do:
|
94
120
|
|
95
121
|
```
|
96
|
-
$ poetry add --group dev pyproject-pre-commit
|
122
|
+
$ poetry add --group dev pyproject-pre-commit[ruff]
|
97
123
|
```
|
98
124
|
|
99
|
-
|
100
|
-
|
101
|
-
If you use pip, do:
|
125
|
+
or uv, do:
|
102
126
|
|
103
127
|
```
|
104
|
-
$
|
128
|
+
$ poetry add --dev pyproject-pre-commit[ruff]
|
105
129
|
```
|
106
130
|
|
107
|
-
|
108
|
-
so that you can use these tools, such as black, directly.
|
131
|
+
You can choose `ruff` or `black` as main linter/formatter by option.
|
109
132
|
|
110
|
-
|
133
|
+
If you want to use `black`, do:
|
134
|
+
|
135
|
+
```
|
136
|
+
$ poetry add --dev pyproject-pre-commit[black]
|
137
|
+
```
|
111
138
|
|
112
|
-
|
139
|
+
For `black` case, `autoflake`, `autopep8`, `isort`, `flake8` and `bandit` are also installed.
|
140
|
+
|
141
|
+
If you wish to install all, do:
|
113
142
|
|
114
143
|
```
|
115
|
-
$ poetry add --
|
144
|
+
$ poetry add --dev pyproject-pre-commit[all]
|
116
145
|
```
|
117
146
|
|
147
|
+
If you use pip, do:
|
148
|
+
|
118
149
|
```
|
119
150
|
$ pip install pyproject-pre-commit[ruff]
|
120
151
|
```
|
121
152
|
|
153
|
+
This will install tools for pre-commit hooks in your working environment,
|
154
|
+
so that you can use these tools, such as black, directly.
|
155
|
+
|
122
156
|
### Prepare .pre-commit-config.yaml<a name="prepare-pre-commit-configyaml"></a>
|
123
157
|
|
124
158
|
Add **https://github.com/rcmdnk/pyproject-pre-commit** to your **.pre-commit-config.yaml**, like:
|
@@ -143,6 +177,8 @@ repos:
|
|
143
177
|
- id: shellcheck
|
144
178
|
- id: mdformat-check
|
145
179
|
- id: mdformat
|
180
|
+
- id: actionlint
|
181
|
+
- id: validate-pyproject
|
146
182
|
```
|
147
183
|
|
148
184
|
By using **pyproject-pre-commit**, you can simplify your **.pre-commit-config.yaml**
|
@@ -157,7 +193,7 @@ This can be made by `ppc` command:
|
|
157
193
|
$ ppc --pre-commit > .pre-commit-config.yaml
|
158
194
|
```
|
159
195
|
|
160
|
-
>
|
196
|
+
> [!NOTE]
|
161
197
|
> If you are using poetry, run `poetry run ppc ... ` or run after `poetry shell`.
|
162
198
|
|
163
199
|
If you already have it, add hooks w/o `repos:` by
|
@@ -183,6 +219,8 @@ repos:
|
|
183
219
|
- id: shellcheck
|
184
220
|
- id: mdformat-check
|
185
221
|
- id: mdformat
|
222
|
+
- id: actionlint
|
223
|
+
- id: validate-pyproject
|
186
224
|
```
|
187
225
|
|
188
226
|
This can be made by `ppc` command:
|
@@ -209,7 +247,7 @@ then you can run pre-commit by:
|
|
209
247
|
$ pre-commit run --all-files
|
210
248
|
```
|
211
249
|
|
212
|
-
>
|
250
|
+
> [!NOTE]
|
213
251
|
> If you are using poetry, run `poetry run pre-commit ... ` or run after `poetry shell`.
|
214
252
|
|
215
253
|
## Available ids<a name="available-ids"></a>
|
@@ -259,6 +297,10 @@ There are ids for following tools:
|
|
259
297
|
- [mdformat-gfm](https://github.com/hukkin/mdformat-gfm)
|
260
298
|
- [mdformat-frontmatter](https://github.com/butler54/mdformat-frontmatter)
|
261
299
|
- [mdformat-footnote](https://github.com/executablebooks/mdformat-footnote)
|
300
|
+
- For GitHub Actions
|
301
|
+
- [actionlint](https://github.com/Mateusz-Grzelinski/actionlint-py): Lint GitHub workflows with actionlint.
|
302
|
+
- For pyproject.toml
|
303
|
+
- [validate-pyproject](https://github.com/abravalheri/validate-pyproject): Validate pyproject.toml file.
|
262
304
|
|
263
305
|
All tools are installed as dependencies of **pyproject-pre-commit** package.
|
264
306
|
|
@@ -15,7 +15,6 @@ all necessary tools are installed as dependencies.
|
|
15
15
|
- [Requirement](#requirement)
|
16
16
|
- [Usage](#usage)
|
17
17
|
- [Install pyproject-pre-commit](#install-pyproject-pre-commit)
|
18
|
-
- [Install pyproject-pre-commit with ruff](#install-pyproject-pre-commit-with-ruff)
|
19
18
|
- [Prepare .pre-commit-config.yaml](#prepare-pre-commit-configyaml)
|
20
19
|
- [Run pre-commit](#run-pre-commit)
|
21
20
|
- [Available ids](#available-ids)
|
@@ -27,7 +26,6 @@ all necessary tools are installed as dependencies.
|
|
27
26
|
## Requirement<a name="requirement"></a>
|
28
27
|
|
29
28
|
- Python >= 3.9.0
|
30
|
-
- Poetry (For development)
|
31
29
|
|
32
30
|
## Usage<a name="usage"></a>
|
33
31
|
|
@@ -36,32 +34,40 @@ all necessary tools are installed as dependencies.
|
|
36
34
|
If your project uses poetry, do:
|
37
35
|
|
38
36
|
```
|
39
|
-
$ poetry add --group dev pyproject-pre-commit
|
37
|
+
$ poetry add --group dev pyproject-pre-commit[ruff]
|
40
38
|
```
|
41
39
|
|
42
|
-
|
43
|
-
|
44
|
-
If you use pip, do:
|
40
|
+
or uv, do:
|
45
41
|
|
46
42
|
```
|
47
|
-
$
|
43
|
+
$ poetry add --dev pyproject-pre-commit[ruff]
|
48
44
|
```
|
49
45
|
|
50
|
-
|
51
|
-
so that you can use these tools, such as black, directly.
|
46
|
+
You can choose `ruff` or `black` as main linter/formatter by option.
|
52
47
|
|
53
|
-
|
48
|
+
If you want to use `black`, do:
|
49
|
+
|
50
|
+
```
|
51
|
+
$ poetry add --dev pyproject-pre-commit[black]
|
52
|
+
```
|
54
53
|
|
55
|
-
|
54
|
+
For `black` case, `autoflake`, `autopep8`, `isort`, `flake8` and `bandit` are also installed.
|
55
|
+
|
56
|
+
If you wish to install all, do:
|
56
57
|
|
57
58
|
```
|
58
|
-
$ poetry add --
|
59
|
+
$ poetry add --dev pyproject-pre-commit[all]
|
59
60
|
```
|
60
61
|
|
62
|
+
If you use pip, do:
|
63
|
+
|
61
64
|
```
|
62
65
|
$ pip install pyproject-pre-commit[ruff]
|
63
66
|
```
|
64
67
|
|
68
|
+
This will install tools for pre-commit hooks in your working environment,
|
69
|
+
so that you can use these tools, such as black, directly.
|
70
|
+
|
65
71
|
### Prepare .pre-commit-config.yaml<a name="prepare-pre-commit-configyaml"></a>
|
66
72
|
|
67
73
|
Add **https://github.com/rcmdnk/pyproject-pre-commit** to your **.pre-commit-config.yaml**, like:
|
@@ -86,6 +92,8 @@ repos:
|
|
86
92
|
- id: shellcheck
|
87
93
|
- id: mdformat-check
|
88
94
|
- id: mdformat
|
95
|
+
- id: actionlint
|
96
|
+
- id: validate-pyproject
|
89
97
|
```
|
90
98
|
|
91
99
|
By using **pyproject-pre-commit**, you can simplify your **.pre-commit-config.yaml**
|
@@ -100,7 +108,7 @@ This can be made by `ppc` command:
|
|
100
108
|
$ ppc --pre-commit > .pre-commit-config.yaml
|
101
109
|
```
|
102
110
|
|
103
|
-
>
|
111
|
+
> [!NOTE]
|
104
112
|
> If you are using poetry, run `poetry run ppc ... ` or run after `poetry shell`.
|
105
113
|
|
106
114
|
If you already have it, add hooks w/o `repos:` by
|
@@ -126,6 +134,8 @@ repos:
|
|
126
134
|
- id: shellcheck
|
127
135
|
- id: mdformat-check
|
128
136
|
- id: mdformat
|
137
|
+
- id: actionlint
|
138
|
+
- id: validate-pyproject
|
129
139
|
```
|
130
140
|
|
131
141
|
This can be made by `ppc` command:
|
@@ -152,7 +162,7 @@ then you can run pre-commit by:
|
|
152
162
|
$ pre-commit run --all-files
|
153
163
|
```
|
154
164
|
|
155
|
-
>
|
165
|
+
> [!NOTE]
|
156
166
|
> If you are using poetry, run `poetry run pre-commit ... ` or run after `poetry shell`.
|
157
167
|
|
158
168
|
## Available ids<a name="available-ids"></a>
|
@@ -202,6 +212,10 @@ There are ids for following tools:
|
|
202
212
|
- [mdformat-gfm](https://github.com/hukkin/mdformat-gfm)
|
203
213
|
- [mdformat-frontmatter](https://github.com/butler54/mdformat-frontmatter)
|
204
214
|
- [mdformat-footnote](https://github.com/executablebooks/mdformat-footnote)
|
215
|
+
- For GitHub Actions
|
216
|
+
- [actionlint](https://github.com/Mateusz-Grzelinski/actionlint-py): Lint GitHub workflows with actionlint.
|
217
|
+
- For pyproject.toml
|
218
|
+
- [validate-pyproject](https://github.com/abravalheri/validate-pyproject): Validate pyproject.toml file.
|
205
219
|
|
206
220
|
All tools are installed as dependencies of **pyproject-pre-commit** package.
|
207
221
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[project]
|
2
2
|
name = "pyproject-pre-commit"
|
3
|
-
version = "0.
|
3
|
+
version = "0.4.0"
|
4
4
|
description = "pre-commit hooks for python projects using pyproject.toml."
|
5
5
|
authors = [
|
6
6
|
{ name = "rcmdnk", email = "rcmdnk@gmail.com" }
|
@@ -20,6 +20,35 @@ classifiers = [
|
|
20
20
|
requires-python = ">=3.9.0"
|
21
21
|
dependencies = [
|
22
22
|
"pre-commit >= 4.0.0",
|
23
|
+
"mypy >= 1.5.1",
|
24
|
+
"numpydoc >= 1.8.0",
|
25
|
+
"shellcheck-py >= 0.9.0.5",
|
26
|
+
"mdformat >= 0.7.17",
|
27
|
+
"mdformat-pyproject>=0.0.1",
|
28
|
+
"mdformat-config>=0.2.1",
|
29
|
+
"mdformat-rustfmt>=0.0.3",
|
30
|
+
"mdformat-footnote >= 0.1.1",
|
31
|
+
"mdformat-frontmatter >= 2.0.1",
|
32
|
+
"mdformat-gfm >= 0.3.5",
|
33
|
+
"mdformat-tables>=1.0.0",
|
34
|
+
"mdformat-web>=0.2.0",
|
35
|
+
"mdformat-toc>=0.3.0",
|
36
|
+
"actionlint-py>=1.7.7.23",
|
37
|
+
"validate-pyproject[all]>=0.22",
|
38
|
+
]
|
39
|
+
|
40
|
+
[project.urls]
|
41
|
+
Repository = "https://github.com/rcmdnk/pyproject-pre-commit"
|
42
|
+
Documentation = "https://github.com/rcmdnk/pyproject-pre-commit"
|
43
|
+
Homepage = "https://github.com/rcmdnk/pyproject-pre-commit"
|
44
|
+
Issue = "https://github.com/rcmdnk/pyproject-pre-commit/issues"
|
45
|
+
|
46
|
+
[project.optional-dependencies]
|
47
|
+
ruff = [
|
48
|
+
"ruff >= 0.7.2",
|
49
|
+
"mdformat-ruff >= 0.1.3",
|
50
|
+
]
|
51
|
+
black = [
|
23
52
|
"black >= 24.3.0",
|
24
53
|
"blacken-docs >= 1.16.0",
|
25
54
|
"flake8-pyproject >= 1.2.3",
|
@@ -40,31 +69,30 @@ dependencies = [
|
|
40
69
|
"autopep8 >= 2.0.4",
|
41
70
|
"isort >= 5.12.0",
|
42
71
|
"bandit[toml] >= 1.7.5",
|
43
|
-
"mypy >= 1.5.1",
|
44
|
-
"numpydoc >= 1.8.0",
|
45
|
-
"shellcheck-py >= 0.9.0.5",
|
46
|
-
"mdformat >= 0.7.17",
|
47
|
-
"mdformat-pyproject>=0.0.1",
|
48
|
-
"mdformat-config>=0.2.1",
|
49
|
-
"mdformat-rustfmt>=0.0.3",
|
50
|
-
"mdformat-footnote >= 0.1.1",
|
51
|
-
"mdformat-frontmatter >= 2.0.1",
|
52
|
-
"mdformat-gfm >= 0.3.5",
|
53
|
-
"mdformat-tables>=1.0.0",
|
54
|
-
"mdformat-web>=0.2.0",
|
55
|
-
"mdformat-toc>=0.3.0",
|
56
|
-
"validate-pyproject[all]>=0.22",
|
57
72
|
]
|
58
|
-
|
59
|
-
[project.urls]
|
60
|
-
repository = "https://github.com/rcmdnk/pyproject-pre-commit"
|
61
|
-
homepage = "https://github.com/rcmdnk/pyproject-pre-commit"
|
62
|
-
documentation = "https://github.com/rcmdnk/pyproject-pre-commit"
|
63
|
-
|
64
|
-
[project.optional-dependencies]
|
65
|
-
ruff = [
|
73
|
+
all = [
|
66
74
|
"ruff >= 0.7.2",
|
67
75
|
"mdformat-ruff >= 0.1.3",
|
76
|
+
"black >= 24.3.0",
|
77
|
+
"blacken-docs >= 1.16.0",
|
78
|
+
"flake8-pyproject >= 1.2.3",
|
79
|
+
"flake8-annotations-complexity >= 0.0.8",
|
80
|
+
"flake8-bugbear >= 24.0.0",
|
81
|
+
"flake8-builtins >= 2.1.0",
|
82
|
+
"flake8-comprehensions >= 3.14.0",
|
83
|
+
"flake8-debugger >= 4.1.2",
|
84
|
+
"flake8-docstrings >= 1.7.0",
|
85
|
+
"flake8-executable >= 2.1.3",
|
86
|
+
"flake8-pep3101 >= 2.0.0",
|
87
|
+
"flake8-print >= 5.0.0",
|
88
|
+
"flake8-rst-docstrings >= 0.3.0",
|
89
|
+
"flake8-string-format >= 0.3.0",
|
90
|
+
"pep8-naming >= 0.14.0",
|
91
|
+
"pycodestyle >= 2.11.0",
|
92
|
+
"autoflake >= 2.2.1",
|
93
|
+
"autopep8 >= 2.0.4",
|
94
|
+
"isort >= 5.12.0",
|
95
|
+
"bandit[toml] >= 1.7.5",
|
68
96
|
]
|
69
97
|
|
70
98
|
[dependency-groups]
|
@@ -74,6 +102,26 @@ dev = [
|
|
74
102
|
"pytest-xdist >= 3.3.1",
|
75
103
|
"ruff >= 0.7.2",
|
76
104
|
"mdformat-ruff >= 0.1.3",
|
105
|
+
"black >= 24.3.0",
|
106
|
+
"blacken-docs >= 1.16.0",
|
107
|
+
"flake8-pyproject >= 1.2.3",
|
108
|
+
"flake8-annotations-complexity >= 0.0.8",
|
109
|
+
"flake8-bugbear >= 24.0.0",
|
110
|
+
"flake8-builtins >= 2.1.0",
|
111
|
+
"flake8-comprehensions >= 3.14.0",
|
112
|
+
"flake8-debugger >= 4.1.2",
|
113
|
+
"flake8-docstrings >= 1.7.0",
|
114
|
+
"flake8-executable >= 2.1.3",
|
115
|
+
"flake8-pep3101 >= 2.0.0",
|
116
|
+
"flake8-print >= 5.0.0",
|
117
|
+
"flake8-rst-docstrings >= 0.3.0",
|
118
|
+
"flake8-string-format >= 0.3.0",
|
119
|
+
"pep8-naming >= 0.14.0",
|
120
|
+
"pycodestyle >= 2.11.0",
|
121
|
+
"autoflake >= 2.2.1",
|
122
|
+
"autopep8 >= 2.0.4",
|
123
|
+
"isort >= 5.12.0",
|
124
|
+
"bandit[toml] >= 1.7.5",
|
77
125
|
]
|
78
126
|
|
79
127
|
[project.scripts]
|
@@ -133,15 +133,27 @@ ignore-missing-imports = true
|
|
133
133
|
scripts_are_modules = true
|
134
134
|
install_types = true
|
135
135
|
non_interactive = true
|
136
|
+
|
137
|
+
[tool.numpydoc_validation]
|
138
|
+
checks = [
|
139
|
+
"all", # report on all checks, except the below
|
140
|
+
"EX01", # "No examples section found"
|
141
|
+
"ES01", # "No extended summary found"
|
142
|
+
"SA01", # "See Also section not found"
|
143
|
+
"GL08", # "The object does not have a docstring"
|
144
|
+
"PR01", # "Parameters {missing_params} not documented"
|
145
|
+
"PR02", # "Unknown parameters {unknown_params}"
|
146
|
+
"RT01", # "No Returns section found"
|
147
|
+
]
|
136
148
|
"""
|
137
149
|
)
|
138
150
|
|
139
151
|
|
140
152
|
def main() -> None:
|
141
153
|
usage = "Usage: ppc <--pre-commit | --pyproject> [--ruff] [--black]"
|
142
|
-
if len(sys.argv)
|
154
|
+
if len(sys.argv) < 2:
|
143
155
|
print(usage) # noqa: T201
|
144
|
-
sys.exit(
|
156
|
+
sys.exit(0)
|
145
157
|
is_ruff = "--ruff" in sys.argv
|
146
158
|
if "--pre-commit" in sys.argv:
|
147
159
|
pre_commit(is_ruff)
|
{pyproject_pre_commit-0.3.4 → pyproject_pre_commit-0.4.0}/tests/test_pyproject_pre_commit.py
RENAMED
@@ -6,24 +6,26 @@ from pyproject_pre_commit import __version__, main
|
|
6
6
|
|
7
7
|
|
8
8
|
@pytest.mark.parametrize(
|
9
|
-
"argv, out",
|
9
|
+
"argv, code, out",
|
10
10
|
[
|
11
11
|
(
|
12
12
|
["ppc"],
|
13
|
+
0,
|
13
14
|
"Usage: ppc <--pre-commit | --pyproject> [--ruff] [--black]\n",
|
14
15
|
),
|
15
16
|
(
|
16
17
|
["ppc", "--wrong"],
|
18
|
+
1,
|
17
19
|
"Usage: ppc <--pre-commit | --pyproject> [--ruff] [--black]\n",
|
18
20
|
),
|
19
21
|
],
|
20
22
|
)
|
21
|
-
def test_sys_exit(argv, out, capsys):
|
23
|
+
def test_sys_exit(argv, code, out, capsys):
|
22
24
|
sys.argv = argv
|
23
25
|
with pytest.raises(SystemExit) as test:
|
24
26
|
main()
|
25
27
|
assert test.type is SystemExit
|
26
|
-
assert test.value.code ==
|
28
|
+
assert test.value.code == code
|
27
29
|
captured = capsys.readouterr()
|
28
30
|
assert captured.out == out
|
29
31
|
|