repo-review 0.10.4__py3-none-any.whl → 0.10.6__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- repo_review/__init__.py +0 -1
- repo_review/__main__.py +3 -1
- repo_review/_compat/importlib/resources/abc.py +1 -0
- repo_review/_version.py +2 -2
- repo_review/checks.py +23 -0
- repo_review/ghpath.py +4 -8
- repo_review/processor.py +9 -13
- repo_review/testing.py +70 -0
- {repo_review-0.10.4.dist-info → repo_review-0.10.6.dist-info}/METADATA +14 -4
- {repo_review-0.10.4.dist-info → repo_review-0.10.6.dist-info}/RECORD +13 -12
- {repo_review-0.10.4.dist-info → repo_review-0.10.6.dist-info}/WHEEL +1 -1
- {repo_review-0.10.4.dist-info → repo_review-0.10.6.dist-info}/entry_points.txt +0 -0
- {repo_review-0.10.4.dist-info → repo_review-0.10.6.dist-info}/licenses/LICENSE +0 -0
repo_review/__init__.py
CHANGED
repo_review/__main__.py
CHANGED
@@ -41,7 +41,9 @@ def __dir__() -> list[str]:
|
|
41
41
|
return __all__
|
42
42
|
|
43
43
|
|
44
|
-
rich.traceback.install(
|
44
|
+
rich.traceback.install(
|
45
|
+
suppress=[click, rich, orig_click], show_locals=False, width=None
|
46
|
+
)
|
45
47
|
|
46
48
|
Status = Literal["empty", "passed", "skips", "errors"]
|
47
49
|
Formats = Literal["rich", "json", "html", "svg"]
|
repo_review/_version.py
CHANGED
repo_review/checks.py
CHANGED
@@ -120,3 +120,26 @@ def get_check_description(name: str, check: Check) -> str:
|
|
120
120
|
.. versionadded:: 0.8
|
121
121
|
"""
|
122
122
|
return (check.__doc__ or "").format(self=check, name=name)
|
123
|
+
|
124
|
+
|
125
|
+
def process_result_bool(
|
126
|
+
result: str | bool | None, check: Check, name: str
|
127
|
+
) -> str | None:
|
128
|
+
"""
|
129
|
+
This converts a bool into a string given a check and name. If the result is a string
|
130
|
+
or None, it is returned as is.
|
131
|
+
|
132
|
+
:param result: The result to process.
|
133
|
+
:param check: The check instance.
|
134
|
+
:param name: The name of the check.
|
135
|
+
:return: The final string or None.
|
136
|
+
|
137
|
+
.. versionadded:: 0.11
|
138
|
+
"""
|
139
|
+
if isinstance(result, bool):
|
140
|
+
return (
|
141
|
+
""
|
142
|
+
if result
|
143
|
+
else (check.check.__doc__ or "Check failed").format(name=name, self=check)
|
144
|
+
)
|
145
|
+
return result
|
repo_review/ghpath.py
CHANGED
@@ -76,12 +76,10 @@ class GHPath(Traversable):
|
|
76
76
|
return (self.path or self.repo).split("/")[-1]
|
77
77
|
|
78
78
|
@typing.overload # type: ignore[override]
|
79
|
-
def open(self, mode: Literal["r"], encoding: str | None = ...) -> io.StringIO:
|
80
|
-
...
|
79
|
+
def open(self, mode: Literal["r"], encoding: str | None = ...) -> io.StringIO: ...
|
81
80
|
|
82
81
|
@typing.overload
|
83
|
-
def open(self, mode: Literal["rb"]) -> io.BytesIO:
|
84
|
-
...
|
82
|
+
def open(self, mode: Literal["rb"]) -> io.BytesIO: ...
|
85
83
|
|
86
84
|
def open(
|
87
85
|
self, mode: Literal["r", "rb"] = "r", encoding: str | None = "utf-8"
|
@@ -164,12 +162,10 @@ class EmptyTraversable(Traversable):
|
|
164
162
|
return self._fake_name
|
165
163
|
|
166
164
|
@typing.overload # type: ignore[override]
|
167
|
-
def open(self, mode: Literal["r"], encoding: str | None = ...) -> io.StringIO:
|
168
|
-
...
|
165
|
+
def open(self, mode: Literal["r"], encoding: str | None = ...) -> io.StringIO: ...
|
169
166
|
|
170
167
|
@typing.overload
|
171
|
-
def open(self, mode: Literal["rb"]) -> io.BytesIO:
|
172
|
-
...
|
168
|
+
def open(self, mode: Literal["rb"]) -> io.BytesIO: ...
|
173
169
|
|
174
170
|
def open(
|
175
171
|
self, mode: Literal["r", "rb"] = "r", encoding: str | None = "utf-8"
|
repo_review/processor.py
CHANGED
@@ -10,7 +10,13 @@ from typing import Any, TypeVar
|
|
10
10
|
import markdown_it
|
11
11
|
|
12
12
|
from ._compat.importlib.resources.abc import Traversable
|
13
|
-
from .checks import
|
13
|
+
from .checks import (
|
14
|
+
Check,
|
15
|
+
collect_checks,
|
16
|
+
get_check_url,
|
17
|
+
is_allowed,
|
18
|
+
process_result_bool,
|
19
|
+
)
|
14
20
|
from .families import Family, collect_families
|
15
21
|
from .fixtures import apply_fixtures, collect_fixtures, compute_fixtures, pyproject
|
16
22
|
from .ghpath import EmptyTraversable
|
@@ -108,8 +114,7 @@ class HasFamily(typing.Protocol):
|
|
108
114
|
"""
|
109
115
|
|
110
116
|
@property
|
111
|
-
def family(self) -> str:
|
112
|
-
...
|
117
|
+
def family(self) -> str: ...
|
113
118
|
|
114
119
|
|
115
120
|
T = TypeVar("T", bound=HasFamily)
|
@@ -212,16 +217,7 @@ def process(
|
|
212
217
|
for name in ts.static_order():
|
213
218
|
if all(completed.get(n, "") == "" for n in graph[name]):
|
214
219
|
result = apply_fixtures({"name": name, **fixtures}, tasks[name].check)
|
215
|
-
|
216
|
-
completed[name] = (
|
217
|
-
""
|
218
|
-
if result
|
219
|
-
else (tasks[name].check.__doc__ or "Check failed").format(
|
220
|
-
name=name, self=tasks[name]
|
221
|
-
)
|
222
|
-
)
|
223
|
-
else:
|
224
|
-
completed[name] = result
|
220
|
+
completed[name] = process_result_bool(result, tasks[name], name)
|
225
221
|
else:
|
226
222
|
completed[name] = None
|
227
223
|
|
repo_review/testing.py
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
"""
|
2
|
+
Helpers for testing repo-review plugins.
|
3
|
+
"""
|
4
|
+
|
5
|
+
from __future__ import annotations
|
6
|
+
|
7
|
+
import importlib.metadata
|
8
|
+
import textwrap
|
9
|
+
from typing import Any
|
10
|
+
|
11
|
+
from ._compat import tomllib
|
12
|
+
from .checks import Check, get_check_url, process_result_bool
|
13
|
+
from .fixtures import apply_fixtures
|
14
|
+
from .processor import Result
|
15
|
+
|
16
|
+
__all__ = ["toml_loads", "compute_check"]
|
17
|
+
|
18
|
+
|
19
|
+
def __dir__() -> list[str]:
|
20
|
+
return __all__
|
21
|
+
|
22
|
+
|
23
|
+
def toml_loads(contents: str, /) -> Any:
|
24
|
+
"""
|
25
|
+
A helper function to quickly load a TOML string for Python 3.10+.
|
26
|
+
|
27
|
+
:param contents: The TOML string to load.
|
28
|
+
:return: The loaded TOML.
|
29
|
+
|
30
|
+
.. versionadded:: 0.10.6
|
31
|
+
"""
|
32
|
+
return tomllib.loads(contents)
|
33
|
+
|
34
|
+
|
35
|
+
def compute_check(name: str, /, **fixtures: Any) -> Result:
|
36
|
+
"""
|
37
|
+
A helper function to compute a check given fixtures, intended for testing.
|
38
|
+
Currently, all fixtures are required to be passed in as keyword arguments,
|
39
|
+
transitive fixtures are not supported.
|
40
|
+
|
41
|
+
:param name: The name of the check to compute.
|
42
|
+
:param fixtures: The fixtures to use when computing the check.
|
43
|
+
:return: The computed result.
|
44
|
+
|
45
|
+
.. versionadded:: 0.10.5
|
46
|
+
"""
|
47
|
+
|
48
|
+
check_functions = (
|
49
|
+
ep.load() for ep in importlib.metadata.entry_points(group="repo_review.checks")
|
50
|
+
)
|
51
|
+
checks = {
|
52
|
+
k: v
|
53
|
+
for func in check_functions
|
54
|
+
for k, v in apply_fixtures(fixtures, func).items()
|
55
|
+
}
|
56
|
+
check: Check = checks[name]
|
57
|
+
completed_raw = apply_fixtures({"name": name, **fixtures}, check.check)
|
58
|
+
completed = process_result_bool(completed_raw, check, name)
|
59
|
+
result = None if completed is None else not completed
|
60
|
+
doc = check.__doc__ or ""
|
61
|
+
err_msg = completed or ""
|
62
|
+
|
63
|
+
return Result(
|
64
|
+
family=check.family,
|
65
|
+
name=name,
|
66
|
+
description=doc.format(self=check, name=name).strip(),
|
67
|
+
result=result,
|
68
|
+
err_msg=textwrap.dedent(err_msg),
|
69
|
+
url=get_check_url(name, check),
|
70
|
+
)
|
@@ -1,6 +1,6 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.3
|
2
2
|
Name: repo_review
|
3
|
-
Version: 0.10.
|
3
|
+
Version: 0.10.6
|
4
4
|
Summary: Framework that can run checks on repos
|
5
5
|
Project-URL: Changelog, https://github.com/scientific-python/repo-review/releases
|
6
6
|
Project-URL: Demo, https://scientific-python.github.io/repo-review
|
@@ -34,11 +34,18 @@ Requires-Dist: click>=8; extra == 'cli'
|
|
34
34
|
Requires-Dist: rich-click; extra == 'cli'
|
35
35
|
Requires-Dist: rich>=12.2; extra == 'cli'
|
36
36
|
Provides-Extra: dev
|
37
|
-
Requires-Dist:
|
37
|
+
Requires-Dist: click>=8; extra == 'dev'
|
38
|
+
Requires-Dist: pytest>=7; extra == 'dev'
|
39
|
+
Requires-Dist: rich-click; extra == 'dev'
|
40
|
+
Requires-Dist: rich>=12.2; extra == 'dev'
|
41
|
+
Requires-Dist: sp-repo-review>=2023.12.21; extra == 'dev'
|
42
|
+
Requires-Dist: validate-pyproject>=0.14; extra == 'dev'
|
38
43
|
Provides-Extra: docs
|
44
|
+
Requires-Dist: click>=8; extra == 'docs'
|
39
45
|
Requires-Dist: furo; extra == 'docs'
|
40
46
|
Requires-Dist: myst-parser>=0.13; extra == 'docs'
|
41
|
-
Requires-Dist:
|
47
|
+
Requires-Dist: rich-click; extra == 'docs'
|
48
|
+
Requires-Dist: rich>=12.2; extra == 'docs'
|
42
49
|
Requires-Dist: sphinx-autodoc-typehints; extra == 'docs'
|
43
50
|
Requires-Dist: sphinx-copybutton; extra == 'docs'
|
44
51
|
Requires-Dist: sphinx-github-changelog; extra == 'docs'
|
@@ -57,6 +64,7 @@ Description-Content-Type: text/markdown
|
|
57
64
|
[![Documentation Status][docs-badge]][docs-link]
|
58
65
|
|
59
66
|
[![PyPI version][pypi-version]][pypi-link]
|
67
|
+
[![Conda-Forge][conda-badge]][conda-link]
|
60
68
|
[![PyPI platforms][pypi-platforms]][pypi-link]
|
61
69
|
|
62
70
|
<!-- SPHINX-START -->
|
@@ -212,6 +220,8 @@ This was developed for [Scikit-HEP][] before moving to Scientific-Python.
|
|
212
220
|
[sp-repo-review]: https://pypi.org/project/sp-repo-review
|
213
221
|
[validate-pyproject]: https://validate-pyproject.readthedocs.io
|
214
222
|
[validate-pyproject-schema-store]: https://github.com/henryiii/validate-pyproject-schema-store
|
223
|
+
[conda-badge]: https://img.shields.io/conda/vn/conda-forge/repo-review
|
224
|
+
[conda-link]: https://github.com/conda-forge/repo-review-feedstock
|
215
225
|
|
216
226
|
[intro-pre-commit]: https://repo-review.readthedocs.io/en/latest/intro.html#pre-commit
|
217
227
|
[intro-github-actions]: https://repo-review.readthedocs.io/en/latest/intro.html#github-actions
|
@@ -1,25 +1,26 @@
|
|
1
|
-
repo_review/__init__.py,sha256=
|
2
|
-
repo_review/__main__.py,sha256=
|
3
|
-
repo_review/_version.py,sha256=
|
1
|
+
repo_review/__init__.py,sha256=U03wTpj7PjSsIROp8O4VRG_NVG-plkx14d_MvqpmJ_w,229
|
2
|
+
repo_review/__main__.py,sha256=YG78gWDM5ExHNTEhdtMNGvJBV44JU_IkR5mc_3a5fqs,12262
|
3
|
+
repo_review/_version.py,sha256=0ek8_w_jF04UB6FpW1K7d1RgH0zQMd77H5TbKzdthjI,413
|
4
4
|
repo_review/_version.pyi,sha256=j5kbzfm6lOn8BzASXWjGIA1yT0OlHTWqlbyZ8Si_o0E,118
|
5
|
-
repo_review/checks.py,sha256=
|
5
|
+
repo_review/checks.py,sha256=hIwQARm0JESf0yMCfjR5jaI-AdnCO7ePTY28eQ2iOy4,4340
|
6
6
|
repo_review/families.py,sha256=TEMQY3whMj8b3iVlWyVsTa0CAZexXRCFXq5uPIkV6bs,2389
|
7
7
|
repo_review/fixtures.py,sha256=AHdUhDU--SOrlhWSymiyECp5LmaCGYNRcZHuPpzFUts,3709
|
8
|
-
repo_review/ghpath.py,sha256=
|
8
|
+
repo_review/ghpath.py,sha256=s83SiaSyfINvtuLn3wpNPQeiU3FipulgTQJObQ9m7tg,5978
|
9
9
|
repo_review/html.py,sha256=LwoZUqiWC84qSuhwbzqQtwhWDhE8JiPWWTI4nKXF3nA,3485
|
10
|
-
repo_review/processor.py,sha256=
|
10
|
+
repo_review/processor.py,sha256=2NSbuC7jt_eMjIB9VpY0c5-TtKr9GWzA8Gr6Pvj2SqU,7951
|
11
11
|
repo_review/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
12
12
|
repo_review/schema.py,sha256=U_iox0khN1oEHCCB5ILffjRvZLG7BR-aaip9QEpMkJk,593
|
13
|
+
repo_review/testing.py,sha256=qbjevlG_DQbL4-l-7wTM9rqoLvRaxf7GF66D8i723OY,1915
|
13
14
|
repo_review/_compat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
14
15
|
repo_review/_compat/tomllib.py,sha256=caR8Mj-hSBLE2zqdLLjzwOdCBOfikVqS8pWkc4K5vgc,233
|
15
16
|
repo_review/_compat/typing.py,sha256=vXfYiJHUaqMShRMbJi0VUg2V59UV-oxceZKSBZ3tfts,246
|
16
17
|
repo_review/_compat/importlib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
17
18
|
repo_review/_compat/importlib/resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
18
|
-
repo_review/_compat/importlib/resources/abc.py,sha256=
|
19
|
+
repo_review/_compat/importlib/resources/abc.py,sha256=KLv7AqUaY-ezZ32lA5yVcZLfMqY6VEo8Q-1jyWpGRbk,300
|
19
20
|
repo_review/resources/__init__.py,sha256=RBBaUp-hQrIYBqbAT0MytCXEjDmqVsCjiEgdK_K3dN4,138
|
20
21
|
repo_review/resources/repo-review.schema.json,sha256=Ljna-BRuoKihOnJ5_78Fgs0ZrYHlgohmtS6x37TJbDg,556
|
21
|
-
repo_review-0.10.
|
22
|
-
repo_review-0.10.
|
23
|
-
repo_review-0.10.
|
24
|
-
repo_review-0.10.
|
25
|
-
repo_review-0.10.
|
22
|
+
repo_review-0.10.6.dist-info/METADATA,sha256=AQbYlfGOEwgyws3DLqvTdWNoZesRfZZYUmsNF-7bG5A,11370
|
23
|
+
repo_review-0.10.6.dist-info/WHEEL,sha256=zEMcRr9Kr03x1ozGwg5v9NQBKn3kndp6LSoSlVg-jhU,87
|
24
|
+
repo_review-0.10.6.dist-info/entry_points.txt,sha256=9XaDWanm31NNpXOpjZh2HxSXR5owVdYJ2cbNG5D8wY8,244
|
25
|
+
repo_review-0.10.6.dist-info/licenses/LICENSE,sha256=X7yOxzyAEckYl17p01lZzbraqDVmWEWXE8BnKKRrh7c,1525
|
26
|
+
repo_review-0.10.6.dist-info/RECORD,,
|
File without changes
|
File without changes
|