pyproject-pre-commit 0.3.6__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.6 → pyproject_pre_commit-0.4.0}/.github/workflows/pypi.yml +6 -8
- {pyproject_pre_commit-0.3.6 → pyproject_pre_commit-0.4.0}/.github/workflows/test.yml +4 -4
- {pyproject_pre_commit-0.3.6 → pyproject_pre_commit-0.4.0}/.pre-commit-config.yaml +6 -0
- {pyproject_pre_commit-0.3.6 → pyproject_pre_commit-0.4.0}/.pre-commit-hooks.yaml +9 -0
- {pyproject_pre_commit-0.3.6 → pyproject_pre_commit-0.4.0}/PKG-INFO +77 -37
- {pyproject_pre_commit-0.3.6 → pyproject_pre_commit-0.4.0}/README.md +28 -14
- {pyproject_pre_commit-0.3.6 → pyproject_pre_commit-0.4.0}/pyproject.toml +68 -21
- {pyproject_pre_commit-0.3.6 → pyproject_pre_commit-0.4.0}/tests/test_pyproject_pre_commit.py +5 -3
- {pyproject_pre_commit-0.3.6 → pyproject_pre_commit-0.4.0}/uv.lock +444 -299
- {pyproject_pre_commit-0.3.6 → pyproject_pre_commit-0.4.0}/.github/FUNDING.yml +0 -0
- {pyproject_pre_commit-0.3.6 → pyproject_pre_commit-0.4.0}/.gitignore +0 -0
- {pyproject_pre_commit-0.3.6 → pyproject_pre_commit-0.4.0}/.mise.toml +0 -0
- {pyproject_pre_commit-0.3.6 → pyproject_pre_commit-0.4.0}/LICENSE +0 -0
- {pyproject_pre_commit-0.3.6 → pyproject_pre_commit-0.4.0}/renovate.json +0 -0
- {pyproject_pre_commit-0.3.6 → pyproject_pre_commit-0.4.0}/src/pyproject_pre_commit/__init__.py +0 -0
- {pyproject_pre_commit-0.3.6 → pyproject_pre_commit-0.4.0}/src/pyproject_pre_commit/__version__.py +0 -0
- {pyproject_pre_commit-0.3.6 → pyproject_pre_commit-0.4.0}/src/pyproject_pre_commit/py.typed +0 -0
- {pyproject_pre_commit-0.3.6 → pyproject_pre_commit-0.4.0}/src/pyproject_pre_commit/pyproject_pre_commit.py +0 -0
- {pyproject_pre_commit-0.3.6 → pyproject_pre_commit-0.4.0}/tests/__init__.py +0 -0
- {pyproject_pre_commit-0.3.6 → 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,6 +196,12 @@ 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
|
@@ -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,13 +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
5
|
Project-URL: Repository, https://github.com/rcmdnk/pyproject-pre-commit
|
6
6
|
Project-URL: Documentation, https://github.com/rcmdnk/pyproject-pre-commit
|
7
7
|
Project-URL: Homepage, https://github.com/rcmdnk/pyproject-pre-commit
|
8
8
|
Project-URL: Issue, https://github.com/rcmdnk/pyproject-pre-commit/issues
|
9
9
|
Author-email: rcmdnk <rcmdnk@gmail.com>
|
10
|
-
License: Apache-2.0
|
10
|
+
License-Expression: Apache-2.0
|
11
|
+
License-File: LICENSE
|
11
12
|
Keywords: pre-commit,pyproject.toml,uv
|
12
13
|
Classifier: Development Status :: 3 - Alpha
|
13
14
|
Classifier: Environment :: Console
|
@@ -17,24 +18,7 @@ Classifier: Topic :: Software Development
|
|
17
18
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
18
19
|
Classifier: Topic :: Utilities
|
19
20
|
Requires-Python: >=3.9.0
|
20
|
-
Requires-Dist:
|
21
|
-
Requires-Dist: autopep8>=2.0.4
|
22
|
-
Requires-Dist: bandit[toml]>=1.7.5
|
23
|
-
Requires-Dist: black>=24.3.0
|
24
|
-
Requires-Dist: blacken-docs>=1.16.0
|
25
|
-
Requires-Dist: flake8-annotations-complexity>=0.0.8
|
26
|
-
Requires-Dist: flake8-bugbear>=24.0.0
|
27
|
-
Requires-Dist: flake8-builtins>=2.1.0
|
28
|
-
Requires-Dist: flake8-comprehensions>=3.14.0
|
29
|
-
Requires-Dist: flake8-debugger>=4.1.2
|
30
|
-
Requires-Dist: flake8-docstrings>=1.7.0
|
31
|
-
Requires-Dist: flake8-executable>=2.1.3
|
32
|
-
Requires-Dist: flake8-pep3101>=2.0.0
|
33
|
-
Requires-Dist: flake8-print>=5.0.0
|
34
|
-
Requires-Dist: flake8-pyproject>=1.2.3
|
35
|
-
Requires-Dist: flake8-rst-docstrings>=0.3.0
|
36
|
-
Requires-Dist: flake8-string-format>=0.3.0
|
37
|
-
Requires-Dist: isort>=5.12.0
|
21
|
+
Requires-Dist: actionlint-py>=1.7.7.23
|
38
22
|
Requires-Dist: mdformat-config>=0.2.1
|
39
23
|
Requires-Dist: mdformat-footnote>=0.1.1
|
40
24
|
Requires-Dist: mdformat-frontmatter>=2.0.1
|
@@ -47,11 +31,53 @@ Requires-Dist: mdformat-web>=0.2.0
|
|
47
31
|
Requires-Dist: mdformat>=0.7.17
|
48
32
|
Requires-Dist: mypy>=1.5.1
|
49
33
|
Requires-Dist: numpydoc>=1.8.0
|
50
|
-
Requires-Dist: pep8-naming>=0.14.0
|
51
34
|
Requires-Dist: pre-commit>=4.0.0
|
52
|
-
Requires-Dist: pycodestyle>=2.11.0
|
53
35
|
Requires-Dist: shellcheck-py>=0.9.0.5
|
54
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'
|
55
81
|
Provides-Extra: ruff
|
56
82
|
Requires-Dist: mdformat-ruff>=0.1.3; extra == 'ruff'
|
57
83
|
Requires-Dist: ruff>=0.7.2; extra == 'ruff'
|
@@ -74,7 +100,6 @@ all necessary tools are installed as dependencies.
|
|
74
100
|
- [Requirement](#requirement)
|
75
101
|
- [Usage](#usage)
|
76
102
|
- [Install pyproject-pre-commit](#install-pyproject-pre-commit)
|
77
|
-
- [Install pyproject-pre-commit with ruff](#install-pyproject-pre-commit-with-ruff)
|
78
103
|
- [Prepare .pre-commit-config.yaml](#prepare-pre-commit-configyaml)
|
79
104
|
- [Run pre-commit](#run-pre-commit)
|
80
105
|
- [Available ids](#available-ids)
|
@@ -86,7 +111,6 @@ all necessary tools are installed as dependencies.
|
|
86
111
|
## Requirement<a name="requirement"></a>
|
87
112
|
|
88
113
|
- Python >= 3.9.0
|
89
|
-
- Poetry (For development)
|
90
114
|
|
91
115
|
## Usage<a name="usage"></a>
|
92
116
|
|
@@ -95,32 +119,40 @@ all necessary tools are installed as dependencies.
|
|
95
119
|
If your project uses poetry, do:
|
96
120
|
|
97
121
|
```
|
98
|
-
$ poetry add --group dev pyproject-pre-commit
|
122
|
+
$ poetry add --group dev pyproject-pre-commit[ruff]
|
99
123
|
```
|
100
124
|
|
101
|
-
|
102
|
-
|
103
|
-
If you use pip, do:
|
125
|
+
or uv, do:
|
104
126
|
|
105
127
|
```
|
106
|
-
$
|
128
|
+
$ poetry add --dev pyproject-pre-commit[ruff]
|
107
129
|
```
|
108
130
|
|
109
|
-
|
110
|
-
so that you can use these tools, such as black, directly.
|
131
|
+
You can choose `ruff` or `black` as main linter/formatter by option.
|
111
132
|
|
112
|
-
|
133
|
+
If you want to use `black`, do:
|
134
|
+
|
135
|
+
```
|
136
|
+
$ poetry add --dev pyproject-pre-commit[black]
|
137
|
+
```
|
113
138
|
|
114
|
-
|
139
|
+
For `black` case, `autoflake`, `autopep8`, `isort`, `flake8` and `bandit` are also installed.
|
140
|
+
|
141
|
+
If you wish to install all, do:
|
115
142
|
|
116
143
|
```
|
117
|
-
$ poetry add --
|
144
|
+
$ poetry add --dev pyproject-pre-commit[all]
|
118
145
|
```
|
119
146
|
|
147
|
+
If you use pip, do:
|
148
|
+
|
120
149
|
```
|
121
150
|
$ pip install pyproject-pre-commit[ruff]
|
122
151
|
```
|
123
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
|
+
|
124
156
|
### Prepare .pre-commit-config.yaml<a name="prepare-pre-commit-configyaml"></a>
|
125
157
|
|
126
158
|
Add **https://github.com/rcmdnk/pyproject-pre-commit** to your **.pre-commit-config.yaml**, like:
|
@@ -145,6 +177,8 @@ repos:
|
|
145
177
|
- id: shellcheck
|
146
178
|
- id: mdformat-check
|
147
179
|
- id: mdformat
|
180
|
+
- id: actionlint
|
181
|
+
- id: validate-pyproject
|
148
182
|
```
|
149
183
|
|
150
184
|
By using **pyproject-pre-commit**, you can simplify your **.pre-commit-config.yaml**
|
@@ -159,7 +193,7 @@ This can be made by `ppc` command:
|
|
159
193
|
$ ppc --pre-commit > .pre-commit-config.yaml
|
160
194
|
```
|
161
195
|
|
162
|
-
>
|
196
|
+
> [!NOTE]
|
163
197
|
> If you are using poetry, run `poetry run ppc ... ` or run after `poetry shell`.
|
164
198
|
|
165
199
|
If you already have it, add hooks w/o `repos:` by
|
@@ -185,6 +219,8 @@ repos:
|
|
185
219
|
- id: shellcheck
|
186
220
|
- id: mdformat-check
|
187
221
|
- id: mdformat
|
222
|
+
- id: actionlint
|
223
|
+
- id: validate-pyproject
|
188
224
|
```
|
189
225
|
|
190
226
|
This can be made by `ppc` command:
|
@@ -211,7 +247,7 @@ then you can run pre-commit by:
|
|
211
247
|
$ pre-commit run --all-files
|
212
248
|
```
|
213
249
|
|
214
|
-
>
|
250
|
+
> [!NOTE]
|
215
251
|
> If you are using poetry, run `poetry run pre-commit ... ` or run after `poetry shell`.
|
216
252
|
|
217
253
|
## Available ids<a name="available-ids"></a>
|
@@ -261,6 +297,10 @@ There are ids for following tools:
|
|
261
297
|
- [mdformat-gfm](https://github.com/hukkin/mdformat-gfm)
|
262
298
|
- [mdformat-frontmatter](https://github.com/butler54/mdformat-frontmatter)
|
263
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.
|
264
304
|
|
265
305
|
All tools are installed as dependencies of **pyproject-pre-commit** package.
|
266
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,26 +20,6 @@ classifiers = [
|
|
20
20
|
requires-python = ">=3.9.0"
|
21
21
|
dependencies = [
|
22
22
|
"pre-commit >= 4.0.0",
|
23
|
-
"black >= 24.3.0",
|
24
|
-
"blacken-docs >= 1.16.0",
|
25
|
-
"flake8-pyproject >= 1.2.3",
|
26
|
-
"flake8-annotations-complexity >= 0.0.8",
|
27
|
-
"flake8-bugbear >= 24.0.0",
|
28
|
-
"flake8-builtins >= 2.1.0",
|
29
|
-
"flake8-comprehensions >= 3.14.0",
|
30
|
-
"flake8-debugger >= 4.1.2",
|
31
|
-
"flake8-docstrings >= 1.7.0",
|
32
|
-
"flake8-executable >= 2.1.3",
|
33
|
-
"flake8-pep3101 >= 2.0.0",
|
34
|
-
"flake8-print >= 5.0.0",
|
35
|
-
"flake8-rst-docstrings >= 0.3.0",
|
36
|
-
"flake8-string-format >= 0.3.0",
|
37
|
-
"pep8-naming >= 0.14.0",
|
38
|
-
"pycodestyle >= 2.11.0",
|
39
|
-
"autoflake >= 2.2.1",
|
40
|
-
"autopep8 >= 2.0.4",
|
41
|
-
"isort >= 5.12.0",
|
42
|
-
"bandit[toml] >= 1.7.5",
|
43
23
|
"mypy >= 1.5.1",
|
44
24
|
"numpydoc >= 1.8.0",
|
45
25
|
"shellcheck-py >= 0.9.0.5",
|
@@ -53,6 +33,7 @@ dependencies = [
|
|
53
33
|
"mdformat-tables>=1.0.0",
|
54
34
|
"mdformat-web>=0.2.0",
|
55
35
|
"mdformat-toc>=0.3.0",
|
36
|
+
"actionlint-py>=1.7.7.23",
|
56
37
|
"validate-pyproject[all]>=0.22",
|
57
38
|
]
|
58
39
|
|
@@ -67,6 +48,52 @@ ruff = [
|
|
67
48
|
"ruff >= 0.7.2",
|
68
49
|
"mdformat-ruff >= 0.1.3",
|
69
50
|
]
|
51
|
+
black = [
|
52
|
+
"black >= 24.3.0",
|
53
|
+
"blacken-docs >= 1.16.0",
|
54
|
+
"flake8-pyproject >= 1.2.3",
|
55
|
+
"flake8-annotations-complexity >= 0.0.8",
|
56
|
+
"flake8-bugbear >= 24.0.0",
|
57
|
+
"flake8-builtins >= 2.1.0",
|
58
|
+
"flake8-comprehensions >= 3.14.0",
|
59
|
+
"flake8-debugger >= 4.1.2",
|
60
|
+
"flake8-docstrings >= 1.7.0",
|
61
|
+
"flake8-executable >= 2.1.3",
|
62
|
+
"flake8-pep3101 >= 2.0.0",
|
63
|
+
"flake8-print >= 5.0.0",
|
64
|
+
"flake8-rst-docstrings >= 0.3.0",
|
65
|
+
"flake8-string-format >= 0.3.0",
|
66
|
+
"pep8-naming >= 0.14.0",
|
67
|
+
"pycodestyle >= 2.11.0",
|
68
|
+
"autoflake >= 2.2.1",
|
69
|
+
"autopep8 >= 2.0.4",
|
70
|
+
"isort >= 5.12.0",
|
71
|
+
"bandit[toml] >= 1.7.5",
|
72
|
+
]
|
73
|
+
all = [
|
74
|
+
"ruff >= 0.7.2",
|
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",
|
96
|
+
]
|
70
97
|
|
71
98
|
[dependency-groups]
|
72
99
|
dev = [
|
@@ -75,6 +102,26 @@ dev = [
|
|
75
102
|
"pytest-xdist >= 3.3.1",
|
76
103
|
"ruff >= 0.7.2",
|
77
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",
|
78
125
|
]
|
79
126
|
|
80
127
|
[project.scripts]
|
{pyproject_pre_commit-0.3.6 → 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
|
|