pyproject-pre-commit 0.1.10__tar.gz → 0.2.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.1.10 → pyproject_pre_commit-0.2.0}/PKG-INFO +98 -55
- {pyproject_pre_commit-0.1.10 → pyproject_pre_commit-0.2.0}/README.md +95 -52
- {pyproject_pre_commit-0.1.10 → pyproject_pre_commit-0.2.0}/pyproject.toml +5 -3
- {pyproject_pre_commit-0.1.10 → pyproject_pre_commit-0.2.0}/LICENSE +0 -0
- {pyproject_pre_commit-0.1.10 → pyproject_pre_commit-0.2.0}/src/pyproject_pre_commit/__init__.py +0 -0
- {pyproject_pre_commit-0.1.10 → pyproject_pre_commit-0.2.0}/src/pyproject_pre_commit/__version__.py +0 -0
- {pyproject_pre_commit-0.1.10 → pyproject_pre_commit-0.2.0}/src/pyproject_pre_commit/py.typed +0 -0
- {pyproject_pre_commit-0.1.10 → pyproject_pre_commit-0.2.0}/src/pyproject_pre_commit/pyproject_pre_commit.py +0 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pyproject-pre-commit
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
4
4
|
Summary: pre-commit hooks for python projects using pyproject.toml.
|
|
5
5
|
Home-page: https://github.com/rcmdnk/pyproject-pre-commit
|
|
6
6
|
License: Apache-2.0
|
|
7
7
|
Keywords: pre-commit,pyproject.toml,poetry
|
|
8
8
|
Author: rcmdnk
|
|
9
9
|
Author-email: rcmdnk@gmail.com
|
|
10
|
-
Requires-Python: >=3.
|
|
10
|
+
Requires-Python: >=3.9.0,<4.0.0
|
|
11
11
|
Classifier: Development Status :: 3 - Alpha
|
|
12
12
|
Classifier: Environment :: Console
|
|
13
13
|
Classifier: Intended Audience :: Developers
|
|
@@ -44,7 +44,7 @@ Requires-Dist: mdformat-footnote (>=0.1.1,<0.2.0)
|
|
|
44
44
|
Requires-Dist: mdformat-frontmatter (>=2.0.1,<3.0.0)
|
|
45
45
|
Requires-Dist: mdformat-gfm (>=0.3.5,<0.4.0)
|
|
46
46
|
Requires-Dist: mypy (>=1.5.1,<2.0.0)
|
|
47
|
-
Requires-Dist: numpydoc (>=1.
|
|
47
|
+
Requires-Dist: numpydoc (>=1.8.0,<2.0.0)
|
|
48
48
|
Requires-Dist: pep8-naming (>=0.14.0,<0.15.0)
|
|
49
49
|
Requires-Dist: pre-commit (>=3.3.3,<4.0.0)
|
|
50
50
|
Requires-Dist: pycodestyle (>=2.11.0,<3.0.0)
|
|
@@ -57,16 +57,21 @@ Description-Content-Type: text/markdown
|
|
|
57
57
|
[](https://github.com/rcmdnk/pyproject-pre-commit/actions/workflows/test.yml)
|
|
58
58
|
[](https://github.com/rcmdnk/pyproject-pre-commit/tree/coverage)
|
|
59
59
|
|
|
60
|
-
pre-commit hooks for python projects
|
|
60
|
+
[pre-commit](https://pre-commit.com/) hooks for python projects.
|
|
61
61
|
|
|
62
62
|
**.pre-commit-hooks.yaml** provides pre-defined ids which you just need to add these ids to your **.pre-commit-config.yaml**.
|
|
63
63
|
|
|
64
|
+
By installing **pyproject-pre-commit** package,
|
|
65
|
+
all necessary tools are installed as dependencies.
|
|
66
|
+
|
|
64
67
|
## Requirement
|
|
65
68
|
|
|
66
|
-
- Python
|
|
69
|
+
- Python >= 3.8.1
|
|
67
70
|
- Poetry (For development)
|
|
68
71
|
|
|
69
|
-
##
|
|
72
|
+
## Usage
|
|
73
|
+
|
|
74
|
+
### Install pyproject-pre-commit
|
|
70
75
|
|
|
71
76
|
If your project uses poetry, do:
|
|
72
77
|
|
|
@@ -74,17 +79,92 @@ If your project uses poetry, do:
|
|
|
74
79
|
$ poetry add --group dev pyproject-pre-commit
|
|
75
80
|
```
|
|
76
81
|
|
|
77
|
-
Otherwise, install
|
|
82
|
+
Otherwise, install the package in your working environment.
|
|
83
|
+
|
|
84
|
+
If you use pip, do:
|
|
78
85
|
|
|
79
86
|
```
|
|
80
87
|
$ pip install pyproject-pre-commit
|
|
81
88
|
```
|
|
82
89
|
|
|
83
|
-
|
|
90
|
+
This will install tools for pre-commit hooks in your working environment,
|
|
91
|
+
so that you can use these tools, such as black, directly.
|
|
84
92
|
|
|
85
|
-
|
|
93
|
+
### Prepare .pre-commit-config.yaml
|
|
86
94
|
|
|
87
|
-
|
|
95
|
+
Add **https://github.com/rcmdnk/pyproject-pre-commit** to your **.pre-commit-config.yaml**, like:
|
|
96
|
+
|
|
97
|
+
```yaml
|
|
98
|
+
repos:
|
|
99
|
+
- repo: https://github.com/rcmdnk/pyproject-pre-commit
|
|
100
|
+
rev: v0.1.1
|
|
101
|
+
hooks:
|
|
102
|
+
- id: black-diff
|
|
103
|
+
- id: black
|
|
104
|
+
- id: blacken-docs
|
|
105
|
+
- id: autoflake-diff
|
|
106
|
+
- id: autoflake
|
|
107
|
+
- id: autopep8-diff
|
|
108
|
+
- id: autopep8
|
|
109
|
+
- id: isort-diff
|
|
110
|
+
- id: isort
|
|
111
|
+
- id: flake8
|
|
112
|
+
- id: bandit
|
|
113
|
+
- id: mypy
|
|
114
|
+
- id: shellcheck
|
|
115
|
+
- id: mdformat-check
|
|
116
|
+
- id: mdformat
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
By using **pyproject-pre-commit**, you can simplify your **.pre-commit-config.yaml**
|
|
120
|
+
that you need only repo of **https://github.com/rcmdnk/pyproject-pre-commit**.
|
|
121
|
+
|
|
122
|
+
These hooks uses local installation of tools, so pre-commit will use
|
|
123
|
+
tools installed in your working environment.
|
|
124
|
+
|
|
125
|
+
This can be made by `ppc` command:
|
|
126
|
+
|
|
127
|
+
```
|
|
128
|
+
$ ppc --pre-commit > .pre-commit-config.yaml
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
> \[!NOTE\]
|
|
132
|
+
> If you are using poetry, run `poetry run ppc ... ` or run after `poetry shell`.
|
|
133
|
+
|
|
134
|
+
If you already have it, add hooks w/o `repos:` by
|
|
135
|
+
|
|
136
|
+
```
|
|
137
|
+
$ ppc --pre-commit |grep -v "^repos:" >> .pre-commit-config.yaml
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
You may want to modify after adding these configurations.
|
|
141
|
+
|
|
142
|
+
### Run pre-commit
|
|
143
|
+
|
|
144
|
+
`pre-commit` command is installed as dependencies of **pyproject-pre-commit** package.
|
|
145
|
+
|
|
146
|
+
After installing **pyproject-pre-commit** package, you can run `pre-commit` command.
|
|
147
|
+
|
|
148
|
+
First, install pre-commit hooks by:
|
|
149
|
+
|
|
150
|
+
```
|
|
151
|
+
$ pre-commit install
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
then you can run pre-commit by:
|
|
155
|
+
|
|
156
|
+
```
|
|
157
|
+
$ pre-commit run --all-files
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
> \[!NOTE\]
|
|
161
|
+
> If you are using poetry, run `poetry run pre-commit ... ` or run after `poetry shell`.
|
|
162
|
+
|
|
163
|
+
## Available ids
|
|
164
|
+
|
|
165
|
+
You can find ids in **.pre-commit-hooks.yaml**.
|
|
166
|
+
|
|
167
|
+
There are ids for following tools:
|
|
88
168
|
|
|
89
169
|
- For Python
|
|
90
170
|
- black-diff: Just show Black result.
|
|
@@ -124,60 +204,23 @@ This repository has following hooks for [pre-commit](https://pre-commit.com/):
|
|
|
124
204
|
- [mdformat-frontmatter](https://github.com/butler54/mdformat-frontmatter)
|
|
125
205
|
- [mdformat-footnote](https://github.com/executablebooks/mdformat-footnote)
|
|
126
206
|
|
|
127
|
-
All tools are installed as dependencies of
|
|
207
|
+
All tools are installed as dependencies of **pyproject-pre-commit** package.
|
|
128
208
|
|
|
129
209
|
shellcheck and mdformat are given in addition to python tools
|
|
130
210
|
as they can be managed by pip and most projects have README.md
|
|
131
211
|
and some have shell scripts.
|
|
132
212
|
|
|
133
|
-
For tools which can format files, there are additional ids
|
|
134
|
-
which
|
|
135
|
-
You can see the
|
|
136
|
-
|
|
137
|
-
You can set options in pyproject.toml for all tools above:
|
|
138
|
-
|
|
139
|
-
- flake8: flake8-pyproject allows to read options from pyproject.toml
|
|
140
|
-
- bandit: There is a plugin for the flake8, but plugin version does not read options from pyproject.toml even with pyproject.toml. Therefore, use bandit directly and give `-c pyproject.toml` option in the hooks.
|
|
141
|
-
|
|
142
|
-
## .pre-commit-config.yaml
|
|
143
|
-
|
|
144
|
-
Prepare **.pre-commit-config.yaml** like:
|
|
145
|
-
|
|
146
|
-
```yaml
|
|
147
|
-
repos:
|
|
148
|
-
- repo: https://github.com/rcmdnk/pyproject-pre-commit
|
|
149
|
-
rev: v0.1.1
|
|
150
|
-
hooks:
|
|
151
|
-
- id: black-diff
|
|
152
|
-
- id: black
|
|
153
|
-
- id: blacken-docs
|
|
154
|
-
- id: autoflake-diff
|
|
155
|
-
- id: autoflake
|
|
156
|
-
- id: autopep8-diff
|
|
157
|
-
- id: autopep8
|
|
158
|
-
- id: isort-diff
|
|
159
|
-
- id: isort
|
|
160
|
-
- id: flake8
|
|
161
|
-
- id: bandit
|
|
162
|
-
- id: mypy
|
|
163
|
-
- id: shellcheck
|
|
164
|
-
- id: mdformat-check
|
|
165
|
-
- id: mdformat
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
This can be made by `ppc` command:
|
|
213
|
+
For tools which can format files, there are additional ids with `-diff` or `--check`
|
|
214
|
+
which show the results before modifying files.
|
|
215
|
+
You can see the differences after formatting if you place these ids before ids w/o `--diff` or `--check`.
|
|
169
216
|
|
|
170
|
-
|
|
171
|
-
$ ppc --pre-commit > .pre-commit-config.yaml
|
|
172
|
-
```
|
|
217
|
+
## Options for tools
|
|
173
218
|
|
|
174
|
-
|
|
219
|
+
You can set options in pyproject.toml for all tools above.
|
|
175
220
|
|
|
176
|
-
|
|
177
|
-
$ ppc --pre-commit |grep -v "^repos:" >> .pre-commit-config.yaml
|
|
178
|
-
```
|
|
221
|
+
For flake8, flake8-pyproject allows to read options from pyproject.toml
|
|
179
222
|
|
|
180
|
-
|
|
223
|
+
About bandit, there is a plugin for the flake8, but plugin version does not read options from pyproject.toml even with pyproject.toml. Therefore, use bandit directly and give `-c pyproject.toml` option in the hooks.
|
|
181
224
|
|
|
182
225
|
## pyproject.toml
|
|
183
226
|
|
|
@@ -3,16 +3,21 @@
|
|
|
3
3
|
[](https://github.com/rcmdnk/pyproject-pre-commit/actions/workflows/test.yml)
|
|
4
4
|
[](https://github.com/rcmdnk/pyproject-pre-commit/tree/coverage)
|
|
5
5
|
|
|
6
|
-
pre-commit hooks for python projects
|
|
6
|
+
[pre-commit](https://pre-commit.com/) hooks for python projects.
|
|
7
7
|
|
|
8
8
|
**.pre-commit-hooks.yaml** provides pre-defined ids which you just need to add these ids to your **.pre-commit-config.yaml**.
|
|
9
9
|
|
|
10
|
+
By installing **pyproject-pre-commit** package,
|
|
11
|
+
all necessary tools are installed as dependencies.
|
|
12
|
+
|
|
10
13
|
## Requirement
|
|
11
14
|
|
|
12
|
-
- Python
|
|
15
|
+
- Python >= 3.8.1
|
|
13
16
|
- Poetry (For development)
|
|
14
17
|
|
|
15
|
-
##
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
### Install pyproject-pre-commit
|
|
16
21
|
|
|
17
22
|
If your project uses poetry, do:
|
|
18
23
|
|
|
@@ -20,17 +25,92 @@ If your project uses poetry, do:
|
|
|
20
25
|
$ poetry add --group dev pyproject-pre-commit
|
|
21
26
|
```
|
|
22
27
|
|
|
23
|
-
Otherwise, install
|
|
28
|
+
Otherwise, install the package in your working environment.
|
|
29
|
+
|
|
30
|
+
If you use pip, do:
|
|
24
31
|
|
|
25
32
|
```
|
|
26
33
|
$ pip install pyproject-pre-commit
|
|
27
34
|
```
|
|
28
35
|
|
|
29
|
-
|
|
36
|
+
This will install tools for pre-commit hooks in your working environment,
|
|
37
|
+
so that you can use these tools, such as black, directly.
|
|
30
38
|
|
|
31
|
-
|
|
39
|
+
### Prepare .pre-commit-config.yaml
|
|
32
40
|
|
|
33
|
-
|
|
41
|
+
Add **https://github.com/rcmdnk/pyproject-pre-commit** to your **.pre-commit-config.yaml**, like:
|
|
42
|
+
|
|
43
|
+
```yaml
|
|
44
|
+
repos:
|
|
45
|
+
- repo: https://github.com/rcmdnk/pyproject-pre-commit
|
|
46
|
+
rev: v0.1.1
|
|
47
|
+
hooks:
|
|
48
|
+
- id: black-diff
|
|
49
|
+
- id: black
|
|
50
|
+
- id: blacken-docs
|
|
51
|
+
- id: autoflake-diff
|
|
52
|
+
- id: autoflake
|
|
53
|
+
- id: autopep8-diff
|
|
54
|
+
- id: autopep8
|
|
55
|
+
- id: isort-diff
|
|
56
|
+
- id: isort
|
|
57
|
+
- id: flake8
|
|
58
|
+
- id: bandit
|
|
59
|
+
- id: mypy
|
|
60
|
+
- id: shellcheck
|
|
61
|
+
- id: mdformat-check
|
|
62
|
+
- id: mdformat
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
By using **pyproject-pre-commit**, you can simplify your **.pre-commit-config.yaml**
|
|
66
|
+
that you need only repo of **https://github.com/rcmdnk/pyproject-pre-commit**.
|
|
67
|
+
|
|
68
|
+
These hooks uses local installation of tools, so pre-commit will use
|
|
69
|
+
tools installed in your working environment.
|
|
70
|
+
|
|
71
|
+
This can be made by `ppc` command:
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
$ ppc --pre-commit > .pre-commit-config.yaml
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
> \[!NOTE\]
|
|
78
|
+
> If you are using poetry, run `poetry run ppc ... ` or run after `poetry shell`.
|
|
79
|
+
|
|
80
|
+
If you already have it, add hooks w/o `repos:` by
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
$ ppc --pre-commit |grep -v "^repos:" >> .pre-commit-config.yaml
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
You may want to modify after adding these configurations.
|
|
87
|
+
|
|
88
|
+
### Run pre-commit
|
|
89
|
+
|
|
90
|
+
`pre-commit` command is installed as dependencies of **pyproject-pre-commit** package.
|
|
91
|
+
|
|
92
|
+
After installing **pyproject-pre-commit** package, you can run `pre-commit` command.
|
|
93
|
+
|
|
94
|
+
First, install pre-commit hooks by:
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
$ pre-commit install
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
then you can run pre-commit by:
|
|
101
|
+
|
|
102
|
+
```
|
|
103
|
+
$ pre-commit run --all-files
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
> \[!NOTE\]
|
|
107
|
+
> If you are using poetry, run `poetry run pre-commit ... ` or run after `poetry shell`.
|
|
108
|
+
|
|
109
|
+
## Available ids
|
|
110
|
+
|
|
111
|
+
You can find ids in **.pre-commit-hooks.yaml**.
|
|
112
|
+
|
|
113
|
+
There are ids for following tools:
|
|
34
114
|
|
|
35
115
|
- For Python
|
|
36
116
|
- black-diff: Just show Black result.
|
|
@@ -70,60 +150,23 @@ This repository has following hooks for [pre-commit](https://pre-commit.com/):
|
|
|
70
150
|
- [mdformat-frontmatter](https://github.com/butler54/mdformat-frontmatter)
|
|
71
151
|
- [mdformat-footnote](https://github.com/executablebooks/mdformat-footnote)
|
|
72
152
|
|
|
73
|
-
All tools are installed as dependencies of
|
|
153
|
+
All tools are installed as dependencies of **pyproject-pre-commit** package.
|
|
74
154
|
|
|
75
155
|
shellcheck and mdformat are given in addition to python tools
|
|
76
156
|
as they can be managed by pip and most projects have README.md
|
|
77
157
|
and some have shell scripts.
|
|
78
158
|
|
|
79
|
-
For tools which can format files, there are additional ids
|
|
80
|
-
which
|
|
81
|
-
You can see the
|
|
82
|
-
|
|
83
|
-
You can set options in pyproject.toml for all tools above:
|
|
84
|
-
|
|
85
|
-
- flake8: flake8-pyproject allows to read options from pyproject.toml
|
|
86
|
-
- bandit: There is a plugin for the flake8, but plugin version does not read options from pyproject.toml even with pyproject.toml. Therefore, use bandit directly and give `-c pyproject.toml` option in the hooks.
|
|
87
|
-
|
|
88
|
-
## .pre-commit-config.yaml
|
|
89
|
-
|
|
90
|
-
Prepare **.pre-commit-config.yaml** like:
|
|
91
|
-
|
|
92
|
-
```yaml
|
|
93
|
-
repos:
|
|
94
|
-
- repo: https://github.com/rcmdnk/pyproject-pre-commit
|
|
95
|
-
rev: v0.1.1
|
|
96
|
-
hooks:
|
|
97
|
-
- id: black-diff
|
|
98
|
-
- id: black
|
|
99
|
-
- id: blacken-docs
|
|
100
|
-
- id: autoflake-diff
|
|
101
|
-
- id: autoflake
|
|
102
|
-
- id: autopep8-diff
|
|
103
|
-
- id: autopep8
|
|
104
|
-
- id: isort-diff
|
|
105
|
-
- id: isort
|
|
106
|
-
- id: flake8
|
|
107
|
-
- id: bandit
|
|
108
|
-
- id: mypy
|
|
109
|
-
- id: shellcheck
|
|
110
|
-
- id: mdformat-check
|
|
111
|
-
- id: mdformat
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
This can be made by `ppc` command:
|
|
159
|
+
For tools which can format files, there are additional ids with `-diff` or `--check`
|
|
160
|
+
which show the results before modifying files.
|
|
161
|
+
You can see the differences after formatting if you place these ids before ids w/o `--diff` or `--check`.
|
|
115
162
|
|
|
116
|
-
|
|
117
|
-
$ ppc --pre-commit > .pre-commit-config.yaml
|
|
118
|
-
```
|
|
163
|
+
## Options for tools
|
|
119
164
|
|
|
120
|
-
|
|
165
|
+
You can set options in pyproject.toml for all tools above.
|
|
121
166
|
|
|
122
|
-
|
|
123
|
-
$ ppc --pre-commit |grep -v "^repos:" >> .pre-commit-config.yaml
|
|
124
|
-
```
|
|
167
|
+
For flake8, flake8-pyproject allows to read options from pyproject.toml
|
|
125
168
|
|
|
126
|
-
|
|
169
|
+
About bandit, there is a plugin for the flake8, but plugin version does not read options from pyproject.toml even with pyproject.toml. Therefore, use bandit directly and give `-c pyproject.toml` option in the hooks.
|
|
127
170
|
|
|
128
171
|
## pyproject.toml
|
|
129
172
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "pyproject-pre-commit"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.2.0"
|
|
4
4
|
description = "pre-commit hooks for python projects using pyproject.toml."
|
|
5
5
|
authors = ["rcmdnk <rcmdnk@gmail.com>"]
|
|
6
6
|
repository = "https://github.com/rcmdnk/pyproject-pre-commit"
|
|
@@ -19,7 +19,7 @@ classifiers = [
|
|
|
19
19
|
]
|
|
20
20
|
|
|
21
21
|
[tool.poetry.dependencies]
|
|
22
|
-
python = "^3.
|
|
22
|
+
python = "^3.9.0"
|
|
23
23
|
pre-commit = "^3.3.3"
|
|
24
24
|
black = "^24.3.0"
|
|
25
25
|
blacken-docs = "^1.16.0"
|
|
@@ -42,7 +42,7 @@ autopep8 = "^2.0.4"
|
|
|
42
42
|
isort = "^5.12.0"
|
|
43
43
|
mypy = "^1.5.1"
|
|
44
44
|
bandit = {extras = ["toml"], version = "^1.7.5"}
|
|
45
|
-
numpydoc = "^1.
|
|
45
|
+
numpydoc = "^1.8.0"
|
|
46
46
|
shellcheck-py = "^0.9.0.5"
|
|
47
47
|
mdformat = "^0.7.17"
|
|
48
48
|
mdformat-gfm = "^0.3.5"
|
|
@@ -100,6 +100,8 @@ strict = true
|
|
|
100
100
|
warn_return_any = false
|
|
101
101
|
ignore_missing_imports = true
|
|
102
102
|
scripts_are_modules = true
|
|
103
|
+
install_types = true
|
|
104
|
+
non_interactive = true
|
|
103
105
|
|
|
104
106
|
[tool.numpydoc_validation]
|
|
105
107
|
checks = [
|
|
File without changes
|
{pyproject_pre_commit-0.1.10 → pyproject_pre_commit-0.2.0}/src/pyproject_pre_commit/__init__.py
RENAMED
|
File without changes
|
{pyproject_pre_commit-0.1.10 → pyproject_pre_commit-0.2.0}/src/pyproject_pre_commit/__version__.py
RENAMED
|
File without changes
|
{pyproject_pre_commit-0.1.10 → pyproject_pre_commit-0.2.0}/src/pyproject_pre_commit/py.typed
RENAMED
|
File without changes
|
|
File without changes
|