pre-commit-uv 4.1.5__tar.gz → 4.2.1__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.
@@ -1,11 +1,11 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pre-commit-uv
3
- Version: 4.1.5
3
+ Version: 4.2.1
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: Changelog, https://github.com/tox-dev/pre-commit-uv/releases
7
- Project-URL: Documentation, https://github.com/tox-dev/pre-commit-uv/
8
7
  Project-URL: Source Code, https://github.com/tox-dev/pre-commit-uv
8
+ Project-URL: Documentation, https://github.com/tox-dev/pre-commit-uv/
9
9
  Author-email: Bernat Gabor <gaborjbernat@gmail.com>
10
10
  License: Permission is hereby granted, free of charge, to any person obtaining a
11
11
  copy of this software and associated documentation files (the
@@ -31,19 +31,19 @@ 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.9
35
34
  Classifier: Programming Language :: Python :: 3.10
36
35
  Classifier: Programming Language :: Python :: 3.11
37
36
  Classifier: Programming Language :: Python :: 3.12
38
37
  Classifier: Programming Language :: Python :: 3.13
39
- Requires-Python: >=3.9
40
- Requires-Dist: pre-commit>=3.8
41
- Requires-Dist: uv>=0.4.7
38
+ Classifier: Programming Language :: Python :: 3.14
39
+ Requires-Python: >=3.10
40
+ Requires-Dist: pre-commit>=4.3
41
+ Requires-Dist: uv>=0.9.1
42
42
  Provides-Extra: testing
43
43
  Requires-Dist: covdefaults>=2.3; extra == 'testing'
44
- Requires-Dist: pytest-cov>=5; extra == 'testing'
45
- Requires-Dist: pytest-mock>=3.14; extra == 'testing'
46
- Requires-Dist: pytest>=8.3.2; extra == 'testing'
44
+ Requires-Dist: pytest-cov>=7; extra == 'testing'
45
+ Requires-Dist: pytest-mock>=3.15.1; extra == 'testing'
46
+ Requires-Dist: pytest>=8.4.2; extra == 'testing'
47
47
  Description-Content-Type: text/markdown
48
48
 
49
49
  # pre-commit-uv
@@ -1,8 +1,8 @@
1
1
  [build-system]
2
2
  build-backend = "hatchling.build"
3
3
  requires = [
4
- "hatch-vcs>=0.4",
5
- "hatchling>=1.25",
4
+ "hatch-vcs>=0.5",
5
+ "hatchling>=1.27",
6
6
  ]
7
7
 
8
8
  [project]
@@ -17,35 +17,35 @@ license.file = "LICENSE.txt"
17
17
  authors = [
18
18
  { name = "Bernat Gabor", email = "gaborjbernat@gmail.com" },
19
19
  ]
20
- requires-python = ">=3.9"
20
+ requires-python = ">=3.10"
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.9",
27
26
  "Programming Language :: Python :: 3.10",
28
27
  "Programming Language :: Python :: 3.11",
29
28
  "Programming Language :: Python :: 3.12",
30
29
  "Programming Language :: Python :: 3.13",
30
+ "Programming Language :: Python :: 3.14",
31
31
  ]
32
32
  dynamic = [
33
33
  "version",
34
34
  ]
35
35
  dependencies = [
36
- "pre-commit>=3.8",
37
- "uv>=0.4.7",
36
+ "pre-commit>=4.3",
37
+ "uv>=0.9.1",
38
38
  ]
39
39
  optional-dependencies.testing = [
40
40
  "covdefaults>=2.3",
41
- "pytest>=8.3.2",
42
- "pytest-cov>=5",
43
- "pytest-mock>=3.14",
41
+ "pytest>=8.4.2",
42
+ "pytest-cov>=7",
43
+ "pytest-mock>=3.15.1",
44
44
  ]
45
45
  urls."Bug Tracker" = "https://github.com/tox-dev/pre-commit-uv/issues"
46
46
  urls."Changelog" = "https://github.com/tox-dev/pre-commit-uv/releases"
47
- urls.Documentation = "https://github.com/tox-dev/pre-commit-uv/"
48
47
  urls."Source Code" = "https://github.com/tox-dev/pre-commit-uv"
48
+ urls.Documentation = "https://github.com/tox-dev/pre-commit-uv/"
49
49
 
50
50
  [tool.hatch]
51
51
  build.dev-mode-dirs = [
@@ -61,7 +61,6 @@ build.targets.wheel.sources = [ "src" ]
61
61
  version.source = "vcs"
62
62
 
63
63
  [tool.ruff]
64
- target-version = "py39"
65
64
  line-length = 120
66
65
  format.preview = true
67
66
  format.docstring-code-line-length = 100
@@ -78,6 +77,7 @@ lint.ignore = [
78
77
  "D212", # `multi-line-summary-first-line` (D212) and `multi-line-summary-second-line` (D213) are incompatible
79
78
  "DOC501", # not working with Sphinx
80
79
  "ISC001", # Conflict with formatter
80
+ "RUF067", # `__init__` module should only contain docstrings and re-exports
81
81
  "S104", # Possible binding to all interfaces
82
82
  ]
83
83
  lint.per-file-ignores."tests/**/*.py" = [
@@ -103,7 +103,7 @@ builtin = "clear,usage,en-GB_to_en-US"
103
103
  count = true
104
104
 
105
105
  [tool.pyproject-fmt]
106
- max_supported_python = "3.13"
106
+ max_supported_python = "3.14"
107
107
 
108
108
  [tool.pytest]
109
109
  ini_options.testpaths = [
@@ -111,8 +111,10 @@ ini_options.testpaths = [
111
111
  ]
112
112
 
113
113
  [tool.coverage]
114
- html.show_contexts = true
115
- html.skip_covered = false
114
+ run.parallel = true
115
+ run.plugins = [
116
+ "covdefaults",
117
+ ]
116
118
  paths.source = [
117
119
  "src",
118
120
  ".tox/*/.venv/lib/*/site-packages",
@@ -123,10 +125,8 @@ paths.source = [
123
125
  "**\\src",
124
126
  ]
125
127
  report.fail_under = 63
126
- run.parallel = true
127
- run.plugins = [
128
- "covdefaults",
129
- ]
128
+ html.show_contexts = true
129
+ html.skip_covered = false
130
130
 
131
131
  [tool.mypy]
132
132
  show_error_codes = true
@@ -9,21 +9,28 @@ import sys
9
9
  _original_main = None
10
10
 
11
11
 
12
+ def _is_calling_pre_commit() -> bool:
13
+ if "FORCE_PRE_COMMIT_UV_PATCH" in os.environ:
14
+ return True
15
+ if not sys.argv or not sys.argv[0]:
16
+ return False
17
+ # case when pre-commit is called via python -m pre_commit
18
+ if sys.argv[0] == "-m" and "-m" in sys.orig_argv and "pre_commit" in sys.orig_argv:
19
+ return True
20
+ calling = sys.argv[1] if sys.argv[0] == sys.executable and len(sys.argv) >= 1 else sys.argv[0]
21
+ # case when pre-commit is called directly
22
+ if os.path.split(calling)[1] == f"pre-commit{'.exe' if sys.platform == 'win32' else ''}":
23
+ return True
24
+ # case when pre-commit is called due to a git commit
25
+ return "-m" in sys.argv and "hook-impl" in sys.argv
26
+
27
+
12
28
  def _patch() -> None:
13
29
  global _original_main
14
30
  if _original_main is not None: # already patched, nothing more to do
15
31
  return
16
- calling_pre_commit = "FORCE_PRE_COMMIT_UV_PATCH" in os.environ
17
- if not calling_pre_commit and sys.argv and sys.argv[0]: # must have arguments
18
- calling = sys.argv[1] if sys.argv[0] == sys.executable and len(sys.argv) >= 1 else sys.argv[0]
19
- if (
20
- os.path.split(calling)[1] == f"pre-commit{'.exe' if sys.platform == 'win32' else ''}"
21
- # case when pre-commit is called due to a git commit
22
- or ("-m" in sys.argv and "hook-impl" in sys.argv)
23
- ):
24
- calling_pre_commit = True
25
-
26
- if calling_pre_commit and os.environ.get("DISABLE_PRE_COMMIT_UV_PATCH") is None:
32
+
33
+ if _is_calling_pre_commit() and os.environ.get("DISABLE_PRE_COMMIT_UV_PATCH") is None:
27
34
  from pre_commit import main # noqa: PLC0415
28
35
 
29
36
  _original_main, main.main = main.main, _new_main
@@ -74,6 +81,7 @@ def _new_main(argv: list[str] | None = None) -> int:
74
81
  "--project",
75
82
  project_root_dir,
76
83
  "venv",
84
+ "--seed",
77
85
  environment_dir(prefix, python.ENVIRONMENT_DIR, version),
78
86
  "-p",
79
87
  py,
@@ -1,5 +1,6 @@
1
1
  from __future__ import annotations
2
2
 
3
+ import sys
3
4
  from importlib.metadata import version
4
5
  from subprocess import check_call, check_output
5
6
  from textwrap import dedent
@@ -47,8 +48,8 @@ def test_run_precommit_hook() -> None:
47
48
 
48
49
  @pytest.mark.usefixtures("install_hook")
49
50
  def test_call_as_module() -> None:
50
- run_result = check_output(["python3", "-m", "pre_commit", "run", "-a", "--color", "never"], encoding="utf-8")
51
- assert f"[INFO] Using pre-commit with uv {uv} via pre-commit-uv {self}" not in run_result.splitlines()
51
+ run_result = check_output([sys.executable, "-m", "pre_commit", "run", "-a", "--color", "never"], encoding="utf-8")
52
+ assert f"[INFO] Using pre-commit with uv {uv} via pre-commit-uv {self}" in run_result.splitlines()
52
53
 
53
54
 
54
55
  def test_install(git_repo: Path, caplog: pytest.LogCaptureFixture, monkeypatch: pytest.MonkeyPatch) -> None:
@@ -68,6 +69,21 @@ def test_install(git_repo: Path, caplog: pytest.LogCaptureFixture, monkeypatch:
68
69
  ]
69
70
 
70
71
 
72
+ def test_install_seeds_pip(git_repo: Path, monkeypatch: pytest.MonkeyPatch) -> None:
73
+ monkeypatch.setenv("FORCE_PRE_COMMIT_UV_PATCH", "1")
74
+
75
+ import pre_commit_uv # noqa: PLC0415
76
+
77
+ pre_commit_uv._patch() # noqa: SLF001
78
+ main.main(["install-hooks", "-c", str(git_repo / precommit_file)])
79
+
80
+ env_dirs = list((git_repo / "store").rglob("py_env-*"))
81
+ assert env_dirs, "expected at least one hook environment"
82
+ py = next((env_dirs[0] / "bin").glob("python*"))
83
+ result = check_output([str(py), "-c", "import pip"], encoding="utf-8")
84
+ assert not result
85
+
86
+
71
87
  test_install_with_uv_config_cases: list[tuple[str, str]] = [
72
88
  (
73
89
  "pyproject.toml",
@@ -1,9 +1,10 @@
1
1
  [tox]
2
2
  requires =
3
- tox>=4.2
4
- tox-uv>=1.11.3
3
+ tox>=4.31
4
+ tox-uv>=1.28.1
5
5
  env_list =
6
6
  fix
7
+ 3.14
7
8
  3.13
8
9
  3.12
9
10
  3.11
@@ -43,7 +44,7 @@ commands =
43
44
  [testenv:type]
44
45
  description = run type check on code base
45
46
  deps =
46
- mypy==1.11.2
47
+ mypy==1.18.2
47
48
  commands =
48
49
  mypy src
49
50
  mypy tests
@@ -52,9 +53,9 @@ commands =
52
53
  description = check that the long description is valid
53
54
  skip_install = true
54
55
  deps =
55
- check-wheel-contents>=0.6
56
- twine>=5.1.1
57
- uv>=0.4.10
56
+ check-wheel-contents>=0.6.3
57
+ twine>=6.2
58
+ uv>=0.9.1
58
59
  commands =
59
60
  uv build --sdist --wheel --out-dir {env_tmp_dir} .
60
61
  twine check {env_tmp_dir}{/}*
File without changes
File without changes
File without changes