pre-commit-uv 3.8.0__tar.gz → 4.0.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.0.0/.gitignore +6 -0
- pre_commit_uv-4.0.0/LICENSE.txt +18 -0
- pre_commit_uv-4.0.0/PKG-INFO +61 -0
- pre_commit_uv-4.0.0/README.md +14 -0
- pre_commit_uv-4.0.0/pyproject.toml +133 -0
- pre_commit_uv-4.0.0/src/pre_commit_uv/__init__.py +68 -0
- pre_commit_uv-4.0.0/src/pre_commit_uv_patch.pth +1 -0
- pre_commit_uv-4.0.0/tests/test_main.py +37 -0
- pre_commit_uv-4.0.0/tox.ini +71 -0
- pre_commit_uv-3.8.0/LICENSE +0 -19
- pre_commit_uv-3.8.0/PKG-INFO +0 -30
- pre_commit_uv-3.8.0/README.md +0 -7
- pre_commit_uv-3.8.0/pre_commit/__main__.py +0 -7
- pre_commit_uv-3.8.0/pre_commit/all_languages.py +0 -50
- pre_commit_uv-3.8.0/pre_commit/clientlib.py +0 -405
- pre_commit_uv-3.8.0/pre_commit/color.py +0 -109
- pre_commit_uv-3.8.0/pre_commit/commands/__init__.py +0 -0
- pre_commit_uv-3.8.0/pre_commit/commands/autoupdate.py +0 -215
- pre_commit_uv-3.8.0/pre_commit/commands/clean.py +0 -16
- pre_commit_uv-3.8.0/pre_commit/commands/gc.py +0 -89
- pre_commit_uv-3.8.0/pre_commit/commands/hook_impl.py +0 -271
- pre_commit_uv-3.8.0/pre_commit/commands/init_templatedir.py +0 -39
- pre_commit_uv-3.8.0/pre_commit/commands/install_uninstall.py +0 -167
- pre_commit_uv-3.8.0/pre_commit/commands/migrate_config.py +0 -75
- pre_commit_uv-3.8.0/pre_commit/commands/run.py +0 -447
- pre_commit_uv-3.8.0/pre_commit/commands/sample_config.py +0 -18
- pre_commit_uv-3.8.0/pre_commit/commands/try_repo.py +0 -77
- pre_commit_uv-3.8.0/pre_commit/commands/validate_config.py +0 -18
- pre_commit_uv-3.8.0/pre_commit/commands/validate_manifest.py +0 -18
- pre_commit_uv-3.8.0/pre_commit/constants.py +0 -13
- pre_commit_uv-3.8.0/pre_commit/envcontext.py +0 -62
- pre_commit_uv-3.8.0/pre_commit/error_handler.py +0 -81
- pre_commit_uv-3.8.0/pre_commit/errors.py +0 -5
- pre_commit_uv-3.8.0/pre_commit/file_lock.py +0 -75
- pre_commit_uv-3.8.0/pre_commit/git.py +0 -245
- pre_commit_uv-3.8.0/pre_commit/hook.py +0 -60
- pre_commit_uv-3.8.0/pre_commit/lang_base.py +0 -192
- pre_commit_uv-3.8.0/pre_commit/languages/__init__.py +0 -0
- pre_commit_uv-3.8.0/pre_commit/languages/conda.py +0 -77
- pre_commit_uv-3.8.0/pre_commit/languages/coursier.py +0 -76
- pre_commit_uv-3.8.0/pre_commit/languages/dart.py +0 -97
- pre_commit_uv-3.8.0/pre_commit/languages/docker.py +0 -151
- pre_commit_uv-3.8.0/pre_commit/languages/docker_image.py +0 -32
- pre_commit_uv-3.8.0/pre_commit/languages/dotnet.py +0 -111
- pre_commit_uv-3.8.0/pre_commit/languages/fail.py +0 -27
- pre_commit_uv-3.8.0/pre_commit/languages/golang.py +0 -160
- pre_commit_uv-3.8.0/pre_commit/languages/haskell.py +0 -56
- pre_commit_uv-3.8.0/pre_commit/languages/lua.py +0 -75
- pre_commit_uv-3.8.0/pre_commit/languages/node.py +0 -110
- pre_commit_uv-3.8.0/pre_commit/languages/perl.py +0 -50
- pre_commit_uv-3.8.0/pre_commit/languages/pygrep.py +0 -133
- pre_commit_uv-3.8.0/pre_commit/languages/python.py +0 -295
- pre_commit_uv-3.8.0/pre_commit/languages/r.py +0 -254
- pre_commit_uv-3.8.0/pre_commit/languages/ruby.py +0 -145
- pre_commit_uv-3.8.0/pre_commit/languages/rust.py +0 -160
- pre_commit_uv-3.8.0/pre_commit/languages/script.py +0 -32
- pre_commit_uv-3.8.0/pre_commit/languages/swift.py +0 -50
- pre_commit_uv-3.8.0/pre_commit/languages/system.py +0 -10
- pre_commit_uv-3.8.0/pre_commit/logging_handler.py +0 -42
- pre_commit_uv-3.8.0/pre_commit/main.py +0 -442
- pre_commit_uv-3.8.0/pre_commit/meta_hooks/__init__.py +0 -0
- pre_commit_uv-3.8.0/pre_commit/meta_hooks/check_hooks_apply.py +0 -43
- pre_commit_uv-3.8.0/pre_commit/meta_hooks/check_useless_excludes.py +0 -83
- pre_commit_uv-3.8.0/pre_commit/meta_hooks/identity.py +0 -17
- pre_commit_uv-3.8.0/pre_commit/output.py +0 -33
- pre_commit_uv-3.8.0/pre_commit/parse_shebang.py +0 -85
- pre_commit_uv-3.8.0/pre_commit/prefix.py +0 -18
- pre_commit_uv-3.8.0/pre_commit/repository.py +0 -246
- pre_commit_uv-3.8.0/pre_commit/resources/__init__.py +0 -0
- pre_commit_uv-3.8.0/pre_commit/resources/empty_template_.npmignore +0 -1
- pre_commit_uv-3.8.0/pre_commit/resources/empty_template_Cargo.toml +0 -7
- pre_commit_uv-3.8.0/pre_commit/resources/empty_template_LICENSE.renv +0 -7
- pre_commit_uv-3.8.0/pre_commit/resources/empty_template_Makefile.PL +0 -6
- pre_commit_uv-3.8.0/pre_commit/resources/empty_template_activate.R +0 -440
- pre_commit_uv-3.8.0/pre_commit/resources/empty_template_environment.yml +0 -9
- pre_commit_uv-3.8.0/pre_commit/resources/empty_template_go.mod +0 -1
- pre_commit_uv-3.8.0/pre_commit/resources/empty_template_main.go +0 -3
- pre_commit_uv-3.8.0/pre_commit/resources/empty_template_main.rs +0 -1
- pre_commit_uv-3.8.0/pre_commit/resources/empty_template_package.json +0 -4
- pre_commit_uv-3.8.0/pre_commit/resources/empty_template_pre-commit-package-dev-1.rockspec +0 -12
- pre_commit_uv-3.8.0/pre_commit/resources/empty_template_pre_commit_placeholder_package.gemspec +0 -6
- pre_commit_uv-3.8.0/pre_commit/resources/empty_template_pubspec.yaml +0 -4
- pre_commit_uv-3.8.0/pre_commit/resources/empty_template_renv.lock +0 -20
- pre_commit_uv-3.8.0/pre_commit/resources/empty_template_setup.py +0 -4
- pre_commit_uv-3.8.0/pre_commit/resources/hook-tmpl +0 -20
- pre_commit_uv-3.8.0/pre_commit/resources/rbenv.tar.gz +0 -0
- pre_commit_uv-3.8.0/pre_commit/resources/ruby-build.tar.gz +0 -0
- pre_commit_uv-3.8.0/pre_commit/resources/ruby-download.tar.gz +0 -0
- pre_commit_uv-3.8.0/pre_commit/staged_files_only.py +0 -113
- pre_commit_uv-3.8.0/pre_commit/store.py +0 -254
- pre_commit_uv-3.8.0/pre_commit/util.py +0 -239
- pre_commit_uv-3.8.0/pre_commit/xargs.py +0 -185
- pre_commit_uv-3.8.0/pre_commit/yaml.py +0 -18
- pre_commit_uv-3.8.0/pre_commit_uv.egg-info/PKG-INFO +0 -30
- pre_commit_uv-3.8.0/pre_commit_uv.egg-info/SOURCES.txt +0 -92
- pre_commit_uv-3.8.0/pre_commit_uv.egg-info/dependency_links.txt +0 -1
- pre_commit_uv-3.8.0/pre_commit_uv.egg-info/entry_points.txt +0 -2
- pre_commit_uv-3.8.0/pre_commit_uv.egg-info/requires.txt +0 -6
- pre_commit_uv-3.8.0/pre_commit_uv.egg-info/top_level.txt +0 -1
- pre_commit_uv-3.8.0/setup.cfg +0 -69
- pre_commit_uv-3.8.0/setup.py +0 -4
- /pre_commit_uv-3.8.0/pre_commit/__init__.py → /pre_commit_uv-4.0.0/src/pre_commit_uv/py.typed +0 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
Permission is hereby granted, free of charge, to any person obtaining a
|
|
2
|
+
copy of this software and associated documentation files (the
|
|
3
|
+
"Software"), to deal in the Software without restriction, including
|
|
4
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
5
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
6
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
7
|
+
the following conditions:
|
|
8
|
+
|
|
9
|
+
The above copyright notice and this permission notice shall be included
|
|
10
|
+
in all copies or substantial portions of the Software.
|
|
11
|
+
|
|
12
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
13
|
+
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
14
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
15
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
16
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
17
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
18
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: pre-commit-uv
|
|
3
|
+
Version: 4.0.0
|
|
4
|
+
Summary: Run pre-commit with uv
|
|
5
|
+
Project-URL: Bug Tracker, https://github.com/tox-dev/pre-commit-uv/issues
|
|
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
|
+
Project-URL: Source Code, https://github.com/tox-dev/pre-commit-uv
|
|
9
|
+
Author-email: Bernat Gabor <gaborjbernat@gmail.com>
|
|
10
|
+
License: Permission is hereby granted, free of charge, to any person obtaining a
|
|
11
|
+
copy of this software and associated documentation files (the
|
|
12
|
+
"Software"), to deal in the Software without restriction, including
|
|
13
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
14
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
15
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
16
|
+
the following conditions:
|
|
17
|
+
|
|
18
|
+
The above copyright notice and this permission notice shall be included
|
|
19
|
+
in all copies or substantial portions of the Software.
|
|
20
|
+
|
|
21
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
22
|
+
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
23
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
24
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
25
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
26
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
27
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
28
|
+
License-File: LICENSE.txt
|
|
29
|
+
Keywords: format,pyproject
|
|
30
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
31
|
+
Classifier: Operating System :: OS Independent
|
|
32
|
+
Classifier: Programming Language :: Python
|
|
33
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
34
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
35
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
36
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
37
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
38
|
+
Requires-Python: >=3.9
|
|
39
|
+
Requires-Dist: pre-commit>=3.8
|
|
40
|
+
Requires-Dist: uv>=0.2.33
|
|
41
|
+
Provides-Extra: test
|
|
42
|
+
Requires-Dist: covdefaults>=2.3; extra == 'test'
|
|
43
|
+
Requires-Dist: pytest-cov>=5; extra == 'test'
|
|
44
|
+
Requires-Dist: pytest-mock>=3.14; extra == 'test'
|
|
45
|
+
Requires-Dist: pytest>=8.3.2; extra == 'test'
|
|
46
|
+
Description-Content-Type: text/markdown
|
|
47
|
+
|
|
48
|
+
# pre-commit-uv
|
|
49
|
+
|
|
50
|
+
[](https://pypi.org/project/pre-commit-uv)
|
|
51
|
+
[](https://pypi.org/project/pre-commit-uv)
|
|
52
|
+
[](https://pypi.org/project/pre-commit-uv)
|
|
53
|
+
[](https://pepy.tech/project/pre-commit-uv)
|
|
54
|
+
[](https://opensource.org/licenses/MIT)
|
|
55
|
+
[](https://github.com/tox-dev/pre-commit-uv/actions/workflows/check.yml)
|
|
56
|
+
|
|
57
|
+
Use `uv` to create virtual environments and install packages for `pre-commit`.
|
|
58
|
+
|
|
59
|
+
## Configuration
|
|
60
|
+
|
|
61
|
+
Once installed will use `uv` out of box, however the `DISABLE_PRE_COMMIT_UV_PATCH` environment variable if set will work as an escape hatch.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# pre-commit-uv
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/pre-commit-uv)
|
|
4
|
+
[](https://pypi.org/project/pre-commit-uv)
|
|
5
|
+
[](https://pypi.org/project/pre-commit-uv)
|
|
6
|
+
[](https://pepy.tech/project/pre-commit-uv)
|
|
7
|
+
[](https://opensource.org/licenses/MIT)
|
|
8
|
+
[](https://github.com/tox-dev/pre-commit-uv/actions/workflows/check.yml)
|
|
9
|
+
|
|
10
|
+
Use `uv` to create virtual environments and install packages for `pre-commit`.
|
|
11
|
+
|
|
12
|
+
## Configuration
|
|
13
|
+
|
|
14
|
+
Once installed will use `uv` out of box, however the `DISABLE_PRE_COMMIT_UV_PATCH` environment variable if set will work as an escape hatch.
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
build-backend = "hatchling.build"
|
|
3
|
+
requires = [
|
|
4
|
+
"hatch-vcs>=0.4",
|
|
5
|
+
"hatchling>=1.25",
|
|
6
|
+
]
|
|
7
|
+
|
|
8
|
+
[project]
|
|
9
|
+
name = "pre-commit-uv"
|
|
10
|
+
description = "Run pre-commit with uv"
|
|
11
|
+
readme = "README.md"
|
|
12
|
+
keywords = [
|
|
13
|
+
"format",
|
|
14
|
+
"pyproject",
|
|
15
|
+
]
|
|
16
|
+
license.file = "LICENSE.txt"
|
|
17
|
+
authors = [
|
|
18
|
+
{ name = "Bernat Gabor", email = "gaborjbernat@gmail.com" },
|
|
19
|
+
]
|
|
20
|
+
requires-python = ">=3.9"
|
|
21
|
+
classifiers = [
|
|
22
|
+
"License :: OSI Approved :: MIT License",
|
|
23
|
+
"Operating System :: OS Independent",
|
|
24
|
+
"Programming Language :: Python",
|
|
25
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
26
|
+
"Programming Language :: Python :: 3.9",
|
|
27
|
+
"Programming Language :: Python :: 3.10",
|
|
28
|
+
"Programming Language :: Python :: 3.11",
|
|
29
|
+
"Programming Language :: Python :: 3.12",
|
|
30
|
+
]
|
|
31
|
+
dynamic = [
|
|
32
|
+
"version",
|
|
33
|
+
]
|
|
34
|
+
dependencies = [
|
|
35
|
+
"pre-commit>=3.8",
|
|
36
|
+
"uv>=0.2.33",
|
|
37
|
+
]
|
|
38
|
+
optional-dependencies.test = [
|
|
39
|
+
"covdefaults>=2.3",
|
|
40
|
+
"pytest>=8.3.2",
|
|
41
|
+
"pytest-cov>=5",
|
|
42
|
+
"pytest-mock>=3.14",
|
|
43
|
+
]
|
|
44
|
+
urls."Bug Tracker" = "https://github.com/tox-dev/pre-commit-uv/issues"
|
|
45
|
+
urls."Changelog" = "https://github.com/tox-dev/pre-commit-uv/releases"
|
|
46
|
+
urls.Documentation = "https://github.com/tox-dev/pre-commit-uv/"
|
|
47
|
+
urls."Source Code" = "https://github.com/tox-dev/pre-commit-uv"
|
|
48
|
+
|
|
49
|
+
[tool.hatch]
|
|
50
|
+
build.dev-mode-dirs = [
|
|
51
|
+
"src",
|
|
52
|
+
]
|
|
53
|
+
build.targets.sdist.include = [
|
|
54
|
+
"/src",
|
|
55
|
+
"/tests",
|
|
56
|
+
"tox.ini",
|
|
57
|
+
]
|
|
58
|
+
build.targets.wheel.force-include = { "src/pre_commit_uv_patch.pth" = "pre_commit_uv_patch.pth" }
|
|
59
|
+
version.source = "vcs"
|
|
60
|
+
|
|
61
|
+
[tool.ruff]
|
|
62
|
+
target-version = "py39"
|
|
63
|
+
line-length = 120
|
|
64
|
+
format.preview = true
|
|
65
|
+
format.docstring-code-line-length = 100
|
|
66
|
+
format.docstring-code-format = true
|
|
67
|
+
lint.select = [
|
|
68
|
+
"ALL",
|
|
69
|
+
]
|
|
70
|
+
lint.ignore = [
|
|
71
|
+
"ANN101", # no type annotation for self
|
|
72
|
+
"ANN401", # allow Any as type annotation
|
|
73
|
+
"COM812", # Conflict with formatter
|
|
74
|
+
"CPY", # No copyright statements
|
|
75
|
+
"D203", # `one-blank-line-before-class` (D203) and `no-blank-line-before-class` (D211) are incompatible
|
|
76
|
+
"D212", # `multi-line-summary-first-line` (D212) and `multi-line-summary-second-line` (D213) are incompatible
|
|
77
|
+
"DOC501", # not working with Sphinx
|
|
78
|
+
"ISC001", # Conflict with formatter
|
|
79
|
+
"S104", # Possible binding to all interfaces
|
|
80
|
+
]
|
|
81
|
+
lint.per-file-ignores."tests/**/*.py" = [
|
|
82
|
+
"D", # don"t care about documentation in tests
|
|
83
|
+
"FBT", # don"t care about booleans as positional arguments in tests
|
|
84
|
+
"INP001", # no implicit namespace
|
|
85
|
+
"PLC2701", # private import
|
|
86
|
+
"PLR0913", # any number of arguments in tests
|
|
87
|
+
"PLR0917", # any number of arguments in tests
|
|
88
|
+
"PLR2004", # Magic value used in comparison, consider replacing with a constant variable
|
|
89
|
+
"S101", # asserts allowed in tests...
|
|
90
|
+
"S603", # `subprocess` call: check for execution of untrusted input
|
|
91
|
+
]
|
|
92
|
+
lint.isort = { known-first-party = [
|
|
93
|
+
"pre_commit_uv",
|
|
94
|
+
], required-imports = [
|
|
95
|
+
"from __future__ import annotations",
|
|
96
|
+
] }
|
|
97
|
+
lint.preview = true
|
|
98
|
+
|
|
99
|
+
[tool.codespell]
|
|
100
|
+
builtin = "clear,usage,en-GB_to_en-US"
|
|
101
|
+
count = true
|
|
102
|
+
|
|
103
|
+
[tool.pytest]
|
|
104
|
+
ini_options.testpaths = [
|
|
105
|
+
"tests",
|
|
106
|
+
]
|
|
107
|
+
|
|
108
|
+
[tool.coverage]
|
|
109
|
+
html.show_contexts = true
|
|
110
|
+
html.skip_covered = false
|
|
111
|
+
paths.source = [
|
|
112
|
+
"src",
|
|
113
|
+
".tox/*/.venv/lib/*/site-packages",
|
|
114
|
+
".tox\\*\\.venv\\Lib\\site-packages",
|
|
115
|
+
".tox/*/lib/*/site-packages",
|
|
116
|
+
".tox\\*\\Lib\\site-packages",
|
|
117
|
+
"**/src",
|
|
118
|
+
"**\\src",
|
|
119
|
+
]
|
|
120
|
+
report.fail_under = 50
|
|
121
|
+
run.parallel = true
|
|
122
|
+
run.plugins = [
|
|
123
|
+
"covdefaults",
|
|
124
|
+
]
|
|
125
|
+
|
|
126
|
+
[tool.mypy]
|
|
127
|
+
show_error_codes = true
|
|
128
|
+
strict = true
|
|
129
|
+
overrides = [
|
|
130
|
+
{ module = [
|
|
131
|
+
"pre_commit.*",
|
|
132
|
+
], ignore_missing_imports = true },
|
|
133
|
+
]
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"""Package root."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import logging
|
|
6
|
+
import os
|
|
7
|
+
from functools import cache
|
|
8
|
+
from importlib.metadata import version as _metadata_version
|
|
9
|
+
from typing import TYPE_CHECKING, cast
|
|
10
|
+
|
|
11
|
+
from pre_commit import lang_base, main
|
|
12
|
+
from pre_commit.languages import python
|
|
13
|
+
from pre_commit.languages.python import in_env, norm_version
|
|
14
|
+
from pre_commit.util import CalledProcessError, cmd_output, cmd_output_b
|
|
15
|
+
from uv import find_uv_bin
|
|
16
|
+
|
|
17
|
+
if TYPE_CHECKING:
|
|
18
|
+
from collections.abc import Sequence
|
|
19
|
+
|
|
20
|
+
from pre_commit.prefix import Prefix
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
__version__ = _metadata_version("pre-commit-uv")
|
|
24
|
+
_uv_version = _metadata_version("uv")
|
|
25
|
+
_original_main = main.main
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def _patch() -> None:
|
|
29
|
+
if os.environ.get("DISABLE_PRE_COMMIT_UV_PATCH") is None:
|
|
30
|
+
main.main = _new_main
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def _new_main(argv: Sequence[str] | None = None) -> int:
|
|
34
|
+
python.install_environment = _install_environment
|
|
35
|
+
python._version_info = _version_info # noqa: SLF001
|
|
36
|
+
return cast(int, _original_main(argv))
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def _install_environment(
|
|
40
|
+
prefix: Prefix,
|
|
41
|
+
version: str,
|
|
42
|
+
additional_dependencies: Sequence[str],
|
|
43
|
+
) -> None:
|
|
44
|
+
logging.getLogger("pre_commit").info("Using pre-commit with uv %s via pre-commit-uv %s", _uv_version, __version__)
|
|
45
|
+
uv = find_uv_bin()
|
|
46
|
+
|
|
47
|
+
venv_cmd = [uv, "venv", lang_base.environment_dir(prefix, python.ENVIRONMENT_DIR, version)]
|
|
48
|
+
py = norm_version(version)
|
|
49
|
+
if py is not None:
|
|
50
|
+
venv_cmd.extend(("-p", py))
|
|
51
|
+
cmd_output_b(*venv_cmd, cwd="/")
|
|
52
|
+
|
|
53
|
+
with in_env(prefix, version):
|
|
54
|
+
lang_base.setup_cmd(prefix, (uv, "pip", "install", ".", *additional_dependencies))
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
@cache
|
|
58
|
+
def _version_info(exe: str) -> str:
|
|
59
|
+
prog = 'import sys;print(".".join(str(p) for p in sys.version_info[0:3]))'
|
|
60
|
+
try:
|
|
61
|
+
return cast(str, cmd_output(exe, "-S", "-c", prog)[1].strip())
|
|
62
|
+
except CalledProcessError:
|
|
63
|
+
return f"<<error retrieving version from {exe}>>"
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
__all__ = [
|
|
67
|
+
"__version__",
|
|
68
|
+
]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import pre_commit_uv; pre_commit_uv._patch()
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from importlib.metadata import version
|
|
4
|
+
from textwrap import dedent
|
|
5
|
+
from typing import TYPE_CHECKING
|
|
6
|
+
|
|
7
|
+
from pre_commit import main
|
|
8
|
+
|
|
9
|
+
if TYPE_CHECKING:
|
|
10
|
+
from pathlib import Path
|
|
11
|
+
|
|
12
|
+
import pytest
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def test_install(tmp_path: Path, caplog: pytest.LogCaptureFixture, monkeypatch: pytest.MonkeyPatch) -> None:
|
|
16
|
+
conf = """
|
|
17
|
+
repos:
|
|
18
|
+
- repo: https://github.com/tox-dev/pyproject-fmt
|
|
19
|
+
rev: "2.2.0"
|
|
20
|
+
hooks:
|
|
21
|
+
- id: pyproject-fmt
|
|
22
|
+
"""
|
|
23
|
+
conf_file = tmp_path / ".pre-commit-config.yaml"
|
|
24
|
+
conf_file.write_text(dedent(conf))
|
|
25
|
+
monkeypatch.setenv("PRE_COMMIT_HOME", str(tmp_path / "store"))
|
|
26
|
+
|
|
27
|
+
main.main(["install-hooks", "-c", str(conf_file)])
|
|
28
|
+
|
|
29
|
+
uv = version("uv")
|
|
30
|
+
self = version("pre-commit-uv")
|
|
31
|
+
assert caplog.messages == [
|
|
32
|
+
"Initializing environment for https://github.com/tox-dev/pyproject-fmt.",
|
|
33
|
+
"Installing environment for https://github.com/tox-dev/pyproject-fmt.",
|
|
34
|
+
"Once installed this environment will be reused.",
|
|
35
|
+
"This may take a few minutes...",
|
|
36
|
+
f"Using pre-commit with uv {uv} via pre-commit-uv {self}",
|
|
37
|
+
]
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
[tox]
|
|
2
|
+
requires =
|
|
3
|
+
tox>=4.2
|
|
4
|
+
env_list =
|
|
5
|
+
fix
|
|
6
|
+
py312
|
|
7
|
+
py311
|
|
8
|
+
py310
|
|
9
|
+
py39
|
|
10
|
+
type
|
|
11
|
+
readme
|
|
12
|
+
skip_missing_interpreters = true
|
|
13
|
+
|
|
14
|
+
[testenv]
|
|
15
|
+
description = run the unit tests with pytest under {basepython}
|
|
16
|
+
package = wheel
|
|
17
|
+
wheel_build_env = .pkg
|
|
18
|
+
extras =
|
|
19
|
+
test
|
|
20
|
+
set_env =
|
|
21
|
+
COVERAGE_FILE = {toxworkdir}/.coverage.{envname}
|
|
22
|
+
COVERAGE_PROCESS_START = {toxinidir}/setup.cfg
|
|
23
|
+
_COVERAGE_SRC = {envsitepackagesdir}/sphinx_argparse_cli
|
|
24
|
+
commands =
|
|
25
|
+
python -m pytest {tty:--color=yes} {posargs: \
|
|
26
|
+
--junitxml {toxworkdir}{/}junit.{envname}.xml --cov {envsitepackagesdir}{/}pre_commit_uv \
|
|
27
|
+
--cov {toxinidir}{/}tests \
|
|
28
|
+
--cov-config=pyproject.toml --no-cov-on-fail --cov-report term-missing:skip-covered --cov-context=test \
|
|
29
|
+
--cov-report html:{envtmpdir}{/}htmlcov --cov-report xml:{toxworkdir}{/}coverage.{envname}.xml \
|
|
30
|
+
tests}
|
|
31
|
+
|
|
32
|
+
[testenv:fix]
|
|
33
|
+
description = run static analysis and style check using flake8
|
|
34
|
+
skip_install = true
|
|
35
|
+
deps =
|
|
36
|
+
pre-commit>=3.8
|
|
37
|
+
commands =
|
|
38
|
+
pre-commit run --all-files --show-diff-on-failure
|
|
39
|
+
python -c 'print("hint: run {envdir}/bin/pre-commit install to add checks as pre-commit hook")'
|
|
40
|
+
|
|
41
|
+
[testenv:type]
|
|
42
|
+
description = run type check on code base
|
|
43
|
+
deps =
|
|
44
|
+
mypy==1.11.1
|
|
45
|
+
set_env =
|
|
46
|
+
{tty:MYPY_FORCE_COLOR = 1}
|
|
47
|
+
commands =
|
|
48
|
+
mypy src
|
|
49
|
+
mypy tests
|
|
50
|
+
|
|
51
|
+
[testenv:readme]
|
|
52
|
+
description = check that the long description is valid
|
|
53
|
+
skip_install = true
|
|
54
|
+
deps =
|
|
55
|
+
build[virtualenv]>=1.2.1
|
|
56
|
+
twine>=5.1.1
|
|
57
|
+
commands =
|
|
58
|
+
python -m build --sdist --wheel -o {envtmpdir} .
|
|
59
|
+
twine check {envtmpdir}/*
|
|
60
|
+
|
|
61
|
+
[testenv:dev]
|
|
62
|
+
description = generate a DEV environment
|
|
63
|
+
package = editable
|
|
64
|
+
extras =
|
|
65
|
+
docs
|
|
66
|
+
test
|
|
67
|
+
commands =
|
|
68
|
+
python -c "import shutil; shutil.copy2('src{/}pre_commit_uv_patch.pth', '{env_site_packages_dir}{/}pre_commit_uv_patch.pth')"
|
|
69
|
+
python -m pip list --format=columns
|
|
70
|
+
python -c 'import sys; print(sys.executable)'
|
|
71
|
+
uv_seed = true
|
pre_commit_uv-3.8.0/LICENSE
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
Copyright (c) 2014 pre-commit dev team: Anthony Sottile, Ken Struys
|
|
2
|
-
|
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
-
in the Software without restriction, including without limitation the rights
|
|
6
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
-
furnished to do so, subject to the following conditions:
|
|
9
|
-
|
|
10
|
-
The above copyright notice and this permission notice shall be included in
|
|
11
|
-
all copies or substantial portions of the Software.
|
|
12
|
-
|
|
13
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
|
-
THE SOFTWARE.
|
pre_commit_uv-3.8.0/PKG-INFO
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: pre_commit_uv
|
|
3
|
-
Version: 3.8.0
|
|
4
|
-
Summary: A framework for managing and maintaining multi-language pre-commit hooks (fork with uv support).
|
|
5
|
-
Home-page: https://github.com/pre-commit/pre-commit
|
|
6
|
-
Author: "Guilherme Espada, Anthony Sottile"
|
|
7
|
-
Author-email: gjespada@fc.ul.pt
|
|
8
|
-
License: MIT
|
|
9
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
-
Classifier: Programming Language :: Python :: 3
|
|
11
|
-
Classifier: Programming Language :: Python :: 3 :: Only
|
|
12
|
-
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
13
|
-
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
14
|
-
Requires-Python: >=3.9
|
|
15
|
-
Description-Content-Type: text/markdown
|
|
16
|
-
License-File: LICENSE
|
|
17
|
-
Requires-Dist: cfgv>=2.0.0
|
|
18
|
-
Requires-Dist: identify>=1.0.0
|
|
19
|
-
Requires-Dist: nodeenv>=0.11.1
|
|
20
|
-
Requires-Dist: pyyaml>=5.1
|
|
21
|
-
Requires-Dist: tomlkit>=0.12.4
|
|
22
|
-
Requires-Dist: virtualenv>=20.10.0
|
|
23
|
-
|
|
24
|
-
## pre-commit-uv
|
|
25
|
-
|
|
26
|
-
*Note:* This is a minor fork of the upstream pre-commit project. It is published on pypi as `pre-commit-uv`.
|
|
27
|
-
|
|
28
|
-
A framework for managing and maintaining multi-language pre-commit hooks.
|
|
29
|
-
|
|
30
|
-
For more information see: https://pre-commit.com/
|
pre_commit_uv-3.8.0/README.md
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
from pre_commit.lang_base import Language
|
|
4
|
-
from pre_commit.languages import conda
|
|
5
|
-
from pre_commit.languages import coursier
|
|
6
|
-
from pre_commit.languages import dart
|
|
7
|
-
from pre_commit.languages import docker
|
|
8
|
-
from pre_commit.languages import docker_image
|
|
9
|
-
from pre_commit.languages import dotnet
|
|
10
|
-
from pre_commit.languages import fail
|
|
11
|
-
from pre_commit.languages import golang
|
|
12
|
-
from pre_commit.languages import haskell
|
|
13
|
-
from pre_commit.languages import lua
|
|
14
|
-
from pre_commit.languages import node
|
|
15
|
-
from pre_commit.languages import perl
|
|
16
|
-
from pre_commit.languages import pygrep
|
|
17
|
-
from pre_commit.languages import python
|
|
18
|
-
from pre_commit.languages import r
|
|
19
|
-
from pre_commit.languages import ruby
|
|
20
|
-
from pre_commit.languages import rust
|
|
21
|
-
from pre_commit.languages import script
|
|
22
|
-
from pre_commit.languages import swift
|
|
23
|
-
from pre_commit.languages import system
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
languages: dict[str, Language] = {
|
|
27
|
-
'conda': conda,
|
|
28
|
-
'coursier': coursier,
|
|
29
|
-
'dart': dart,
|
|
30
|
-
'docker': docker,
|
|
31
|
-
'docker_image': docker_image,
|
|
32
|
-
'dotnet': dotnet,
|
|
33
|
-
'fail': fail,
|
|
34
|
-
'golang': golang,
|
|
35
|
-
'haskell': haskell,
|
|
36
|
-
'lua': lua,
|
|
37
|
-
'node': node,
|
|
38
|
-
'perl': perl,
|
|
39
|
-
'pygrep': pygrep,
|
|
40
|
-
'python': python,
|
|
41
|
-
'r': r,
|
|
42
|
-
'ruby': ruby,
|
|
43
|
-
'rust': rust,
|
|
44
|
-
'script': script,
|
|
45
|
-
'swift': swift,
|
|
46
|
-
'system': system,
|
|
47
|
-
# TODO: fully deprecate `python_venv`
|
|
48
|
-
'python_venv': python,
|
|
49
|
-
}
|
|
50
|
-
language_names = sorted(languages)
|