repo-review 0.11.1__py3-none-any.whl → 0.11.2__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/__main__.py CHANGED
@@ -1,5 +1,6 @@
1
1
  from __future__ import annotations
2
2
 
3
+ import importlib.metadata
3
4
  import itertools
4
5
  import json
5
6
  import os
@@ -74,6 +75,29 @@ def list_all(ctx: click.Context, _param: click.Parameter, value: bool) -> None:
74
75
  ctx.exit()
75
76
 
76
77
 
78
+ def all_versions(ctx: click.Context, _param: click.Parameter, value: bool) -> None:
79
+ if not value or ctx.resilient_parsing:
80
+ return
81
+
82
+ groups = ["repo_review.checks", "repo_review.families", "repo_review.fixtures"]
83
+ packages = {
84
+ dist.name: dist.version
85
+ for group in groups
86
+ for ep in importlib.metadata.entry_points(group=group)
87
+ if (dist := ep.dist) is not None
88
+ }
89
+ deps = ["rich", "rich-click", "click", "markdown-it-py", "pyyaml"]
90
+ rich.print("Repo-review's dependencies:")
91
+ for name in deps:
92
+ rich.print(
93
+ f" [bold]{name}[/bold]: [magenta]{importlib.metadata.version(name)}[/magenta]"
94
+ )
95
+ rich.print("Packages providing repo-review plugins:")
96
+ for name, version in sorted(packages.items()):
97
+ rich.print(f" [bold]{name}[/bold]: [green]{version}[/green]")
98
+ ctx.exit()
99
+
100
+
77
101
  def rich_printer(
78
102
  families: Mapping[str, Family],
79
103
  processed: list[Result],
@@ -243,9 +267,25 @@ def _remote_path_processor(package: Path) -> Path | GHPath:
243
267
  "packages",
244
268
  type=click.Path(dir_okay=True, path_type=Path),
245
269
  nargs=-1,
246
- required=True,
270
+ required=False,
247
271
  callback=remote_path_support,
248
272
  )
273
+ @click.option(
274
+ "--versions",
275
+ is_flag=True,
276
+ callback=all_versions,
277
+ expose_value=False,
278
+ is_eager=True,
279
+ help="List all plugin versions and exit",
280
+ )
281
+ @click.option(
282
+ "--list-all",
283
+ is_flag=True,
284
+ callback=list_all,
285
+ expose_value=False,
286
+ is_eager=True,
287
+ help="List all checks and exit",
288
+ )
249
289
  @click.option(
250
290
  "--format",
251
291
  "format_opt",
@@ -259,6 +299,12 @@ def _remote_path_processor(package: Path) -> Path | GHPath:
259
299
  type=click.Choice(["rich", "json", "html", "svg"]),
260
300
  help="Select additional output format for stderr. Will disable terminal escape codes for stdout for easy redirection.",
261
301
  )
302
+ @click.option(
303
+ "--show",
304
+ type=click.Choice(["all", "err", "errskip"]),
305
+ default="all",
306
+ help="Show all (default), or just errors, or errors and skips",
307
+ )
262
308
  @click.option(
263
309
  "--select",
264
310
  help="Only run certain checks, comma separated. All checks run if empty.",
@@ -275,20 +321,6 @@ def _remote_path_processor(package: Path) -> Path | GHPath:
275
321
  help="Path to python package.",
276
322
  default="",
277
323
  )
278
- @click.option(
279
- "--list-all",
280
- is_flag=True,
281
- callback=list_all,
282
- expose_value=False,
283
- is_eager=True,
284
- help="List all checks and exit",
285
- )
286
- @click.option(
287
- "--show",
288
- type=click.Choice(["all", "err", "errskip"]),
289
- default="all",
290
- help="Show all (default), or just errors, or errors and skips",
291
- )
292
324
  def main(
293
325
  packages: list[Path | GHPath],
294
326
  format_opt: Formats,
@@ -299,8 +331,11 @@ def main(
299
331
  show: Show,
300
332
  ) -> None:
301
333
  """
302
- Pass in a local Path or gh:org/repo@branch.
334
+ Pass in a local Path or gh:org/repo@branch. Will run on the current
335
+ directory if no path passed.
303
336
  """
337
+ if not packages:
338
+ packages = [Path()]
304
339
 
305
340
  if len(packages) > 1:
306
341
  if format_opt == "json":
repo_review/_version.py CHANGED
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '0.11.1'
16
- __version_tuple__ = version_tuple = (0, 11, 1)
15
+ __version__ = version = '0.11.2'
16
+ __version_tuple__ = version_tuple = (0, 11, 2)
repo_review/processor.py CHANGED
@@ -1,9 +1,11 @@
1
1
  from __future__ import annotations
2
2
 
3
+ import copy
3
4
  import dataclasses
4
5
  import graphlib
5
6
  import textwrap
6
7
  import typing
8
+ import warnings
7
9
  from collections.abc import Mapping, Set
8
10
  from typing import Any, TypeVar
9
11
 
@@ -211,13 +213,18 @@ def process(
211
213
 
212
214
  # Keep track of which checks have been completed
213
215
  completed: dict[str, str | None] = {}
216
+ fixtures_copy = copy.deepcopy(fixtures)
214
217
 
215
218
  # Run all the checks in topological order based on their dependencies
216
219
  ts = graphlib.TopologicalSorter(graph)
217
220
  for name in ts.static_order():
218
221
  if all(completed.get(n, "") == "" for n in graph[name]):
219
- result = apply_fixtures({"name": name, **fixtures}, tasks[name].check)
222
+ result = apply_fixtures({"name": name, **fixtures_copy}, tasks[name].check)
220
223
  completed[name] = process_result_bool(result, tasks[name], name)
224
+ if fixtures != fixtures_copy:
225
+ fixtures_copy = copy.deepcopy(fixtures)
226
+ msg = f"{name} modified the input fixtures! Making a deepcopy to fix and continue."
227
+ warnings.warn(msg, stacklevel=1)
221
228
  else:
222
229
  completed[name] = None
223
230
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: repo_review
3
- Version: 0.11.1
3
+ Version: 0.11.2
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
@@ -39,7 +39,7 @@ Requires-Dist: click>=8; extra == 'dev'
39
39
  Requires-Dist: pytest>=7; extra == 'dev'
40
40
  Requires-Dist: rich-click; extra == 'dev'
41
41
  Requires-Dist: rich>=12.2; extra == 'dev'
42
- Requires-Dist: sp-repo-review>=2024.04.23; extra == 'dev'
42
+ Requires-Dist: sp-repo-review>=2024.08.19; extra == 'dev'
43
43
  Requires-Dist: validate-pyproject>=0.14; extra == 'dev'
44
44
  Provides-Extra: docs
45
45
  Requires-Dist: click>=8; extra == 'docs'
@@ -55,7 +55,7 @@ Requires-Dist: sphinxcontrib-programoutput; extra == 'docs'
55
55
  Requires-Dist: sphinxext-opengraph; extra == 'docs'
56
56
  Provides-Extra: test
57
57
  Requires-Dist: pytest>=7; extra == 'test'
58
- Requires-Dist: sp-repo-review>=2024.04.23; extra == 'test'
58
+ Requires-Dist: sp-repo-review>=2024.08.19; extra == 'test'
59
59
  Requires-Dist: validate-pyproject>=0.14; extra == 'test'
60
60
  Description-Content-Type: text/markdown
61
61
 
@@ -1,13 +1,13 @@
1
1
  repo_review/__init__.py,sha256=U03wTpj7PjSsIROp8O4VRG_NVG-plkx14d_MvqpmJ_w,229
2
- repo_review/__main__.py,sha256=Nu6vzaaL6QtYf6N84WJ7n1ujt1TFe5ciyTDxZQMKLtY,12716
3
- repo_review/_version.py,sha256=GfnRHfD9z98AbNAoXaNE50CPUnbpEikyDWn-_mn0J2Q,413
2
+ repo_review/__main__.py,sha256=FjYamqrS55TYqFvz8TuZdJ5-C-l2QP3_6n8lLH04_8o,13890
3
+ repo_review/_version.py,sha256=v52WNNFq-_uq9OSfK9O7vLpi66zlufcyohjNPzWbpdk,413
4
4
  repo_review/_version.pyi,sha256=j5kbzfm6lOn8BzASXWjGIA1yT0OlHTWqlbyZ8Si_o0E,118
5
5
  repo_review/checks.py,sha256=SzTnMxj756xMb9Rffl9K65o2rUGDYfG6CQCj-pNWQzk,4316
6
6
  repo_review/families.py,sha256=TEMQY3whMj8b3iVlWyVsTa0CAZexXRCFXq5uPIkV6bs,2389
7
7
  repo_review/fixtures.py,sha256=AHdUhDU--SOrlhWSymiyECp5LmaCGYNRcZHuPpzFUts,3709
8
8
  repo_review/ghpath.py,sha256=YadsOkd2hGOrDffSU3PtQiDLgvrVe1GuMKeDFKXwtLs,6123
9
9
  repo_review/html.py,sha256=LwoZUqiWC84qSuhwbzqQtwhWDhE8JiPWWTI4nKXF3nA,3485
10
- repo_review/processor.py,sha256=2NSbuC7jt_eMjIB9VpY0c5-TtKr9GWzA8Gr6Pvj2SqU,7951
10
+ repo_review/processor.py,sha256=txXKyw1VP31sclfQL0yac5mXYTkFoca3t-3yKBvqc5k,8275
11
11
  repo_review/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
12
  repo_review/schema.py,sha256=U_iox0khN1oEHCCB5ILffjRvZLG7BR-aaip9QEpMkJk,593
13
13
  repo_review/testing.py,sha256=qbjevlG_DQbL4-l-7wTM9rqoLvRaxf7GF66D8i723OY,1915
@@ -19,8 +19,8 @@ repo_review/_compat/importlib/resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5J
19
19
  repo_review/_compat/importlib/resources/abc.py,sha256=KLv7AqUaY-ezZ32lA5yVcZLfMqY6VEo8Q-1jyWpGRbk,300
20
20
  repo_review/resources/__init__.py,sha256=RBBaUp-hQrIYBqbAT0MytCXEjDmqVsCjiEgdK_K3dN4,138
21
21
  repo_review/resources/repo-review.schema.json,sha256=jAc7ZQV-Hc16ENrNFZm7nlIjiRQGTanq8EjBICkJKpE,791
22
- repo_review-0.11.1.dist-info/METADATA,sha256=WdkUmLpDSoIJsMp-KRBCYVIba555Zctujo5I-i3f71g,11437
23
- repo_review-0.11.1.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
24
- repo_review-0.11.1.dist-info/entry_points.txt,sha256=9XaDWanm31NNpXOpjZh2HxSXR5owVdYJ2cbNG5D8wY8,244
25
- repo_review-0.11.1.dist-info/licenses/LICENSE,sha256=X7yOxzyAEckYl17p01lZzbraqDVmWEWXE8BnKKRrh7c,1525
26
- repo_review-0.11.1.dist-info/RECORD,,
22
+ repo_review-0.11.2.dist-info/METADATA,sha256=uCkBoPbRRxwzV-ZqOj070MBQiZL5sh4E3l7ENJhgs9M,11437
23
+ repo_review-0.11.2.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
24
+ repo_review-0.11.2.dist-info/entry_points.txt,sha256=9XaDWanm31NNpXOpjZh2HxSXR5owVdYJ2cbNG5D8wY8,244
25
+ repo_review-0.11.2.dist-info/licenses/LICENSE,sha256=X7yOxzyAEckYl17p01lZzbraqDVmWEWXE8BnKKRrh7c,1525
26
+ repo_review-0.11.2.dist-info/RECORD,,