dycw-pre-commit-hooks 0.8.26__tar.gz → 0.8.29__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.
Potentially problematic release.
This version of dycw-pre-commit-hooks might be problematic. Click here for more details.
- dycw_pre_commit_hooks-0.8.29/.envrc +1 -0
- {dycw_pre_commit_hooks-0.8.26 → dycw_pre_commit_hooks-0.8.29}/.pre-commit-config.yaml +34 -10
- {dycw_pre_commit_hooks-0.8.26 → dycw_pre_commit_hooks-0.8.29}/PKG-INFO +11 -11
- dycw_pre_commit_hooks-0.8.29/pre_commit_hooks/__init__.py +1 -0
- {dycw_pre_commit_hooks-0.8.26 → dycw_pre_commit_hooks-0.8.29}/pre_commit_hooks/common.py +17 -10
- {dycw_pre_commit_hooks-0.8.26 → dycw_pre_commit_hooks-0.8.29}/pre_commit_hooks/run_bump2version/__init__.py +12 -9
- {dycw_pre_commit_hooks-0.8.26 → dycw_pre_commit_hooks-0.8.29}/pre_commit_hooks/run_dockfmt/__init__.py +10 -9
- {dycw_pre_commit_hooks-0.8.26 → dycw_pre_commit_hooks-0.8.29}/pre_commit_hooks/run_hatch_version/__init__.py +7 -11
- {dycw_pre_commit_hooks-0.8.26 → dycw_pre_commit_hooks-0.8.29}/pre_commit_hooks/run_pip_compile/__init__.py +27 -45
- dycw_pre_commit_hooks-0.8.29/pyproject.toml +201 -0
- dycw_pre_commit_hooks-0.8.29/requirements-dev.txt +178 -0
- dycw_pre_commit_hooks-0.8.29/requirements.txt +22 -0
- dycw_pre_commit_hooks-0.8.29/scripts/try-hatch-version.sh +9 -0
- dycw_pre_commit_hooks-0.8.29/scripts/try-run-bump2version.sh +9 -0
- dycw_pre_commit_hooks-0.8.29/scripts/try-run-dockfmt.sh +9 -0
- dycw_pre_commit_hooks-0.8.29/scripts/try-run-pip-compile.sh +9 -0
- dycw_pre_commit_hooks-0.8.26/.envrc +0 -1
- dycw_pre_commit_hooks-0.8.26/pre_commit_hooks/__init__.py +0 -1
- dycw_pre_commit_hooks-0.8.26/pyproject.toml +0 -139
- dycw_pre_commit_hooks-0.8.26/requirements-dev.in +0 -8
- dycw_pre_commit_hooks-0.8.26/requirements.in +0 -7
- dycw_pre_commit_hooks-0.8.26/requirements.txt +0 -73
- {dycw_pre_commit_hooks-0.8.26 → dycw_pre_commit_hooks-0.8.29}/.github/workflows/push.yml +0 -0
- {dycw_pre_commit_hooks-0.8.26 → dycw_pre_commit_hooks-0.8.29}/.gitignore +0 -0
- {dycw_pre_commit_hooks-0.8.26 → dycw_pre_commit_hooks-0.8.29}/.pre-commit-hooks.yaml +0 -0
- {dycw_pre_commit_hooks-0.8.26 → dycw_pre_commit_hooks-0.8.29}/.rgignore +0 -0
- {dycw_pre_commit_hooks-0.8.26 → dycw_pre_commit_hooks-0.8.29}/README.md +0 -0
- {dycw_pre_commit_hooks-0.8.26 → dycw_pre_commit_hooks-0.8.29}/pre_commit_hooks/py.typed +0 -0
- {dycw_pre_commit_hooks-0.8.26 → dycw_pre_commit_hooks-0.8.29}/pre_commit_hooks/run_bump2version/__main__.py +0 -0
- {dycw_pre_commit_hooks-0.8.26 → dycw_pre_commit_hooks-0.8.29}/pre_commit_hooks/run_dockfmt/__main__.py +0 -0
- {dycw_pre_commit_hooks-0.8.26 → dycw_pre_commit_hooks-0.8.29}/pre_commit_hooks/run_hatch_version/__main__.py +0 -0
- {dycw_pre_commit_hooks-0.8.26 → dycw_pre_commit_hooks-0.8.29}/pre_commit_hooks/run_pip_compile/__main__.py +0 -0
- {dycw_pre_commit_hooks-0.8.26 → dycw_pre_commit_hooks-0.8.29}/tests/__init__.py +0 -0
- {dycw_pre_commit_hooks-0.8.26 → dycw_pre_commit_hooks-0.8.29}/tests/test_main.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
layout pyenv 3.11.5
|
|
@@ -1,15 +1,23 @@
|
|
|
1
1
|
repos:
|
|
2
2
|
# fixers
|
|
3
3
|
- repo: https://github.com/charliermarsh/ruff-pre-commit
|
|
4
|
-
rev: v0.0.
|
|
4
|
+
rev: v0.0.291
|
|
5
5
|
hooks:
|
|
6
6
|
- id: ruff
|
|
7
7
|
args: [--fix]
|
|
8
8
|
- repo: https://github.com/dycw/pre-commit-hooks
|
|
9
|
-
rev: 0.8.
|
|
9
|
+
rev: 0.8.28
|
|
10
10
|
hooks:
|
|
11
11
|
- id: run-hatch-version
|
|
12
|
-
|
|
12
|
+
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
|
|
13
|
+
rev: v2.10.0
|
|
14
|
+
hooks:
|
|
15
|
+
- id: pretty-format-toml
|
|
16
|
+
args: [--autofix, --trailing-commas]
|
|
17
|
+
- repo: https://github.com/pre-commit/mirrors-prettier
|
|
18
|
+
rev: v3.0.3
|
|
19
|
+
hooks:
|
|
20
|
+
- id: prettier
|
|
13
21
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
14
22
|
rev: v4.4.0
|
|
15
23
|
hooks:
|
|
@@ -24,22 +32,18 @@ repos:
|
|
|
24
32
|
args: [--fix=lf]
|
|
25
33
|
- id: no-commit-to-branch
|
|
26
34
|
- id: trailing-whitespace
|
|
27
|
-
- repo: https://github.com/pre-commit/mirrors-prettier
|
|
28
|
-
rev: v3.0.0-alpha.6
|
|
29
|
-
hooks:
|
|
30
|
-
- id: prettier
|
|
31
35
|
- repo: https://github.com/psf/black
|
|
32
|
-
rev: 23.
|
|
36
|
+
rev: 23.9.1
|
|
33
37
|
hooks:
|
|
34
38
|
- id: black
|
|
35
39
|
- id: black-jupyter
|
|
36
40
|
# linters
|
|
37
41
|
- repo: https://github.com/andreoliwa/nitpick
|
|
38
|
-
rev: v0.
|
|
42
|
+
rev: v0.34.0
|
|
39
43
|
hooks:
|
|
40
44
|
- id: nitpick-check
|
|
41
45
|
- repo: https://github.com/shellcheck-py/shellcheck-py
|
|
42
|
-
rev: v0.9.0.
|
|
46
|
+
rev: v0.9.0.6
|
|
43
47
|
hooks:
|
|
44
48
|
- id: shellcheck
|
|
45
49
|
- repo: local
|
|
@@ -49,3 +53,23 @@ repos:
|
|
|
49
53
|
entry: pyright
|
|
50
54
|
language: system
|
|
51
55
|
types: [python]
|
|
56
|
+
# compile
|
|
57
|
+
- repo: https://github.com/jazzband/pip-tools
|
|
58
|
+
rev: 7.3.0
|
|
59
|
+
hooks:
|
|
60
|
+
- id: pip-compile
|
|
61
|
+
args:
|
|
62
|
+
- --allow-unsafe
|
|
63
|
+
- --quiet
|
|
64
|
+
- --upgrade
|
|
65
|
+
- pyproject.toml
|
|
66
|
+
files: ^pyproject\.toml$
|
|
67
|
+
- id: pip-compile
|
|
68
|
+
args:
|
|
69
|
+
- --allow-unsafe
|
|
70
|
+
- --extra=dev
|
|
71
|
+
- --output-file=requirements-dev.txt
|
|
72
|
+
- --quiet
|
|
73
|
+
- --upgrade
|
|
74
|
+
- pyproject.toml
|
|
75
|
+
files: ^pyproject\.toml$
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: dycw-pre-commit-hooks
|
|
3
|
-
Version: 0.8.
|
|
3
|
+
Version: 0.8.29
|
|
4
4
|
Author-email: Derek Wan <d.wan@icloud.com>
|
|
5
|
-
Requires-Python: >=3.
|
|
6
|
-
Requires-Dist:
|
|
7
|
-
Requires-Dist:
|
|
8
|
-
Requires-Dist:
|
|
9
|
-
Requires-Dist:
|
|
10
|
-
|
|
11
|
-
Requires-Dist:
|
|
12
|
-
Requires-Dist:
|
|
13
|
-
Requires-Dist:
|
|
14
|
-
Requires-Dist:
|
|
5
|
+
Requires-Python: >=3.11
|
|
6
|
+
Requires-Dist: dycw-utilities[click,loguru,semver]<0.14,>=0.13.3
|
|
7
|
+
Requires-Dist: semver<3.1,>=3.0.1
|
|
8
|
+
Requires-Dist: tomlkit<0.13,>=0.12.1
|
|
9
|
+
Requires-Dist: xdg<6.1,>=6.0.0
|
|
10
|
+
Provides-Extra: dev
|
|
11
|
+
Requires-Dist: dycw-utilities[test]; extra == 'dev'
|
|
12
|
+
Requires-Dist: hatch; extra == 'dev'
|
|
13
|
+
Requires-Dist: pip-tools; extra == 'dev'
|
|
14
|
+
Requires-Dist: pre-commit; extra == 'dev'
|
|
15
15
|
Description-Content-Type: text/markdown
|
|
16
16
|
|
|
17
17
|
# pre-commit-hooks
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.8.29"
|
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
from hashlib import md5
|
|
2
2
|
from pathlib import Path
|
|
3
|
-
from re import MULTILINE
|
|
3
|
+
from re import MULTILINE
|
|
4
|
+
from re import findall
|
|
4
5
|
from subprocess import check_output
|
|
5
|
-
from typing import Literal
|
|
6
|
+
from typing import Literal
|
|
6
7
|
|
|
7
|
-
from beartype import beartype
|
|
8
8
|
from semver import VersionInfo
|
|
9
|
+
from utilities.git import get_repo_root
|
|
9
10
|
from xdg import xdg_cache_home
|
|
10
11
|
|
|
12
|
+
PYPROJECT_TOML = get_repo_root().joinpath("pyproject.toml")
|
|
13
|
+
|
|
11
14
|
|
|
12
|
-
@beartype
|
|
13
15
|
def check_versions(
|
|
14
16
|
path: Path,
|
|
15
17
|
pattern: str,
|
|
16
18
|
/,
|
|
17
19
|
*,
|
|
18
20
|
name: Literal["run-bump2version", "run-hatch-version"],
|
|
19
|
-
) ->
|
|
21
|
+
) -> VersionInfo | None:
|
|
20
22
|
"""Check the versions: current & master.
|
|
21
23
|
|
|
22
24
|
If the current is a correct bumping of master, then return `None`. Else,
|
|
@@ -31,14 +33,12 @@ def check_versions(
|
|
|
31
33
|
return patched
|
|
32
34
|
|
|
33
35
|
|
|
34
|
-
@beartype
|
|
35
36
|
def _parse_version(pattern: str, text: str, /) -> VersionInfo:
|
|
36
37
|
"""Parse the version from a block of text."""
|
|
37
38
|
(match,) = findall(pattern, text, flags=MULTILINE)
|
|
38
39
|
return VersionInfo.parse(match)
|
|
39
40
|
|
|
40
41
|
|
|
41
|
-
@beartype
|
|
42
42
|
def _get_master_version(
|
|
43
43
|
path: Path,
|
|
44
44
|
pattern: str,
|
|
@@ -46,15 +46,22 @@ def _get_master_version(
|
|
|
46
46
|
*,
|
|
47
47
|
name: Literal["run-bump2version", "run-hatch-version"],
|
|
48
48
|
) -> VersionInfo:
|
|
49
|
-
repo = md5(
|
|
50
|
-
|
|
49
|
+
repo = md5(
|
|
50
|
+
Path.cwd().as_posix().encode(), usedforsecurity=False
|
|
51
|
+
).hexdigest()
|
|
52
|
+
commit = check_output(
|
|
53
|
+
["git", "rev-parse", "origin/master"], text=True # noqa: S603, S607
|
|
54
|
+
).rstrip("\n")
|
|
51
55
|
cache = xdg_cache_home().joinpath("pre-commit-hooks", name, repo, commit)
|
|
52
56
|
try:
|
|
53
57
|
with cache.open() as fh:
|
|
54
58
|
return VersionInfo.parse(fh.read())
|
|
55
59
|
except FileNotFoundError:
|
|
56
60
|
cache.parent.mkdir(parents=True, exist_ok=True)
|
|
57
|
-
text = check_output(
|
|
61
|
+
text = check_output(
|
|
62
|
+
["git", "show", f"{commit}:{path.as_posix()}"], # noqa: S603, S607
|
|
63
|
+
text=True,
|
|
64
|
+
)
|
|
58
65
|
version = _parse_version(pattern, text)
|
|
59
66
|
with cache.open(mode="w") as fh:
|
|
60
67
|
_ = fh.write(str(version))
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
from pathlib import Path
|
|
2
|
-
from subprocess import PIPE
|
|
2
|
+
from subprocess import PIPE
|
|
3
|
+
from subprocess import STDOUT
|
|
4
|
+
from subprocess import CalledProcessError
|
|
5
|
+
from subprocess import check_call
|
|
3
6
|
|
|
4
|
-
from
|
|
5
|
-
from click import
|
|
7
|
+
from click import command
|
|
8
|
+
from click import option
|
|
6
9
|
from loguru import logger
|
|
7
10
|
|
|
8
11
|
from pre_commit_hooks.common import check_versions
|
|
@@ -10,15 +13,15 @@ from pre_commit_hooks.common import check_versions
|
|
|
10
13
|
|
|
11
14
|
@command()
|
|
12
15
|
@option(
|
|
13
|
-
"--setup-cfg",
|
|
16
|
+
"--setup-cfg",
|
|
17
|
+
is_flag=True,
|
|
18
|
+
help="Read `setup.cfg` instead of `bumpversion.cfg`",
|
|
14
19
|
)
|
|
15
|
-
@beartype
|
|
16
20
|
def main(*, setup_cfg: bool) -> bool:
|
|
17
21
|
"""CLI for the `run_bump2version` hook."""
|
|
18
22
|
return _process(setup_cfg=setup_cfg)
|
|
19
23
|
|
|
20
24
|
|
|
21
|
-
@beartype
|
|
22
25
|
def _process(*, setup_cfg: bool) -> bool:
|
|
23
26
|
filename = "setup.cfg" if setup_cfg else ".bumpversion.cfg"
|
|
24
27
|
path = Path(filename)
|
|
@@ -28,13 +31,14 @@ def _process(*, setup_cfg: bool) -> bool:
|
|
|
28
31
|
return True
|
|
29
32
|
cmd = ["bump2version", "--allow-dirty", f"--new-version={version}", "patch"]
|
|
30
33
|
try:
|
|
31
|
-
_ = check_call(cmd, stdout=PIPE, stderr=STDOUT)
|
|
34
|
+
_ = check_call(cmd, stdout=PIPE, stderr=STDOUT) # noqa: S603
|
|
32
35
|
except CalledProcessError as error:
|
|
33
36
|
if error.returncode != 1:
|
|
34
37
|
logger.exception("Failed to run {cmd!r}", cmd=" ".join(cmd))
|
|
35
38
|
except FileNotFoundError:
|
|
36
39
|
logger.exception(
|
|
37
|
-
"Failed to run {cmd!r}. Is `bump2version` installed?",
|
|
40
|
+
"Failed to run {cmd!r}. Is `bump2version` installed?",
|
|
41
|
+
cmd=" ".join(cmd),
|
|
38
42
|
)
|
|
39
43
|
else:
|
|
40
44
|
_trim_trailing_whitespaces(path)
|
|
@@ -42,7 +46,6 @@ def _process(*, setup_cfg: bool) -> bool:
|
|
|
42
46
|
return False
|
|
43
47
|
|
|
44
48
|
|
|
45
|
-
@beartype
|
|
46
49
|
def _trim_trailing_whitespaces(path: Path, /) -> None:
|
|
47
50
|
with path.open() as fh:
|
|
48
51
|
lines = fh.readlines()
|
|
@@ -3,8 +3,8 @@ from pathlib import Path
|
|
|
3
3
|
from subprocess import check_output
|
|
4
4
|
|
|
5
5
|
import click
|
|
6
|
-
from
|
|
7
|
-
from click import
|
|
6
|
+
from click import argument
|
|
7
|
+
from click import command
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
@command()
|
|
@@ -12,31 +12,32 @@ from click import argument, command
|
|
|
12
12
|
"paths",
|
|
13
13
|
nargs=-1,
|
|
14
14
|
type=click.Path(
|
|
15
|
-
exists=True,
|
|
15
|
+
exists=True,
|
|
16
|
+
file_okay=True,
|
|
17
|
+
dir_okay=False,
|
|
18
|
+
readable=True,
|
|
19
|
+
path_type=Path,
|
|
16
20
|
),
|
|
17
21
|
)
|
|
18
|
-
@beartype
|
|
19
22
|
def main(paths: tuple[Path, ...]) -> bool:
|
|
20
23
|
"""CLI for the `run-dockfmt` hook."""
|
|
21
24
|
results = list(_yield_outcomes(*paths)) # run all
|
|
22
25
|
return all(results)
|
|
23
26
|
|
|
24
27
|
|
|
25
|
-
@beartype
|
|
26
28
|
def _yield_outcomes(*paths: Path) -> Iterator[bool]:
|
|
27
29
|
for path in paths:
|
|
28
30
|
if path.name == "Dockerfile":
|
|
29
31
|
yield _process(path)
|
|
30
32
|
|
|
31
33
|
|
|
32
|
-
@beartype
|
|
33
34
|
def _process(path: Path, /) -> bool:
|
|
34
35
|
with path.open() as fh:
|
|
35
36
|
current = fh.read()
|
|
36
37
|
strip = "\t\n"
|
|
37
|
-
proposed = check_output(
|
|
38
|
-
|
|
39
|
-
)
|
|
38
|
+
proposed = check_output(
|
|
39
|
+
["dockfmt", "fmt", path.as_posix()], text=True # noqa: S603, S607
|
|
40
|
+
).lstrip(strip)
|
|
40
41
|
if current == proposed:
|
|
41
42
|
return True
|
|
42
43
|
with path.open(mode="w") as fh:
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
from pathlib import Path
|
|
2
|
-
from subprocess import PIPE
|
|
2
|
+
from subprocess import PIPE
|
|
3
|
+
from subprocess import STDOUT
|
|
4
|
+
from subprocess import CalledProcessError
|
|
5
|
+
from subprocess import check_call
|
|
3
6
|
from typing import cast
|
|
4
7
|
|
|
5
|
-
from beartype import beartype
|
|
6
8
|
from click import command
|
|
7
|
-
from git import Repo
|
|
8
9
|
from loguru import logger
|
|
9
10
|
from tomlkit import loads
|
|
10
11
|
from tomlkit.container import Container
|
|
11
12
|
|
|
13
|
+
from pre_commit_hooks.common import PYPROJECT_TOML
|
|
12
14
|
from pre_commit_hooks.common import check_versions
|
|
13
15
|
|
|
14
16
|
|
|
15
17
|
@command()
|
|
16
|
-
@beartype
|
|
17
18
|
def main() -> bool:
|
|
18
19
|
"""CLI for the `run-hatch-version` hook."""
|
|
19
20
|
return _process()
|
|
20
21
|
|
|
21
22
|
|
|
22
|
-
@beartype
|
|
23
23
|
def _process() -> bool:
|
|
24
24
|
path = _get_path_version_file()
|
|
25
25
|
pattern = r'^__version__ = "(\d+\.\d+\.\d+)"$'
|
|
@@ -28,7 +28,7 @@ def _process() -> bool:
|
|
|
28
28
|
return True
|
|
29
29
|
cmd = ["hatch", "version", str(version)]
|
|
30
30
|
try:
|
|
31
|
-
_ = check_call(cmd, stdout=PIPE, stderr=STDOUT)
|
|
31
|
+
_ = check_call(cmd, stdout=PIPE, stderr=STDOUT) # noqa: S603
|
|
32
32
|
except CalledProcessError as error:
|
|
33
33
|
if error.returncode != 1:
|
|
34
34
|
logger.exception("Failed to run {cmd!r}", cmd=" ".join(cmd))
|
|
@@ -41,12 +41,8 @@ def _process() -> bool:
|
|
|
41
41
|
return False
|
|
42
42
|
|
|
43
43
|
|
|
44
|
-
@beartype
|
|
45
44
|
def _get_path_version_file() -> Path:
|
|
46
|
-
|
|
47
|
-
if (wtd := repo.working_tree_dir) is None:
|
|
48
|
-
raise ValueError(str(repo))
|
|
49
|
-
with Path(wtd, "pyproject.toml").open() as fh:
|
|
45
|
+
with PYPROJECT_TOML.open() as fh:
|
|
50
46
|
doc = loads(fh.read())
|
|
51
47
|
try:
|
|
52
48
|
tool = cast(Container, doc["tool"])
|
|
@@ -1,19 +1,25 @@
|
|
|
1
1
|
import datetime as dt
|
|
2
|
-
from collections.abc import Iterable
|
|
2
|
+
from collections.abc import Iterable
|
|
3
|
+
from collections.abc import Iterator
|
|
3
4
|
from pathlib import Path
|
|
4
|
-
from re import MULTILINE
|
|
5
|
-
from
|
|
5
|
+
from re import MULTILINE
|
|
6
|
+
from re import sub
|
|
7
|
+
from subprocess import CalledProcessError
|
|
8
|
+
from subprocess import check_call
|
|
6
9
|
from tempfile import TemporaryDirectory
|
|
7
10
|
from textwrap import indent
|
|
8
|
-
from typing import
|
|
11
|
+
from typing import cast
|
|
9
12
|
|
|
10
13
|
import click
|
|
11
|
-
from
|
|
12
|
-
from click import
|
|
13
|
-
from git import Repo
|
|
14
|
+
from click import argument
|
|
15
|
+
from click import command
|
|
14
16
|
from loguru import logger
|
|
15
|
-
from tomlkit import dumps
|
|
17
|
+
from tomlkit import dumps
|
|
18
|
+
from tomlkit import parse
|
|
16
19
|
from tomlkit.container import Container
|
|
20
|
+
from utilities.git import get_repo_root
|
|
21
|
+
|
|
22
|
+
from pre_commit_hooks.common import PYPROJECT_TOML
|
|
17
23
|
|
|
18
24
|
|
|
19
25
|
@command()
|
|
@@ -21,17 +27,19 @@ from tomlkit.container import Container
|
|
|
21
27
|
"paths",
|
|
22
28
|
nargs=-1,
|
|
23
29
|
type=click.Path(
|
|
24
|
-
exists=True,
|
|
30
|
+
exists=True,
|
|
31
|
+
file_okay=True,
|
|
32
|
+
dir_okay=False,
|
|
33
|
+
readable=True,
|
|
34
|
+
path_type=Path,
|
|
25
35
|
),
|
|
26
36
|
)
|
|
27
|
-
@beartype
|
|
28
37
|
def main(paths: tuple[Path, ...]) -> bool:
|
|
29
38
|
"""CLI for the `run-pip-compile` hook."""
|
|
30
39
|
results = list(_yield_outcomes(*paths)) # run all
|
|
31
40
|
return all(results)
|
|
32
41
|
|
|
33
42
|
|
|
34
|
-
@beartype
|
|
35
43
|
def _yield_outcomes(*paths: Path) -> Iterator[bool]:
|
|
36
44
|
for path in paths:
|
|
37
45
|
if (filename := path.name) == "requirements.in":
|
|
@@ -43,26 +51,15 @@ def _yield_outcomes(*paths: Path) -> Iterator[bool]:
|
|
|
43
51
|
# ---- dependencies -----------------------------------------------------------
|
|
44
52
|
|
|
45
53
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
path = _get_pyproject_toml()
|
|
49
|
-
curr = _get_curr_pyproject_deps(path)
|
|
54
|
+
def _process_dependencies(req_in: Path | str, /) -> bool:
|
|
55
|
+
curr = _get_curr_pyproject_deps(PYPROJECT_TOML)
|
|
50
56
|
latest = _run_pip_compile(req_in)
|
|
51
57
|
if curr == latest:
|
|
52
58
|
return True
|
|
53
|
-
_write_pyproject_deps(
|
|
59
|
+
_write_pyproject_deps(PYPROJECT_TOML, latest)
|
|
54
60
|
return False
|
|
55
61
|
|
|
56
62
|
|
|
57
|
-
@beartype
|
|
58
|
-
def _get_pyproject_toml() -> Path:
|
|
59
|
-
repo = Repo(".", search_parent_directories=True)
|
|
60
|
-
if (wtd := repo.working_tree_dir) is None:
|
|
61
|
-
raise ValueError(str(repo))
|
|
62
|
-
return Path(wtd, "pyproject.toml")
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
@beartype
|
|
66
63
|
def _get_curr_pyproject_deps(path: Path, /) -> set[str]:
|
|
67
64
|
try:
|
|
68
65
|
with path.open(mode="r") as fh:
|
|
@@ -84,8 +81,7 @@ def _get_curr_pyproject_deps(path: Path, /) -> set[str]:
|
|
|
84
81
|
return set(cast(Iterable[str], dependencies))
|
|
85
82
|
|
|
86
83
|
|
|
87
|
-
|
|
88
|
-
def _run_pip_compile(filename: Union[Path, str], /) -> set[str]:
|
|
84
|
+
def _run_pip_compile(filename: Path | str, /) -> set[str]:
|
|
89
85
|
with TemporaryDirectory() as temp:
|
|
90
86
|
temp_file = Path(temp, "temp.txt")
|
|
91
87
|
cmd = [
|
|
@@ -101,7 +97,7 @@ def _run_pip_compile(filename: Union[Path, str], /) -> set[str]:
|
|
|
101
97
|
Path(filename).as_posix(),
|
|
102
98
|
]
|
|
103
99
|
try:
|
|
104
|
-
_ = check_call(cmd)
|
|
100
|
+
_ = check_call(cmd) # noqa: S603
|
|
105
101
|
except CalledProcessError:
|
|
106
102
|
logger.exception("Failed to run {cmd!r}", cmd=" ".join(cmd))
|
|
107
103
|
raise
|
|
@@ -111,18 +107,16 @@ def _run_pip_compile(filename: Union[Path, str], /) -> set[str]:
|
|
|
111
107
|
return set(filter(_is_requirements_dep, lines))
|
|
112
108
|
|
|
113
109
|
|
|
114
|
-
@beartype
|
|
115
110
|
def _is_requirements_dep(line: str, /) -> bool:
|
|
116
111
|
return len(line) >= 1 and not line.startswith("#")
|
|
117
112
|
|
|
118
113
|
|
|
119
|
-
@beartype
|
|
120
114
|
def _write_pyproject_deps(path: Path, deps: Iterable[str], /) -> None:
|
|
121
115
|
with path.open(mode="r") as fh:
|
|
122
116
|
contents = fh.read()
|
|
123
117
|
doc = parse(contents)
|
|
124
118
|
project = cast(Container, doc["project"])
|
|
125
|
-
now = dt.datetime.now(tz=dt.
|
|
119
|
+
now = dt.datetime.now(tz=dt.UTC)
|
|
126
120
|
dummy = f"PIP_COMPILE_{now:%4Y%m%dT%H%M%S}"
|
|
127
121
|
project["dependencies"] = dummy
|
|
128
122
|
contents_with_dummy = dumps(doc)
|
|
@@ -133,7 +127,6 @@ def _write_pyproject_deps(path: Path, deps: Iterable[str], /) -> None:
|
|
|
133
127
|
_ = fh.write(new_contents)
|
|
134
128
|
|
|
135
129
|
|
|
136
|
-
@beartype
|
|
137
130
|
def _get_replacement_text(deps: Iterable[str], /) -> str:
|
|
138
131
|
quoted = (f'"{dep}",' for dep in sorted(deps))
|
|
139
132
|
indented = indent("\n".join(quoted), " ")
|
|
@@ -143,9 +136,8 @@ def _get_replacement_text(deps: Iterable[str], /) -> str:
|
|
|
143
136
|
# ---- dev dependencies -------------------------------------------------------
|
|
144
137
|
|
|
145
138
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
req_txt = _get_requirements_txt()
|
|
139
|
+
def _process_dev_dependencies(req_in: Path | str, /) -> bool:
|
|
140
|
+
req_txt = get_repo_root().joinpath("requirements.txt")
|
|
149
141
|
try:
|
|
150
142
|
curr = _get_curr_requirements_deps(req_txt)
|
|
151
143
|
except FileNotFoundError:
|
|
@@ -159,22 +151,12 @@ def _process_dev_dependencies(req_in: Union[Path, str], /) -> bool:
|
|
|
159
151
|
return False
|
|
160
152
|
|
|
161
153
|
|
|
162
|
-
@beartype
|
|
163
|
-
def _get_requirements_txt() -> Path:
|
|
164
|
-
repo = Repo(".", search_parent_directories=True)
|
|
165
|
-
if (wtd := repo.working_tree_dir) is None:
|
|
166
|
-
raise ValueError(str(repo))
|
|
167
|
-
return Path(wtd, "requirements.txt")
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
@beartype
|
|
171
154
|
def _get_curr_requirements_deps(path: Path, /) -> set[str]:
|
|
172
155
|
with path.open(mode="r") as fh:
|
|
173
156
|
lines = fh.readlines()
|
|
174
157
|
return set(filter(_is_requirements_dep, lines))
|
|
175
158
|
|
|
176
159
|
|
|
177
|
-
@beartype
|
|
178
160
|
def _write_latest_dev_deps(req_txt: Path, deps: Iterable[str], /) -> None:
|
|
179
161
|
contents = "\n".join(sorted(deps)) + "\n"
|
|
180
162
|
with req_txt.open(mode="w") as fh:
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
#
|
|
2
|
+
|
|
3
|
+
# build-system
|
|
4
|
+
[build-system]
|
|
5
|
+
build-backend = "hatchling.build"
|
|
6
|
+
requires = ["hatchling"]
|
|
7
|
+
|
|
8
|
+
# project
|
|
9
|
+
[project]
|
|
10
|
+
authors = [{name = "Derek Wan", email = "d.wan@icloud.com"}]
|
|
11
|
+
dependencies = [
|
|
12
|
+
"dycw-utilities[click, loguru, semver] >= 0.13.3, < 0.14",
|
|
13
|
+
"semver >= 3.0.1, < 3.1",
|
|
14
|
+
"tomlkit >= 0.12.1, < 0.13",
|
|
15
|
+
"xdg >= 6.0.0, < 6.1",
|
|
16
|
+
]
|
|
17
|
+
dynamic = ["version"]
|
|
18
|
+
name = "dycw-pre-commit-hooks"
|
|
19
|
+
readme = "README.md"
|
|
20
|
+
requires-python = ">= 3.11"
|
|
21
|
+
|
|
22
|
+
[project.optional-dependencies]
|
|
23
|
+
dev = [
|
|
24
|
+
"dycw-utilities[test]",
|
|
25
|
+
"hatch",
|
|
26
|
+
"pip-tools",
|
|
27
|
+
"pre-commit",
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
[project.scripts]
|
|
31
|
+
run-bump2version = "pre_commit_hooks.run_bump2version:main"
|
|
32
|
+
run-dockfmt = "pre_commit_hooks.run_dockfmt:main"
|
|
33
|
+
run-hatch-version = "pre_commit_hooks.run_hatch_version:main"
|
|
34
|
+
run-pip-compile = "pre_commit_hooks.run_pip_compile:main"
|
|
35
|
+
|
|
36
|
+
# black
|
|
37
|
+
[tool.black]
|
|
38
|
+
line-length = 80
|
|
39
|
+
skip-magic-trailing-comma = true
|
|
40
|
+
target-version = ["py311"]
|
|
41
|
+
|
|
42
|
+
# coverage
|
|
43
|
+
[tool.coverage]
|
|
44
|
+
|
|
45
|
+
[tool.coverage.html]
|
|
46
|
+
directory = ".coverage/html"
|
|
47
|
+
|
|
48
|
+
[tool.coverage.report]
|
|
49
|
+
exclude_lines = ["# pragma: no cover", "@overload"]
|
|
50
|
+
fail_under = 100.0
|
|
51
|
+
skip_covered = true
|
|
52
|
+
skip_empty = true
|
|
53
|
+
|
|
54
|
+
[tool.coverage.run]
|
|
55
|
+
branch = true
|
|
56
|
+
data_file = ".coverage/data"
|
|
57
|
+
parallel = true
|
|
58
|
+
|
|
59
|
+
# hatch
|
|
60
|
+
[tool.hatch]
|
|
61
|
+
|
|
62
|
+
[tool.hatch.build]
|
|
63
|
+
sources = ["src"]
|
|
64
|
+
|
|
65
|
+
[tool.hatch.build.targets.wheel]
|
|
66
|
+
packages = ["src/pre_commit_hooks"]
|
|
67
|
+
|
|
68
|
+
[tool.hatch.version]
|
|
69
|
+
path = "src/pre_commit_hooks/__init__.py"
|
|
70
|
+
|
|
71
|
+
# nitpick
|
|
72
|
+
[tool.nitpick]
|
|
73
|
+
style = [
|
|
74
|
+
"https://raw.githubusercontent.com/dycw/nitpick/master/styles/3.11.toml",
|
|
75
|
+
"https://raw.githubusercontent.com/dycw/nitpick/master/styles/common.toml",
|
|
76
|
+
"https://raw.githubusercontent.com/dycw/nitpick/master/styles/pip-compile-no-hashes.toml",
|
|
77
|
+
]
|
|
78
|
+
|
|
79
|
+
# pyright
|
|
80
|
+
[tool.pyright]
|
|
81
|
+
exclude = ["**/__pycache__", ".direnv", ".git"]
|
|
82
|
+
executionEnvironments = [{root = "src"}]
|
|
83
|
+
include = ["src"]
|
|
84
|
+
pythonVersion = "3.11"
|
|
85
|
+
reportImplicitOverride = "error"
|
|
86
|
+
reportImportCycles = "error"
|
|
87
|
+
reportMissingSuperCall = "error"
|
|
88
|
+
reportMissingTypeArgument = false
|
|
89
|
+
reportMissingTypeStubs = false
|
|
90
|
+
reportPrivateImportUsage = false
|
|
91
|
+
reportPrivateUsage = false
|
|
92
|
+
reportPropertyTypeMismatch = "error"
|
|
93
|
+
reportShadowedImports = "error"
|
|
94
|
+
reportUninitializedInstanceVariable = "error"
|
|
95
|
+
reportUnknownArgumentType = false
|
|
96
|
+
reportUnknownMemberType = false
|
|
97
|
+
reportUnknownParameterType = false
|
|
98
|
+
reportUnknownVariableType = false
|
|
99
|
+
reportUnnecessaryTypeIgnoreComment = "error"
|
|
100
|
+
reportUntypedBaseClass = false
|
|
101
|
+
reportUnusedCallResult = "error"
|
|
102
|
+
typeCheckingMode = "strict"
|
|
103
|
+
|
|
104
|
+
# pytest
|
|
105
|
+
[tool.pytest]
|
|
106
|
+
|
|
107
|
+
[tool.pytest.ini_options]
|
|
108
|
+
addopts = [
|
|
109
|
+
"-rsxX",
|
|
110
|
+
"--color=auto",
|
|
111
|
+
"--cov=pre_commit_hooks",
|
|
112
|
+
"--cov-config=pyproject.toml",
|
|
113
|
+
"--cov-report=html",
|
|
114
|
+
"--strict-markers",
|
|
115
|
+
"--tb=native",
|
|
116
|
+
]
|
|
117
|
+
filterwarnings = ["error"]
|
|
118
|
+
minversion = "7.0"
|
|
119
|
+
testpaths = ["src/tests"]
|
|
120
|
+
xfail_strict = true
|
|
121
|
+
|
|
122
|
+
# ruff
|
|
123
|
+
[tool.ruff]
|
|
124
|
+
ignore = [
|
|
125
|
+
"ANN101", # flake8-annotations, missing-type-self
|
|
126
|
+
"ANN102", # flake8-annotations, missing-type-cls
|
|
127
|
+
"ANN401", # flake8-annotations, dynamically-typed-expression
|
|
128
|
+
"B008", # flake8-bugbear, function-call-argument-default
|
|
129
|
+
"COM812", # flake8-commas, trailing-comma-missing
|
|
130
|
+
"PGH003", # pygrep-hooks, blanket-type-ignore
|
|
131
|
+
"PLR0913", # refactor, too-many-arguments
|
|
132
|
+
"PT012", # flake8-pytest-style, raises-with-multiple-statements
|
|
133
|
+
"PT013", # flake8-pytest-style, incorrect-pytest-import
|
|
134
|
+
]
|
|
135
|
+
select = [
|
|
136
|
+
"F", # pyflakes
|
|
137
|
+
"E", # pycodestyle
|
|
138
|
+
"W", # pycodestyle
|
|
139
|
+
"I", # isort
|
|
140
|
+
"N", # pep8-naming
|
|
141
|
+
"UP", # pyupgrade
|
|
142
|
+
"YTT", # flake8-2020
|
|
143
|
+
"ANN", # flake8-annotations
|
|
144
|
+
"ASYNC", # flake8-async
|
|
145
|
+
"S", # flake8-bandit
|
|
146
|
+
"BLE", # flake8-blind-excpt
|
|
147
|
+
"FBT", # flake8-boolean-trap
|
|
148
|
+
"B", # flake8-bugbear
|
|
149
|
+
"A", # flake8-builtins
|
|
150
|
+
"C4", # flake8-comprehensions
|
|
151
|
+
"DTZ", # flake8-datetimez
|
|
152
|
+
"T10", # flake8-debugger
|
|
153
|
+
"EM", # flake8-errmsg
|
|
154
|
+
"EXE", # flake8-executable
|
|
155
|
+
"FA", # flake8-future-annotations
|
|
156
|
+
"ISC", # flake8-implicit-str-concat
|
|
157
|
+
"ICN", # flake8-import-conventions
|
|
158
|
+
"G", # flake8-logging-format
|
|
159
|
+
"INP", # flake8-no-pep420
|
|
160
|
+
"PIE", # flake8-pie
|
|
161
|
+
"T20", # flake8-print
|
|
162
|
+
"PYI", # flake8-pyi
|
|
163
|
+
"PT", # flake8-pytest-style
|
|
164
|
+
"RSE", # flake8-raise
|
|
165
|
+
"RET", # flake8-return
|
|
166
|
+
"SLF", # flake8-self
|
|
167
|
+
"SLOT", # flake8-slots
|
|
168
|
+
"SIM", # flake8-simplify
|
|
169
|
+
"TID", # flake8-tidy-imports
|
|
170
|
+
"INT", # flake8-gettext
|
|
171
|
+
"ARG", # flake8-unused-arguments
|
|
172
|
+
"PTH", # flake8-use-pathlib
|
|
173
|
+
"TD", # flake8-todos
|
|
174
|
+
"FIX", # flake8-fixme
|
|
175
|
+
"ERA", # eradicate
|
|
176
|
+
"PGH", # pygrep-hooks
|
|
177
|
+
"PL", # pylint
|
|
178
|
+
"TRY", # tryceratops
|
|
179
|
+
"FLY", # flynt
|
|
180
|
+
"NPY", # numpy-specific-rules
|
|
181
|
+
"PERF", # perflint
|
|
182
|
+
"FURB", # refurb
|
|
183
|
+
"LOG", # flake8-logging
|
|
184
|
+
"RUF", # ruff
|
|
185
|
+
]
|
|
186
|
+
src = ["src", "tests"]
|
|
187
|
+
target-version = "py311"
|
|
188
|
+
|
|
189
|
+
[tool.ruff.flake8-tidy-imports]
|
|
190
|
+
ban-relative-imports = "all"
|
|
191
|
+
|
|
192
|
+
[tool.ruff.isort]
|
|
193
|
+
force-single-line = true
|
|
194
|
+
|
|
195
|
+
[tool.ruff.per-file-ignores]
|
|
196
|
+
"src/tests/**/*.py" = [
|
|
197
|
+
"FBT001", # flake8-boolean-trap, boolean-positional-arg-in-function-definition
|
|
198
|
+
"FBT003", # flake8-boolean-trap, boolean-positional-value-in-function-call
|
|
199
|
+
"PLR2004", # refactor, magic-value-comparison
|
|
200
|
+
"S101", # flake8-bandit, assert-used
|
|
201
|
+
]
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
#
|
|
2
|
+
# This file is autogenerated by pip-compile with Python 3.11
|
|
3
|
+
# by the following command:
|
|
4
|
+
#
|
|
5
|
+
# pip-compile --allow-unsafe --extra=dev --output-file=requirements-dev.txt pyproject.toml
|
|
6
|
+
#
|
|
7
|
+
anyio==4.0.0
|
|
8
|
+
# via httpcore
|
|
9
|
+
atomicwrites==1.4.1
|
|
10
|
+
# via dycw-utilities
|
|
11
|
+
attrs==23.1.0
|
|
12
|
+
# via hypothesis
|
|
13
|
+
build==1.0.3
|
|
14
|
+
# via pip-tools
|
|
15
|
+
certifi==2023.7.22
|
|
16
|
+
# via
|
|
17
|
+
# httpcore
|
|
18
|
+
# httpx
|
|
19
|
+
cfgv==3.4.0
|
|
20
|
+
# via pre-commit
|
|
21
|
+
click==8.1.7
|
|
22
|
+
# via
|
|
23
|
+
# dycw-utilities
|
|
24
|
+
# hatch
|
|
25
|
+
# pip-tools
|
|
26
|
+
# userpath
|
|
27
|
+
coverage[toml]==7.3.1
|
|
28
|
+
# via pytest-cov
|
|
29
|
+
distlib==0.3.7
|
|
30
|
+
# via virtualenv
|
|
31
|
+
dycw-utilities[click,loguru,semver,test]==0.13.3
|
|
32
|
+
# via dycw-pre-commit-hooks (pyproject.toml)
|
|
33
|
+
editables==0.5
|
|
34
|
+
# via hatchling
|
|
35
|
+
exceptiongroup==1.1.3
|
|
36
|
+
# via dycw-utilities
|
|
37
|
+
execnet==2.0.2
|
|
38
|
+
# via pytest-xdist
|
|
39
|
+
filelock==3.12.4
|
|
40
|
+
# via virtualenv
|
|
41
|
+
h11==0.14.0
|
|
42
|
+
# via httpcore
|
|
43
|
+
hatch==1.7.0
|
|
44
|
+
# via dycw-pre-commit-hooks (pyproject.toml)
|
|
45
|
+
hatchling==1.18.0
|
|
46
|
+
# via hatch
|
|
47
|
+
httpcore==0.18.0
|
|
48
|
+
# via httpx
|
|
49
|
+
httpx==0.25.0
|
|
50
|
+
# via hatch
|
|
51
|
+
hyperlink==21.0.0
|
|
52
|
+
# via hatch
|
|
53
|
+
hypothesis==6.87.1
|
|
54
|
+
# via dycw-utilities
|
|
55
|
+
identify==2.5.30
|
|
56
|
+
# via pre-commit
|
|
57
|
+
idna==3.4
|
|
58
|
+
# via
|
|
59
|
+
# anyio
|
|
60
|
+
# httpx
|
|
61
|
+
# hyperlink
|
|
62
|
+
importlib-metadata==6.8.0
|
|
63
|
+
# via keyring
|
|
64
|
+
iniconfig==2.0.0
|
|
65
|
+
# via pytest
|
|
66
|
+
jaraco-classes==3.3.0
|
|
67
|
+
# via keyring
|
|
68
|
+
keyring==24.2.0
|
|
69
|
+
# via hatch
|
|
70
|
+
loguru==0.7.2
|
|
71
|
+
# via dycw-utilities
|
|
72
|
+
markdown-it-py==3.0.0
|
|
73
|
+
# via rich
|
|
74
|
+
mdurl==0.1.2
|
|
75
|
+
# via markdown-it-py
|
|
76
|
+
more-itertools==10.1.0
|
|
77
|
+
# via jaraco-classes
|
|
78
|
+
nodeenv==1.8.0
|
|
79
|
+
# via pre-commit
|
|
80
|
+
packaging==23.2
|
|
81
|
+
# via
|
|
82
|
+
# build
|
|
83
|
+
# hatch
|
|
84
|
+
# hatchling
|
|
85
|
+
# pytest
|
|
86
|
+
# pytest-rerunfailures
|
|
87
|
+
pathspec==0.11.2
|
|
88
|
+
# via hatchling
|
|
89
|
+
pexpect==4.8.0
|
|
90
|
+
# via hatch
|
|
91
|
+
pip-tools==7.3.0
|
|
92
|
+
# via dycw-pre-commit-hooks (pyproject.toml)
|
|
93
|
+
platformdirs==3.10.0
|
|
94
|
+
# via
|
|
95
|
+
# hatch
|
|
96
|
+
# virtualenv
|
|
97
|
+
pluggy==1.3.0
|
|
98
|
+
# via
|
|
99
|
+
# hatchling
|
|
100
|
+
# pytest
|
|
101
|
+
pre-commit==3.4.0
|
|
102
|
+
# via dycw-pre-commit-hooks (pyproject.toml)
|
|
103
|
+
ptyprocess==0.7.0
|
|
104
|
+
# via pexpect
|
|
105
|
+
pygments==2.16.1
|
|
106
|
+
# via rich
|
|
107
|
+
pyperclip==1.8.2
|
|
108
|
+
# via hatch
|
|
109
|
+
pyproject-hooks==1.0.0
|
|
110
|
+
# via build
|
|
111
|
+
pytest==7.4.2
|
|
112
|
+
# via
|
|
113
|
+
# dycw-utilities
|
|
114
|
+
# pytest-check
|
|
115
|
+
# pytest-cov
|
|
116
|
+
# pytest-instafail
|
|
117
|
+
# pytest-randomly
|
|
118
|
+
# pytest-rerunfailures
|
|
119
|
+
# pytest-xdist
|
|
120
|
+
pytest-check==2.2.2
|
|
121
|
+
# via dycw-utilities
|
|
122
|
+
pytest-cov==4.1.0
|
|
123
|
+
# via dycw-utilities
|
|
124
|
+
pytest-instafail==0.5.0
|
|
125
|
+
# via dycw-utilities
|
|
126
|
+
pytest-randomly==3.15.0
|
|
127
|
+
# via dycw-utilities
|
|
128
|
+
pytest-rerunfailures==12.0
|
|
129
|
+
# via dycw-utilities
|
|
130
|
+
pytest-xdist==3.3.1
|
|
131
|
+
# via dycw-utilities
|
|
132
|
+
pyyaml==6.0.1
|
|
133
|
+
# via pre-commit
|
|
134
|
+
rich==13.6.0
|
|
135
|
+
# via hatch
|
|
136
|
+
semver==3.0.1
|
|
137
|
+
# via
|
|
138
|
+
# dycw-pre-commit-hooks (pyproject.toml)
|
|
139
|
+
# dycw-utilities
|
|
140
|
+
shellingham==1.5.3
|
|
141
|
+
# via hatch
|
|
142
|
+
sniffio==1.3.0
|
|
143
|
+
# via
|
|
144
|
+
# anyio
|
|
145
|
+
# httpcore
|
|
146
|
+
# httpx
|
|
147
|
+
sortedcontainers==2.4.0
|
|
148
|
+
# via hypothesis
|
|
149
|
+
tomli-w==1.0.0
|
|
150
|
+
# via hatch
|
|
151
|
+
tomlkit==0.12.1
|
|
152
|
+
# via
|
|
153
|
+
# dycw-pre-commit-hooks (pyproject.toml)
|
|
154
|
+
# hatch
|
|
155
|
+
trove-classifiers==2023.9.19
|
|
156
|
+
# via hatchling
|
|
157
|
+
typing-extensions==4.8.0
|
|
158
|
+
# via dycw-utilities
|
|
159
|
+
userpath==1.9.1
|
|
160
|
+
# via hatch
|
|
161
|
+
virtualenv==20.24.5
|
|
162
|
+
# via
|
|
163
|
+
# hatch
|
|
164
|
+
# pre-commit
|
|
165
|
+
wheel==0.41.2
|
|
166
|
+
# via pip-tools
|
|
167
|
+
xdg==6.0.0
|
|
168
|
+
# via dycw-pre-commit-hooks (pyproject.toml)
|
|
169
|
+
zipp==3.17.0
|
|
170
|
+
# via importlib-metadata
|
|
171
|
+
|
|
172
|
+
# The following packages are considered to be unsafe in a requirements file:
|
|
173
|
+
pip==23.2.1
|
|
174
|
+
# via pip-tools
|
|
175
|
+
setuptools==68.2.2
|
|
176
|
+
# via
|
|
177
|
+
# nodeenv
|
|
178
|
+
# pip-tools
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#
|
|
2
|
+
# This file is autogenerated by pip-compile with Python 3.11
|
|
3
|
+
# by the following command:
|
|
4
|
+
#
|
|
5
|
+
# pip-compile --allow-unsafe pyproject.toml
|
|
6
|
+
#
|
|
7
|
+
click==8.1.7
|
|
8
|
+
# via dycw-utilities
|
|
9
|
+
dycw-utilities[click,loguru,semver]==0.13.3
|
|
10
|
+
# via dycw-pre-commit-hooks (pyproject.toml)
|
|
11
|
+
loguru==0.7.2
|
|
12
|
+
# via dycw-utilities
|
|
13
|
+
semver==3.0.1
|
|
14
|
+
# via
|
|
15
|
+
# dycw-pre-commit-hooks (pyproject.toml)
|
|
16
|
+
# dycw-utilities
|
|
17
|
+
tomlkit==0.12.1
|
|
18
|
+
# via dycw-pre-commit-hooks (pyproject.toml)
|
|
19
|
+
typing-extensions==4.8.0
|
|
20
|
+
# via dycw-utilities
|
|
21
|
+
xdg==6.0.0
|
|
22
|
+
# via dycw-pre-commit-hooks (pyproject.toml)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
layout pyenv 3.9.16
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.8.26"
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
#### black ####################################################################
|
|
2
|
-
[tool.black]
|
|
3
|
-
skip-magic-trailing-comma = true
|
|
4
|
-
target-version = ["py39"]
|
|
5
|
-
|
|
6
|
-
#### coverage #################################################################
|
|
7
|
-
[tool.coverage.run]
|
|
8
|
-
branch = true
|
|
9
|
-
data_file = ".coverage/data"
|
|
10
|
-
parallel = true
|
|
11
|
-
|
|
12
|
-
[tool.coverage.report]
|
|
13
|
-
exclude_lines = ["# pragma: no cover", "@overload"]
|
|
14
|
-
fail_under = 100.0
|
|
15
|
-
skip_covered = true
|
|
16
|
-
skip_empty = true
|
|
17
|
-
|
|
18
|
-
[tool.coverage.html]
|
|
19
|
-
directory = ".coverage/html"
|
|
20
|
-
|
|
21
|
-
#### hatch ####################################################################
|
|
22
|
-
[build-system]
|
|
23
|
-
requires = ["hatchling"]
|
|
24
|
-
build-backend = "hatchling.build"
|
|
25
|
-
|
|
26
|
-
[tool.hatch.build]
|
|
27
|
-
sources = ["src"]
|
|
28
|
-
|
|
29
|
-
[tool.hatch.build.targets.wheel]
|
|
30
|
-
packages = ["src/pre_commit_hooks"]
|
|
31
|
-
|
|
32
|
-
[tool.hatch.version]
|
|
33
|
-
path = "src/pre_commit_hooks/__init__.py"
|
|
34
|
-
|
|
35
|
-
#### nitpick ##################################################################
|
|
36
|
-
[tool.nitpick]
|
|
37
|
-
style = [
|
|
38
|
-
"https://raw.githubusercontent.com/dycw/nitpick/master/styles/common.toml",
|
|
39
|
-
"https://raw.githubusercontent.com/dycw/nitpick/master/styles/3.9.toml",
|
|
40
|
-
]
|
|
41
|
-
|
|
42
|
-
#### project ##################################################################
|
|
43
|
-
[project]
|
|
44
|
-
name = "dycw-pre-commit-hooks"
|
|
45
|
-
dynamic = ["version"]
|
|
46
|
-
readme = "README.md"
|
|
47
|
-
requires-python = ">= 3.9"
|
|
48
|
-
authors = [{ name = "Derek Wan", email = "d.wan@icloud.com" }]
|
|
49
|
-
dependencies = [
|
|
50
|
-
"beartype==0.12.0",
|
|
51
|
-
"click==8.1.3",
|
|
52
|
-
"gitdb==4.0.10",
|
|
53
|
-
"gitpython==3.1.31",
|
|
54
|
-
"loguru==0.6.0",
|
|
55
|
-
"semver==3.0.0",
|
|
56
|
-
"smmap==5.0.0",
|
|
57
|
-
"tomlkit==0.11.7",
|
|
58
|
-
"xdg==6.0.0",
|
|
59
|
-
]
|
|
60
|
-
|
|
61
|
-
[project.scripts]
|
|
62
|
-
run-bump2version = "pre_commit_hooks.run_bump2version:main"
|
|
63
|
-
run-dockfmt = "pre_commit_hooks.run_dockfmt:main"
|
|
64
|
-
run-hatch-version = "pre_commit_hooks.run_hatch_version:main"
|
|
65
|
-
run-pip-compile = "pre_commit_hooks.run_pip_compile:main"
|
|
66
|
-
|
|
67
|
-
#### pyright ##################################################################
|
|
68
|
-
[tool.pyright]
|
|
69
|
-
include = ["src"]
|
|
70
|
-
exclude = ["**/__pycache__", ".direnv", ".git", ".venv"]
|
|
71
|
-
pythonVersion = "3.9"
|
|
72
|
-
executionEnvironments = [{ root = "src" }]
|
|
73
|
-
typeCheckingMode = "strict"
|
|
74
|
-
reportMissingTypeStubs = false
|
|
75
|
-
reportIncompatibleMethodOverride = false
|
|
76
|
-
reportMissingTypeArgument = false
|
|
77
|
-
reportPrivateUsage = false
|
|
78
|
-
reportPrivateImportUsage = false
|
|
79
|
-
reportUnknownArgumentType = false
|
|
80
|
-
reportUnknownMemberType = false
|
|
81
|
-
reportUnknownParameterType = false
|
|
82
|
-
reportUnknownVariableType = false
|
|
83
|
-
reportUntypedBaseClass = false
|
|
84
|
-
reportMissingSuperCall = "error"
|
|
85
|
-
reportPropertyTypeMismatch = "error"
|
|
86
|
-
reportUnnecessaryTypeIgnoreComment = "error"
|
|
87
|
-
reportUnusedCallResult = "error"
|
|
88
|
-
|
|
89
|
-
#### pytest ###################################################################
|
|
90
|
-
[tool.pytest.ini_options]
|
|
91
|
-
addopts = [
|
|
92
|
-
"-rsxX",
|
|
93
|
-
"--color=auto",
|
|
94
|
-
"--cov=pre_commit_hooks",
|
|
95
|
-
"--cov-config=pyproject.toml",
|
|
96
|
-
"--cov-report=html",
|
|
97
|
-
"--strict-markers",
|
|
98
|
-
"--tb=native"
|
|
99
|
-
]
|
|
100
|
-
filterwarnings = ["error"]
|
|
101
|
-
minversion = "7.0"
|
|
102
|
-
testpaths = ["src/tests"]
|
|
103
|
-
xfail_strict = true
|
|
104
|
-
|
|
105
|
-
#### ruff #####################################################################
|
|
106
|
-
[tool.ruff]
|
|
107
|
-
ignore = [
|
|
108
|
-
"ANN101", # flake8-annotations, missing-type-self
|
|
109
|
-
"ANN102", # flake8-annotations, missing-type-cls
|
|
110
|
-
"ANN401", # flake8-annotations, dynamically-typed-expression
|
|
111
|
-
"B008", # flake8-bugbear, function-call-argument-default
|
|
112
|
-
"COM812", # flake8-commas, trailing-comma-missing
|
|
113
|
-
"D", # pydocstyle
|
|
114
|
-
"PD", # pandas-vet
|
|
115
|
-
"PLR0913", # refactor, too-many-arguments
|
|
116
|
-
"PT012", # flake8-pytest-style, raises-with-multiple-statements
|
|
117
|
-
"PT013", # flake8-pytest-style, incorrect-pytest-import
|
|
118
|
-
"TCH001", # flake8-type-checking, typing-only-first-party-import
|
|
119
|
-
"TCH002", # flake8-type-checking, typing-only-third-party-import
|
|
120
|
-
"TCH003", # flake8-type-checking, typing-only-standard-library-import
|
|
121
|
-
"TRY200", # tryceratops, reraise-no-cause
|
|
122
|
-
"TRY301", # tryceratops, raise-within-try
|
|
123
|
-
|
|
124
|
-
]
|
|
125
|
-
select = ["ALL"]
|
|
126
|
-
src = ["src", "tests"]
|
|
127
|
-
target-version = "py39"
|
|
128
|
-
|
|
129
|
-
[tool.ruff.flake8-tidy-imports]
|
|
130
|
-
ban-relative-imports = "all"
|
|
131
|
-
|
|
132
|
-
[tool.ruff.per-file-ignores]
|
|
133
|
-
"src/tests/**/*.py" = [
|
|
134
|
-
"FBT001", # flake8-boolean-trap, boolean-positional-arg-in-function-definition
|
|
135
|
-
"FBT003", # flake8-boolean-trap, boolean-positional-value-in-function-call
|
|
136
|
-
"PLR2004", # refactor, magic-value-comparison
|
|
137
|
-
"S101", # flake8-bandit, assert-used
|
|
138
|
-
|
|
139
|
-
]
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
anyio==3.6.2
|
|
2
|
-
atomicwrites==1.4.1
|
|
3
|
-
attrs==22.2.0
|
|
4
|
-
beartype==0.12.0
|
|
5
|
-
black==23.3.0
|
|
6
|
-
build==0.10.0
|
|
7
|
-
certifi==2022.12.7
|
|
8
|
-
cffi==1.15.1
|
|
9
|
-
click==8.1.3
|
|
10
|
-
coverage[toml]==7.2.3
|
|
11
|
-
cryptography==40.0.1
|
|
12
|
-
distlib==0.3.6
|
|
13
|
-
dycw-utilities[test]==0.8.5
|
|
14
|
-
editables==0.3
|
|
15
|
-
exceptiongroup==1.1.1
|
|
16
|
-
execnet==1.9.0
|
|
17
|
-
filelock==3.11.0
|
|
18
|
-
gitdb==4.0.10
|
|
19
|
-
gitpython==3.1.31
|
|
20
|
-
h11==0.14.0
|
|
21
|
-
hatch==1.7.0
|
|
22
|
-
hatchling==1.14.0
|
|
23
|
-
httpcore==0.16.3
|
|
24
|
-
httpx==0.23.3
|
|
25
|
-
hyperlink==21.0.0
|
|
26
|
-
hypothesis==6.71.0
|
|
27
|
-
idna==3.4
|
|
28
|
-
importlib-metadata==6.2.0
|
|
29
|
-
iniconfig==2.0.0
|
|
30
|
-
jaraco-classes==3.2.3
|
|
31
|
-
jeepney==0.8.0
|
|
32
|
-
keyring==23.13.1
|
|
33
|
-
loguru==0.6.0
|
|
34
|
-
markdown-it-py==2.2.0
|
|
35
|
-
mdurl==0.1.2
|
|
36
|
-
more-itertools==9.1.0
|
|
37
|
-
mypy-extensions==1.0.0
|
|
38
|
-
packaging==23.0
|
|
39
|
-
pathspec==0.11.1
|
|
40
|
-
pexpect==4.8.0
|
|
41
|
-
pip-tools==6.13.0
|
|
42
|
-
pip==23.0.1
|
|
43
|
-
platformdirs==3.2.0
|
|
44
|
-
pluggy==1.0.0
|
|
45
|
-
ptyprocess==0.7.0
|
|
46
|
-
pycparser==2.21
|
|
47
|
-
pygments==2.14.0
|
|
48
|
-
pyperclip==1.8.2
|
|
49
|
-
pyproject-hooks==1.0.0
|
|
50
|
-
pytest-check==2.1.4
|
|
51
|
-
pytest-cov==4.0.0
|
|
52
|
-
pytest-xdist==3.2.1
|
|
53
|
-
pytest==7.2.2
|
|
54
|
-
rfc3986[idna2008]==1.5.0
|
|
55
|
-
rich==13.3.3
|
|
56
|
-
ruff==0.0.261
|
|
57
|
-
secretstorage==3.3.3
|
|
58
|
-
semver==3.0.0
|
|
59
|
-
setuptools==67.6.1
|
|
60
|
-
shellingham==1.5.0.post1
|
|
61
|
-
smmap==5.0.0
|
|
62
|
-
sniffio==1.3.0
|
|
63
|
-
sortedcontainers==2.4.0
|
|
64
|
-
tomli-w==1.0.0
|
|
65
|
-
tomli==2.0.1
|
|
66
|
-
tomlkit==0.11.7
|
|
67
|
-
trove-classifiers==2023.3.9
|
|
68
|
-
typing-extensions==4.5.0
|
|
69
|
-
userpath==1.8.0
|
|
70
|
-
virtualenv==20.21.0
|
|
71
|
-
wheel==0.40.0
|
|
72
|
-
xdg==6.0.0
|
|
73
|
-
zipp==3.15.0
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|