pre-commit-uv 4.2.2__tar.gz → 4.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.
- {pre_commit_uv-4.2.2 → pre_commit_uv-4.4.0}/PKG-INFO +6 -6
- {pre_commit_uv-4.2.2 → pre_commit_uv-4.4.0}/pyproject.toml +31 -31
- {pre_commit_uv-4.2.2 → pre_commit_uv-4.4.0}/src/pre_commit_uv/__init__.py +18 -18
- {pre_commit_uv-4.2.2 → pre_commit_uv-4.4.0}/tests/test_main.py +8 -8
- {pre_commit_uv-4.2.2 → pre_commit_uv-4.4.0}/.gitignore +0 -0
- {pre_commit_uv-4.2.2 → pre_commit_uv-4.4.0}/LICENSE.txt +0 -0
- {pre_commit_uv-4.2.2 → pre_commit_uv-4.4.0}/README.md +0 -0
- {pre_commit_uv-4.2.2 → pre_commit_uv-4.4.0}/src/pre_commit_uv/py.typed +0 -0
- {pre_commit_uv-4.2.2 → pre_commit_uv-4.4.0}/src/pre_commit_uv_patch.pth +0 -0
- {pre_commit_uv-4.2.2 → pre_commit_uv-4.4.0}/tests/test_health_check.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
2
|
Name: pre-commit-uv
|
|
3
|
-
Version: 4.
|
|
3
|
+
Version: 4.4.0
|
|
4
4
|
Summary: Run pre-commit with uv
|
|
5
5
|
Project-URL: Bug Tracker, https://github.com/tox-dev/pre-commit-uv/issues
|
|
6
6
|
Project-URL: Source Code, https://github.com/tox-dev/pre-commit-uv
|
|
@@ -31,14 +31,14 @@ Classifier: License :: OSI Approved :: MIT License
|
|
|
31
31
|
Classifier: Operating System :: OS Independent
|
|
32
32
|
Classifier: Programming Language :: Python
|
|
33
33
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
34
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
35
34
|
Classifier: Programming Language :: Python :: 3.11
|
|
36
35
|
Classifier: Programming Language :: Python :: 3.12
|
|
37
36
|
Classifier: Programming Language :: Python :: 3.13
|
|
38
37
|
Classifier: Programming Language :: Python :: 3.14
|
|
39
|
-
|
|
40
|
-
Requires-
|
|
41
|
-
Requires-Dist:
|
|
38
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
39
|
+
Requires-Python: >=3.11
|
|
40
|
+
Requires-Dist: pre-commit>=4.6.2
|
|
41
|
+
Requires-Dist: uv>=0.12.22
|
|
42
42
|
Description-Content-Type: text/markdown
|
|
43
43
|
|
|
44
44
|
# pre-commit-uv
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
build-backend = "hatchling.build"
|
|
3
3
|
requires = [
|
|
4
4
|
"hatch-vcs>=0.5",
|
|
5
|
-
"hatchling>=1.
|
|
5
|
+
"hatchling>=1.32.4",
|
|
6
6
|
]
|
|
7
7
|
|
|
8
8
|
[project]
|
|
@@ -17,24 +17,24 @@ license.file = "LICENSE.txt"
|
|
|
17
17
|
authors = [
|
|
18
18
|
{ name = "Bernat Gabor", email = "gaborjbernat@gmail.com" },
|
|
19
19
|
]
|
|
20
|
-
requires-python = ">=3.
|
|
20
|
+
requires-python = ">=3.11"
|
|
21
21
|
classifiers = [
|
|
22
22
|
"License :: OSI Approved :: MIT License",
|
|
23
23
|
"Operating System :: OS Independent",
|
|
24
24
|
"Programming Language :: Python",
|
|
25
25
|
"Programming Language :: Python :: 3 :: Only",
|
|
26
|
-
"Programming Language :: Python :: 3.10",
|
|
27
26
|
"Programming Language :: Python :: 3.11",
|
|
28
27
|
"Programming Language :: Python :: 3.12",
|
|
29
28
|
"Programming Language :: Python :: 3.13",
|
|
30
29
|
"Programming Language :: Python :: 3.14",
|
|
30
|
+
"Programming Language :: Python :: 3.15",
|
|
31
31
|
]
|
|
32
32
|
dynamic = [
|
|
33
33
|
"version",
|
|
34
34
|
]
|
|
35
35
|
dependencies = [
|
|
36
|
-
"pre-commit>=4.
|
|
37
|
-
"uv>=0.
|
|
36
|
+
"pre-commit>=4.6.2",
|
|
37
|
+
"uv>=0.12.22",
|
|
38
38
|
]
|
|
39
39
|
urls."Bug Tracker" = "https://github.com/tox-dev/pre-commit-uv/issues"
|
|
40
40
|
urls."Source Code" = "https://github.com/tox-dev/pre-commit-uv"
|
|
@@ -50,12 +50,12 @@ dev = [
|
|
|
50
50
|
]
|
|
51
51
|
test = [
|
|
52
52
|
"covdefaults>=2.3",
|
|
53
|
-
"pytest>=
|
|
54
|
-
"pytest-cov>=7",
|
|
55
|
-
"pytest-mock>=3.
|
|
53
|
+
"pytest>=9.1.1",
|
|
54
|
+
"pytest-cov>=7.1",
|
|
55
|
+
"pytest-mock>=3.16",
|
|
56
56
|
]
|
|
57
57
|
type = [
|
|
58
|
-
"ty>=0.0.
|
|
58
|
+
"ty>=0.0.84",
|
|
59
59
|
{ include-group = "test" },
|
|
60
60
|
]
|
|
61
61
|
lint = [
|
|
@@ -63,8 +63,8 @@ lint = [
|
|
|
63
63
|
]
|
|
64
64
|
pkg-meta = [
|
|
65
65
|
"check-wheel-contents>=0.6.3",
|
|
66
|
-
"twine>=
|
|
67
|
-
"uv>=0.
|
|
66
|
+
"twine>=7",
|
|
67
|
+
"uv>=0.12.22",
|
|
68
68
|
]
|
|
69
69
|
|
|
70
70
|
[tool.hatch]
|
|
@@ -89,26 +89,26 @@ lint.select = [
|
|
|
89
89
|
"ALL",
|
|
90
90
|
]
|
|
91
91
|
lint.ignore = [
|
|
92
|
-
"
|
|
93
|
-
"
|
|
94
|
-
"
|
|
95
|
-
"
|
|
96
|
-
"
|
|
97
|
-
"
|
|
98
|
-
"
|
|
99
|
-
"
|
|
100
|
-
"
|
|
92
|
+
"any-type", # allow Any as type annotation
|
|
93
|
+
"CPY", # No copyright statements
|
|
94
|
+
"docstring-missing-exception", # not working with Sphinx
|
|
95
|
+
"hardcoded-bind-all-interfaces", # Possible binding to all interfaces
|
|
96
|
+
"incorrect-blank-line-before-class", # `one-blank-line-before-class` (D203) and `no-blank-line-before-class` (D211) are incompatible
|
|
97
|
+
"missing-trailing-comma", # Conflict with formatter
|
|
98
|
+
"multi-line-summary-first-line", # `multi-line-summary-first-line` (D212) and `multi-line-summary-second-line` (D213) are incompatible
|
|
99
|
+
"non-empty-init-module", # `__init__` module should only contain docstrings and re-exports
|
|
100
|
+
"single-line-implicit-string-concatenation", # Conflict with formatter
|
|
101
101
|
]
|
|
102
102
|
lint.per-file-ignores."tests/**/*.py" = [
|
|
103
|
-
"
|
|
104
|
-
"
|
|
105
|
-
"
|
|
106
|
-
"
|
|
107
|
-
"
|
|
108
|
-
"
|
|
109
|
-
"
|
|
110
|
-
"
|
|
111
|
-
"
|
|
103
|
+
"assert", # asserts allowed in tests...
|
|
104
|
+
"D", # don"t care about documentation in tests
|
|
105
|
+
"FBT", # don"t care about booleans as positional arguments in tests
|
|
106
|
+
"implicit-namespace-package", # no implicit namespace
|
|
107
|
+
"import-private-name", # private import
|
|
108
|
+
"magic-value-comparison", # Magic value used in comparison, consider replacing with a constant variable
|
|
109
|
+
"S", # `subprocess` call: check for execution of untrusted input
|
|
110
|
+
"too-many-arguments", # any number of arguments in tests
|
|
111
|
+
"too-many-positional-arguments", # any number of arguments in tests
|
|
112
112
|
]
|
|
113
113
|
lint.isort = { known-first-party = [
|
|
114
114
|
"pre_commit_uv",
|
|
@@ -122,10 +122,10 @@ builtin = "clear,usage,en-GB_to_en-US"
|
|
|
122
122
|
count = true
|
|
123
123
|
|
|
124
124
|
[tool.pyproject-fmt]
|
|
125
|
-
max_supported_python = "3.
|
|
125
|
+
max_supported_python = "3.15"
|
|
126
126
|
|
|
127
127
|
[tool.ty]
|
|
128
|
-
environment.python-version = "3.
|
|
128
|
+
environment.python-version = "3.15"
|
|
129
129
|
|
|
130
130
|
[tool.pytest]
|
|
131
131
|
ini_options.testpaths = [
|
|
@@ -44,13 +44,13 @@ def _patch() -> None:
|
|
|
44
44
|
return
|
|
45
45
|
|
|
46
46
|
if _is_calling_pre_commit() and os.environ.get("DISABLE_PRE_COMMIT_UV_PATCH") is None:
|
|
47
|
-
from pre_commit import main #
|
|
47
|
+
from pre_commit import main # ruff:ignore[import-outside-top-level]
|
|
48
48
|
|
|
49
49
|
_original_main, main.main = main.main, _new_main # ty: ignore[invalid-assignment]
|
|
50
50
|
if "--version" in sys.argv:
|
|
51
|
-
from importlib.metadata import version as _metadata_version #
|
|
51
|
+
from importlib.metadata import version as _metadata_version # ruff:ignore[import-outside-top-level]
|
|
52
52
|
|
|
53
|
-
from pre_commit import constants #
|
|
53
|
+
from pre_commit import constants # ruff:ignore[import-outside-top-level]
|
|
54
54
|
|
|
55
55
|
constants.VERSION = (
|
|
56
56
|
f"{constants.VERSION} ("
|
|
@@ -62,20 +62,20 @@ def _patch() -> None:
|
|
|
62
62
|
|
|
63
63
|
def _new_main(argv: Sequence[str] | None = None) -> int:
|
|
64
64
|
# imports applied locally to avoid patching import overhead cost
|
|
65
|
-
from functools import cache #
|
|
65
|
+
from functools import cache # ruff:ignore[import-outside-top-level]
|
|
66
66
|
|
|
67
|
-
from pre_commit.languages import python #
|
|
67
|
+
from pre_commit.languages import python # ruff:ignore[import-outside-top-level]
|
|
68
68
|
|
|
69
69
|
def _install_environment(
|
|
70
70
|
prefix: Prefix,
|
|
71
71
|
version: str,
|
|
72
72
|
additional_dependencies: Sequence[str],
|
|
73
73
|
) -> None:
|
|
74
|
-
import logging #
|
|
74
|
+
import logging # ruff:ignore[import-outside-top-level]
|
|
75
75
|
|
|
76
|
-
from pre_commit.git import get_root #
|
|
77
|
-
from pre_commit.lang_base import environment_dir, setup_cmd #
|
|
78
|
-
from pre_commit.util import cmd_output_b #
|
|
76
|
+
from pre_commit.git import get_root # ruff:ignore[import-outside-top-level]
|
|
77
|
+
from pre_commit.lang_base import environment_dir, setup_cmd # ruff:ignore[import-outside-top-level]
|
|
78
|
+
from pre_commit.util import cmd_output_b # ruff:ignore[import-outside-top-level]
|
|
79
79
|
|
|
80
80
|
project_root_dir = get_root()
|
|
81
81
|
|
|
@@ -111,31 +111,31 @@ def _new_main(argv: Sequence[str] | None = None) -> int:
|
|
|
111
111
|
|
|
112
112
|
@cache
|
|
113
113
|
def _uv() -> str:
|
|
114
|
-
from uv import find_uv_bin #
|
|
114
|
+
from uv import find_uv_bin # ruff:ignore[import-outside-top-level]
|
|
115
115
|
|
|
116
116
|
return find_uv_bin()
|
|
117
117
|
|
|
118
118
|
@cache
|
|
119
119
|
def self_version() -> str:
|
|
120
|
-
from importlib.metadata import version as _metadata_version #
|
|
120
|
+
from importlib.metadata import version as _metadata_version # ruff:ignore[import-outside-top-level]
|
|
121
121
|
|
|
122
122
|
return _metadata_version("pre-commit-uv")
|
|
123
123
|
|
|
124
124
|
@cache
|
|
125
125
|
def uv_version() -> str:
|
|
126
|
-
from importlib.metadata import version as _metadata_version #
|
|
126
|
+
from importlib.metadata import version as _metadata_version # ruff:ignore[import-outside-top-level]
|
|
127
127
|
|
|
128
128
|
return _metadata_version("uv")
|
|
129
129
|
|
|
130
130
|
patched = cast("_PatchablePython", python)
|
|
131
131
|
patched.install_environment = _install_environment
|
|
132
132
|
patched.health_check = _health_check
|
|
133
|
-
assert _original_main is not None #
|
|
133
|
+
assert _original_main is not None # ruff:ignore[assert]
|
|
134
134
|
return _original_main(argv)
|
|
135
135
|
|
|
136
136
|
|
|
137
137
|
def _version_info(exe: str) -> str:
|
|
138
|
-
from pre_commit.util import CalledProcessError, cmd_output #
|
|
138
|
+
from pre_commit.util import CalledProcessError, cmd_output # ruff:ignore[import-outside-top-level]
|
|
139
139
|
|
|
140
140
|
prog = 'import sys;print(".".join(str(p) for p in sys.version_info[0:3]))'
|
|
141
141
|
try:
|
|
@@ -147,15 +147,15 @@ def _version_info(exe: str) -> str:
|
|
|
147
147
|
def _health_check(prefix: Prefix, version: str) -> str | None:
|
|
148
148
|
# uv may record fewer version components in pyvenv.cfg than pre-commit expects (e.g. "3.14" vs "3.14.6"),
|
|
149
149
|
# so compare only the components uv actually wrote rather than requiring an exact string match
|
|
150
|
-
from pre_commit.lang_base import environment_dir #
|
|
151
|
-
from pre_commit.languages import python #
|
|
152
|
-
from pre_commit.util import win_exe #
|
|
150
|
+
from pre_commit.lang_base import environment_dir # ruff:ignore[import-outside-top-level]
|
|
151
|
+
from pre_commit.languages import python # ruff:ignore[import-outside-top-level]
|
|
152
|
+
from pre_commit.util import win_exe # ruff:ignore[import-outside-top-level]
|
|
153
153
|
|
|
154
154
|
pyvenv_cfg = pathlib.Path(environment_dir(prefix, python.ENVIRONMENT_DIR, version)) / "pyvenv.cfg"
|
|
155
155
|
if not pyvenv_cfg.exists():
|
|
156
156
|
return "pyvenv.cfg does not exist (old virtualenv?)"
|
|
157
157
|
|
|
158
|
-
cfg = python._read_pyvenv_cfg(str(pyvenv_cfg)) #
|
|
158
|
+
cfg = python._read_pyvenv_cfg(str(pyvenv_cfg)) # ruff:ignore[private-member-access]
|
|
159
159
|
if "version_info" not in cfg:
|
|
160
160
|
return "created virtualenv's pyvenv.cfg is missing `version_info`"
|
|
161
161
|
expected = cfg["version_info"].split(".")
|
|
@@ -55,9 +55,9 @@ def test_call_as_module() -> None:
|
|
|
55
55
|
def test_install(git_repo: Path, caplog: pytest.LogCaptureFixture, monkeypatch: pytest.MonkeyPatch) -> None:
|
|
56
56
|
monkeypatch.setenv("FORCE_PRE_COMMIT_UV_PATCH", "1")
|
|
57
57
|
|
|
58
|
-
import pre_commit_uv #
|
|
58
|
+
import pre_commit_uv # ruff:ignore[import-outside-top-level]
|
|
59
59
|
|
|
60
|
-
pre_commit_uv._patch() #
|
|
60
|
+
pre_commit_uv._patch() # ruff:ignore[private-member-access]
|
|
61
61
|
main.main(["install-hooks", "-c", str(git_repo / precommit_file)])
|
|
62
62
|
|
|
63
63
|
assert caplog.messages == [
|
|
@@ -72,9 +72,9 @@ def test_install(git_repo: Path, caplog: pytest.LogCaptureFixture, monkeypatch:
|
|
|
72
72
|
def test_install_seeds_pip(git_repo: Path, monkeypatch: pytest.MonkeyPatch) -> None:
|
|
73
73
|
monkeypatch.setenv("FORCE_PRE_COMMIT_UV_PATCH", "1")
|
|
74
74
|
|
|
75
|
-
import pre_commit_uv #
|
|
75
|
+
import pre_commit_uv # ruff:ignore[import-outside-top-level]
|
|
76
76
|
|
|
77
|
-
pre_commit_uv._patch() #
|
|
77
|
+
pre_commit_uv._patch() # ruff:ignore[private-member-access]
|
|
78
78
|
main.main(["install-hooks", "-c", str(git_repo / precommit_file)])
|
|
79
79
|
|
|
80
80
|
env_dirs = list((git_repo / "store").rglob("py_env-*"))
|
|
@@ -121,9 +121,9 @@ def test_install_with_uv_config(
|
|
|
121
121
|
|
|
122
122
|
monkeypatch.setenv("FORCE_PRE_COMMIT_UV_PATCH", "1")
|
|
123
123
|
|
|
124
|
-
import pre_commit_uv #
|
|
124
|
+
import pre_commit_uv # ruff:ignore[import-outside-top-level]
|
|
125
125
|
|
|
126
|
-
pre_commit_uv._patch() #
|
|
126
|
+
pre_commit_uv._patch() # ruff:ignore[private-member-access]
|
|
127
127
|
main.main(["install-hooks", "-c", str(git_repo / precommit_file)])
|
|
128
128
|
|
|
129
129
|
assert caplog.messages == [
|
|
@@ -169,9 +169,9 @@ def test_install_with_uv_config_raises_error(
|
|
|
169
169
|
|
|
170
170
|
monkeypatch.setenv("FORCE_PRE_COMMIT_UV_PATCH", "1")
|
|
171
171
|
|
|
172
|
-
import pre_commit_uv #
|
|
172
|
+
import pre_commit_uv # ruff:ignore[import-outside-top-level]
|
|
173
173
|
|
|
174
|
-
pre_commit_uv._patch() #
|
|
174
|
+
pre_commit_uv._patch() # ruff:ignore[private-member-access]
|
|
175
175
|
|
|
176
176
|
# would raise SystemExit due to bad config
|
|
177
177
|
with pytest.raises(SystemExit):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|