pyproject-pre-commit 0.2.5__py3-none-any.whl → 0.3.0__py3-none-any.whl
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/pyproject_pre_commit.py +83 -19
- {pyproject_pre_commit-0.2.5.dist-info → pyproject_pre_commit-0.3.0.dist-info}/METADATA +39 -47
- pyproject_pre_commit-0.3.0.dist-info/RECORD +8 -0
- {pyproject_pre_commit-0.2.5.dist-info → pyproject_pre_commit-0.3.0.dist-info}/WHEEL +1 -1
- pyproject_pre_commit-0.2.5.dist-info/RECORD +0 -9
- pyproject_pre_commit-0.2.5.dist-info/entry_points.txt +0 -3
- {pyproject_pre_commit-0.2.5.dist-info → pyproject_pre_commit-0.3.0.dist-info/licenses}/LICENSE +0 -0
@@ -3,9 +3,22 @@ import sys
|
|
3
3
|
from . import __version__
|
4
4
|
|
5
5
|
|
6
|
-
def pre_commit() -> None:
|
7
|
-
|
8
|
-
|
6
|
+
def pre_commit(is_ruff: bool) -> None:
|
7
|
+
if is_ruff:
|
8
|
+
print( # noqa: T201
|
9
|
+
f"""repos:
|
10
|
+
- repo: https://github.com/rcmdnk/pyproject-pre-commit
|
11
|
+
rev: v{__version__}
|
12
|
+
hooks:
|
13
|
+
- id: ruff-lint-diff
|
14
|
+
- id: ruff-lint
|
15
|
+
- id: ruff-format-diff
|
16
|
+
- id: ruff-format
|
17
|
+
"""
|
18
|
+
)
|
19
|
+
else:
|
20
|
+
print( # noqa: T201
|
21
|
+
f"""repos:
|
9
22
|
- repo: https://github.com/rcmdnk/pyproject-pre-commit
|
10
23
|
rev: v{__version__}
|
11
24
|
hooks:
|
@@ -20,7 +33,10 @@ def pre_commit() -> None:
|
|
20
33
|
- id: isort
|
21
34
|
- id: flake8
|
22
35
|
- id: bandit
|
23
|
-
|
36
|
+
"""
|
37
|
+
)
|
38
|
+
print( # noqa: T201
|
39
|
+
"""- id: mypy
|
24
40
|
- id: numpydoc-validation
|
25
41
|
- id: shellcheck
|
26
42
|
- id: mdformat-check
|
@@ -29,9 +45,57 @@ def pre_commit() -> None:
|
|
29
45
|
)
|
30
46
|
|
31
47
|
|
32
|
-
def pyproject() -> None:
|
33
|
-
|
34
|
-
|
48
|
+
def pyproject(is_ruff: bool) -> None:
|
49
|
+
if is_ruff:
|
50
|
+
print( # noqa: T201
|
51
|
+
"""[tool.ruff]
|
52
|
+
line-length = 79
|
53
|
+
# quote-style = "single"
|
54
|
+
|
55
|
+
[tool.ruff.lint]
|
56
|
+
## select = ["ALL"]
|
57
|
+
## select = ["E4", "E7", "E9", "F"] # default, black compatible
|
58
|
+
select = [ # similar options to black, flake8 + plugins, isort etc...)
|
59
|
+
#"E4", # Import (comparable to black)
|
60
|
+
#"E7", # Indentation (comparable to black)
|
61
|
+
#"E9", # Blank line (comparable to black)
|
62
|
+
"F", # String (comparable to black)
|
63
|
+
"I", # Import order (comparable to isort)
|
64
|
+
"S", # flake8-bandit (comparable to bandit)
|
65
|
+
"B", # flake8-bugbear
|
66
|
+
"A", # flake8-builtins
|
67
|
+
"C4", # flake8-comprehensions
|
68
|
+
"T10", # flake8-debugger
|
69
|
+
"EXE", # flake8-executable
|
70
|
+
"T20", # flake8-print
|
71
|
+
"N", # pep8-naming
|
72
|
+
"E", # pycodestyle
|
73
|
+
"W", # pycodestyle
|
74
|
+
"C90", # mccabe
|
75
|
+
]
|
76
|
+
|
77
|
+
ignore = [
|
78
|
+
"E203", # Not PEP8 compliant and black insert space around slice: [Frequently Asked Questions - Black 22.12.0 documentation](https://black.readthedocs.io/en/stable/faq.html#why-are-flake8-s-e203-and-w503-violated)
|
79
|
+
"E501", # Line too long. Disable it to allow long lines of comments and print lines which black allows.
|
80
|
+
# "E704", # NOT in ruff. multiple statements on one line (def). This is inconsistent with black >= 24.1.1 (see ttps://github.com/psf/black/pull/3796)
|
81
|
+
# "W503", # NOT in ruff. is the counter part of W504, which follows current PEP8: [Line break occurred before a binary operator (W503)](https://www.flake8rules.com/rules/W503.html)
|
82
|
+
"D100", "D102", "D103", "D104", "D105", "D106", # Missing docstrings other than class (D101)
|
83
|
+
"D401", # First line should be in imperative mood
|
84
|
+
]
|
85
|
+
|
86
|
+
[tool.ruff.lint.per-file-ignores]
|
87
|
+
"tests/**" = ["S101"]
|
88
|
+
|
89
|
+
[tool.ruff.lint.mccabe]
|
90
|
+
max-complexity = 10
|
91
|
+
|
92
|
+
[tool.ruff.format]
|
93
|
+
docstring-code-format = true
|
94
|
+
"""
|
95
|
+
)
|
96
|
+
else:
|
97
|
+
print( # noqa: T201
|
98
|
+
"""[tool.black]
|
35
99
|
line-length = 79
|
36
100
|
|
37
101
|
[tool.autoflake]
|
@@ -58,8 +122,10 @@ docstring-convention = "numpy"
|
|
58
122
|
[tool.bandit]
|
59
123
|
targets = "."
|
60
124
|
exclude = "tests"
|
61
|
-
|
62
|
-
|
125
|
+
"""
|
126
|
+
)
|
127
|
+
print( # noqa: T201
|
128
|
+
"""[tool.mypy]
|
63
129
|
files = "src/**/*.py"
|
64
130
|
strict = true
|
65
131
|
warn_return_any = false
|
@@ -72,19 +138,17 @@ non_interactive = true
|
|
72
138
|
|
73
139
|
|
74
140
|
def main() -> None:
|
141
|
+
usage = "Usage: ppc <--pre-commit | --pyproject> [--ruff] [--black]"
|
75
142
|
if len(sys.argv) != 2:
|
76
|
-
print( # noqa: T201
|
77
|
-
"Please specify only one of --pre-commit and --pyproject."
|
78
|
-
)
|
143
|
+
print(usage) # noqa: T201
|
79
144
|
sys.exit(1)
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
145
|
+
is_ruff = "--ruff" in sys.argv
|
146
|
+
if "--pre-commit" in sys.argv:
|
147
|
+
pre_commit(is_ruff)
|
148
|
+
elif "--pyproject" in sys.argv:
|
149
|
+
pyproject(is_ruff)
|
84
150
|
else:
|
85
|
-
print( # noqa: T201
|
86
|
-
"Please specify only one of --pre-commit and --pyproject."
|
87
|
-
)
|
151
|
+
print(usage) # noqa: T201
|
88
152
|
sys.exit(1)
|
89
153
|
|
90
154
|
|
@@ -1,56 +1,49 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.3
|
2
2
|
Name: pyproject-pre-commit
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.3.0
|
4
4
|
Summary: pre-commit hooks for python projects using pyproject.toml.
|
5
|
-
|
6
|
-
License: Apache-2.0
|
7
|
-
|
8
|
-
|
9
|
-
Author-email: rcmdnk@gmail.com
|
10
|
-
Requires-Python: >=3.9.0,<4.0.0
|
5
|
+
Author-email: rcmdnk <rcmdnk@gmail.com>
|
6
|
+
License-Expression: Apache-2.0
|
7
|
+
License-File: LICENSE
|
8
|
+
Keywords: poetry,pre-commit,pyproject.toml
|
11
9
|
Classifier: Development Status :: 3 - Alpha
|
12
10
|
Classifier: Environment :: Console
|
13
11
|
Classifier: Intended Audience :: Developers
|
14
|
-
Classifier: License :: OSI Approved :: Apache Software License
|
15
12
|
Classifier: Operating System :: OS Independent
|
16
|
-
Classifier: Programming Language :: Python :: 3
|
17
|
-
Classifier: Programming Language :: Python :: 3.9
|
18
|
-
Classifier: Programming Language :: Python :: 3.10
|
19
|
-
Classifier: Programming Language :: Python :: 3.11
|
20
|
-
Classifier: Programming Language :: Python :: 3.12
|
21
|
-
Classifier: Programming Language :: Python :: 3.13
|
22
13
|
Classifier: Topic :: Software Development
|
23
14
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
24
15
|
Classifier: Topic :: Utilities
|
25
|
-
Requires-
|
26
|
-
Requires-Dist:
|
27
|
-
Requires-Dist:
|
28
|
-
Requires-Dist:
|
29
|
-
Requires-Dist:
|
30
|
-
Requires-Dist:
|
31
|
-
Requires-Dist: flake8-
|
32
|
-
Requires-Dist: flake8-
|
33
|
-
Requires-Dist: flake8-
|
34
|
-
Requires-Dist: flake8-
|
35
|
-
Requires-Dist: flake8-
|
36
|
-
Requires-Dist: flake8-
|
37
|
-
Requires-Dist: flake8-
|
38
|
-
Requires-Dist: flake8-
|
39
|
-
Requires-Dist: flake8-
|
40
|
-
Requires-Dist: flake8-
|
41
|
-
Requires-Dist: flake8-
|
42
|
-
Requires-Dist:
|
43
|
-
Requires-Dist:
|
44
|
-
Requires-Dist: mdformat-footnote
|
45
|
-
Requires-Dist: mdformat-frontmatter
|
46
|
-
Requires-Dist: mdformat-gfm
|
47
|
-
Requires-Dist:
|
48
|
-
Requires-Dist:
|
49
|
-
Requires-Dist:
|
50
|
-
Requires-Dist:
|
51
|
-
Requires-Dist:
|
52
|
-
Requires-Dist:
|
53
|
-
|
16
|
+
Requires-Python: >=3.9.0
|
17
|
+
Requires-Dist: autoflake>=2.2.1
|
18
|
+
Requires-Dist: autopep8>=2.0.4
|
19
|
+
Requires-Dist: bandit[toml]>=1.7.5
|
20
|
+
Requires-Dist: black>=24.3.0
|
21
|
+
Requires-Dist: blacken-docs>=1.16.0
|
22
|
+
Requires-Dist: flake8-annotations-complexity>=0.0.8
|
23
|
+
Requires-Dist: flake8-bugbear>=24.0.0
|
24
|
+
Requires-Dist: flake8-builtins>=2.1.0
|
25
|
+
Requires-Dist: flake8-comprehensions>=3.14.0
|
26
|
+
Requires-Dist: flake8-debugger>=4.1.2
|
27
|
+
Requires-Dist: flake8-docstrings>=1.7.0
|
28
|
+
Requires-Dist: flake8-executable>=2.1.3
|
29
|
+
Requires-Dist: flake8-pep3101>=2.0.0
|
30
|
+
Requires-Dist: flake8-print>=5.0.0
|
31
|
+
Requires-Dist: flake8-pyproject>=1.2.3
|
32
|
+
Requires-Dist: flake8-rst-docstrings>=0.3.0
|
33
|
+
Requires-Dist: flake8-string-format>=0.3.0
|
34
|
+
Requires-Dist: isort>=5.12.0
|
35
|
+
Requires-Dist: mdformat-footnote>=0.1.1
|
36
|
+
Requires-Dist: mdformat-frontmatter>=2.0.1
|
37
|
+
Requires-Dist: mdformat-gfm>=0.3.5
|
38
|
+
Requires-Dist: mdformat>=0.7.17
|
39
|
+
Requires-Dist: mypy>=1.5.1
|
40
|
+
Requires-Dist: numpydoc>=1.8.0
|
41
|
+
Requires-Dist: pep8-naming>=0.14.0
|
42
|
+
Requires-Dist: pre-commit>=4.0.0
|
43
|
+
Requires-Dist: pycodestyle>=2.11.0
|
44
|
+
Requires-Dist: shellcheck-py>=0.9.0.5
|
45
|
+
Provides-Extra: ruff
|
46
|
+
Requires-Dist: ruff>=0.7.2; extra == 'ruff'
|
54
47
|
Description-Content-Type: text/markdown
|
55
48
|
|
56
49
|
# pyproject-pre-commit
|
@@ -67,7 +60,7 @@ all necessary tools are installed as dependencies.
|
|
67
60
|
|
68
61
|
## Requirement
|
69
62
|
|
70
|
-
- Python >= 3.
|
63
|
+
- Python >= 3.9.0
|
71
64
|
- Poetry (For development)
|
72
65
|
|
73
66
|
## Usage
|
@@ -98,7 +91,7 @@ Add **https://github.com/rcmdnk/pyproject-pre-commit** to your **.pre-commit-con
|
|
98
91
|
```yaml
|
99
92
|
repos:
|
100
93
|
- repo: https://github.com/rcmdnk/pyproject-pre-commit
|
101
|
-
rev: v0.
|
94
|
+
rev: v0.3.0
|
102
95
|
hooks:
|
103
96
|
- id: black-diff
|
104
97
|
- id: black
|
@@ -234,4 +227,3 @@ $ ppc --pyproject >> pyproject.toml
|
|
234
227
|
```
|
235
228
|
|
236
229
|
You may want to modify after adding these configurations.
|
237
|
-
|
@@ -0,0 +1,8 @@
|
|
1
|
+
pyproject_pre_commit/__init__.py,sha256=rUeC_hXVqI0tVQ-QyGHvz0r9qkZHCG2D0Mql5Wu5udc,111
|
2
|
+
pyproject_pre_commit/__version__.py,sha256=IHT4mKrIr8eV-C3HtmIVD85iGVH25n2ohoff31kaJ1A,93
|
3
|
+
pyproject_pre_commit/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
4
|
+
pyproject_pre_commit/pyproject_pre_commit.py,sha256=AeMBDaJrcSyEVxB3g5V5d79ZvN_7zhyeEpr5mWP6Oyw,3962
|
5
|
+
pyproject_pre_commit-0.3.0.dist-info/METADATA,sha256=qnV2Ca-wFn_7EAhfsKNRmPHRZQktAh3_mK5Ik7sxwIo,8258
|
6
|
+
pyproject_pre_commit-0.3.0.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
|
7
|
+
pyproject_pre_commit-0.3.0.dist-info/licenses/LICENSE,sha256=KPHimGp4ehdaHn7s0RrnWAqKefaRTu5b_zUz7cGVuo8,11337
|
8
|
+
pyproject_pre_commit-0.3.0.dist-info/RECORD,,
|
@@ -1,9 +0,0 @@
|
|
1
|
-
pyproject_pre_commit/__init__.py,sha256=rUeC_hXVqI0tVQ-QyGHvz0r9qkZHCG2D0Mql5Wu5udc,111
|
2
|
-
pyproject_pre_commit/__version__.py,sha256=IHT4mKrIr8eV-C3HtmIVD85iGVH25n2ohoff31kaJ1A,93
|
3
|
-
pyproject_pre_commit/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
4
|
-
pyproject_pre_commit/pyproject_pre_commit.py,sha256=QkkNiKdmRnZrY41uFgCQTLGCICeuCE9_pPbkYNnS2rA,1783
|
5
|
-
pyproject_pre_commit-0.2.5.dist-info/LICENSE,sha256=KPHimGp4ehdaHn7s0RrnWAqKefaRTu5b_zUz7cGVuo8,11337
|
6
|
-
pyproject_pre_commit-0.2.5.dist-info/METADATA,sha256=aYUQKKu__-8MeetzZhc3yM2wN3vm60zSsZJY3_2phaM,8955
|
7
|
-
pyproject_pre_commit-0.2.5.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
8
|
-
pyproject_pre_commit-0.2.5.dist-info/entry_points.txt,sha256=WQsPu5pqy5JVtCv-HsGY_1dzPyCrugD9_7PicX_t8c0,49
|
9
|
-
pyproject_pre_commit-0.2.5.dist-info/RECORD,,
|
{pyproject_pre_commit-0.2.5.dist-info → pyproject_pre_commit-0.3.0.dist-info/licenses}/LICENSE
RENAMED
File without changes
|