repo-review 0.12.1__py3-none-any.whl → 0.12.3__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,11 +1,13 @@
1
1
  from __future__ import annotations
2
2
 
3
+ import functools
3
4
  import importlib.metadata
4
5
  import itertools
5
6
  import json
6
7
  import os
7
8
  import sys
8
9
  import typing
10
+ import urllib.error
9
11
  from collections.abc import Mapping, Sequence
10
12
  from pathlib import Path
11
13
  from typing import Any, Literal
@@ -17,6 +19,7 @@ if typing.TYPE_CHECKING:
17
19
  else:
18
20
  import rich_click as click
19
21
 
22
+ import rich
20
23
  import rich.console
21
24
  import rich.markdown
22
25
  import rich.syntax
@@ -98,16 +101,8 @@ def all_versions(ctx: click.Context, _param: click.Parameter, value: bool) -> No
98
101
  ctx.exit()
99
102
 
100
103
 
101
- def rich_printer(
102
- families: Mapping[str, Family],
103
- processed: list[Result],
104
- *,
105
- svg: bool = False,
106
- stderr: bool = False,
107
- color: bool = True,
108
- status: Status,
109
- header: str = "",
110
- ) -> None:
104
+ @functools.cache
105
+ def _ensure_unicode_streams() -> None:
111
106
  # Before Python 3.15, this isn't always unicode
112
107
  if (
113
108
  sys.version_info < (3, 15)
@@ -119,6 +114,19 @@ def rich_printer(
119
114
  if sys.stderr.encoding != "utf-8":
120
115
  sys.stderr.reconfigure(encoding="utf-8") # type: ignore[union-attr]
121
116
 
117
+
118
+ def rich_printer(
119
+ families: Mapping[str, Family],
120
+ processed: list[Result],
121
+ *,
122
+ svg: bool = False,
123
+ stderr: bool = False,
124
+ color: bool = True,
125
+ status: Status,
126
+ header: str = "",
127
+ ) -> None:
128
+ _ensure_unicode_streams()
129
+
122
130
  console = rich.console.Console(
123
131
  record=svg, quiet=svg, stderr=stderr, color_system="auto" if color else None
124
132
  )
@@ -265,10 +273,23 @@ def _remote_path_processor(package: Path) -> Path | GHPath:
265
273
  msg = "online repo must be of the form 'gh:org/repo@branch[:path]' (:branch missing)"
266
274
  raise click.BadParameter(msg)
267
275
  org_repo, branch = org_repo_branch.split("@", maxsplit=1)
268
- return GHPath(repo=org_repo, branch=branch, path=p[0] if p else "")
276
+ try:
277
+ return GHPath(repo=org_repo, branch=branch, path=p[0] if p else "")
278
+ except urllib.error.HTTPError as e:
279
+ rich.print(f"[red][bold]Error[/bold] accessing {e.url}", file=sys.stderr)
280
+ rich.print(f"[red]{e}", file=sys.stderr)
281
+ raise SystemExit(1) from None
269
282
 
270
283
 
271
- @click.command(context_settings={"help_option_names": ["-h", "--help"]})
284
+ class UnicodeHelpCommand(click.Command):
285
+ def get_help(self, ctx: click.Context) -> str:
286
+ _ensure_unicode_streams()
287
+ return super().get_help(ctx)
288
+
289
+
290
+ @click.command(
291
+ cls=UnicodeHelpCommand, context_settings={"help_option_names": ["-h", "--help"]}
292
+ )
272
293
  @click.version_option(version=__version__)
273
294
  @click.argument(
274
295
  "packages",
repo_review/_version.py CHANGED
@@ -1,16 +1,34 @@
1
- # file generated by setuptools_scm
1
+ # file generated by setuptools-scm
2
2
  # don't change, don't track in version control
3
+
4
+ __all__ = [
5
+ "__version__",
6
+ "__version_tuple__",
7
+ "version",
8
+ "version_tuple",
9
+ "__commit_id__",
10
+ "commit_id",
11
+ ]
12
+
3
13
  TYPE_CHECKING = False
4
14
  if TYPE_CHECKING:
5
- from typing import Tuple, Union
15
+ from typing import Tuple
16
+ from typing import Union
17
+
6
18
  VERSION_TUPLE = Tuple[Union[int, str], ...]
19
+ COMMIT_ID = Union[str, None]
7
20
  else:
8
21
  VERSION_TUPLE = object
22
+ COMMIT_ID = object
9
23
 
10
24
  version: str
11
25
  __version__: str
12
26
  __version_tuple__: VERSION_TUPLE
13
27
  version_tuple: VERSION_TUPLE
28
+ commit_id: COMMIT_ID
29
+ __commit_id__: COMMIT_ID
30
+
31
+ __version__ = version = '0.12.3'
32
+ __version_tuple__ = version_tuple = (0, 12, 3)
14
33
 
15
- __version__ = version = '0.12.1'
16
- __version_tuple__ = version_tuple = (0, 12, 1)
34
+ __commit_id__ = commit_id = None
repo_review/ghpath.py CHANGED
@@ -50,11 +50,11 @@ class GHPath(Traversable):
50
50
  def open_url(url: str) -> io.StringIO:
51
51
  "This method can be overridden manually for WASM. Supports pyodide currently."
52
52
  if sys.platform == "emscripten":
53
- import pyodide.http
53
+ import pyodide.http # noqa: PLC0415
54
54
 
55
55
  return pyodide.http.open_url(url)
56
56
 
57
- import urllib.request # pylint: disable=import-outside-toplevel
57
+ import urllib.request # noqa: PLC0415
58
58
 
59
59
  with urllib.request.urlopen(url) as response:
60
60
  return io.StringIO(response.read().decode("utf-8"))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: repo_review
3
- Version: 0.12.1
3
+ Version: 0.12.3
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
@@ -22,6 +22,7 @@ Classifier: Programming Language :: Python :: 3.10
22
22
  Classifier: Programming Language :: Python :: 3.11
23
23
  Classifier: Programming Language :: Python :: 3.12
24
24
  Classifier: Programming Language :: Python :: 3.13
25
+ Classifier: Programming Language :: Python :: 3.14
25
26
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
26
27
  Classifier: Topic :: Software Development :: Quality Assurance
27
28
  Classifier: Typing :: Typed
@@ -128,7 +129,7 @@ repos have some [pre-commit][] check.
128
129
  ## Development of repo-review and plugins
129
130
 
130
131
  This project is intended to be fun and easy to develop and design checks for -
131
- it requires and uses Python 3.10, and uses a lot of the new features in 3.9 and
132
+ it requires and uses Python 3.10+, and uses a lot of the new features in 3.9 and
132
133
  3.10. It's maybe not entirely conventional, but it enables very simple plugin
133
134
  development. It works locally, remotely, and in WebAssembly (using
134
135
  [Pyodide][]). [See the docs][writing-a-plugin].
@@ -1,11 +1,11 @@
1
1
  repo_review/__init__.py,sha256=U03wTpj7PjSsIROp8O4VRG_NVG-plkx14d_MvqpmJ_w,229
2
- repo_review/__main__.py,sha256=-4cUtsnRua2Cwl5ESuBEzXljxWUY2kaAj3kZCFAfwh4,14863
3
- repo_review/_version.py,sha256=OSJc7-JxViAvW4SmGUZQQX05ZpGw9KopFINBSBZ_tHs,413
2
+ repo_review/__main__.py,sha256=jRu9323aVS-DH8ZHQXyF9afmtzt8gR6eLlNRnQRLjHA,15417
3
+ repo_review/_version.py,sha256=aQhQAWQK7Ayv_Drz5sUrTnuy21gUTxHx0OdXaQ7uUfY,706
4
4
  repo_review/_version.pyi,sha256=j5kbzfm6lOn8BzASXWjGIA1yT0OlHTWqlbyZ8Si_o0E,118
5
5
  repo_review/checks.py,sha256=Iz5T1d0wDfBIyaO3f5waHEqhmfP_4-9eNOngJpRnpGo,4845
6
6
  repo_review/families.py,sha256=TEMQY3whMj8b3iVlWyVsTa0CAZexXRCFXq5uPIkV6bs,2389
7
7
  repo_review/fixtures.py,sha256=ypeEj-Ae3_3bUWUE0n-wuOrKlEVFU6rp7zK-UoC_t6E,3607
8
- repo_review/ghpath.py,sha256=fkzUD1G_kuzCmVhTH2yAJoJxxYwjAXfjnBwtaj6nqg0,6123
8
+ repo_review/ghpath.py,sha256=4J7CfPhlnvdv-LtSTWEmXxxoN1zfscC828iJUjKBSTM,6114
9
9
  repo_review/html.py,sha256=Mazyng90X31DTOk23ZKtIMwyN-LeHnwG7StwdySwMAA,3716
10
10
  repo_review/processor.py,sha256=Cfw65EGfFQosLh6g1jeghWR0xTIg0HRpXXJVsCpiqX0,9524
11
11
  repo_review/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -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.12.1.dist-info/METADATA,sha256=usuR22S6tkCFLYZ04RoX0v4WaXXgFVCdHUBNi_sS4ho,10613
23
- repo_review-0.12.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
24
- repo_review-0.12.1.dist-info/entry_points.txt,sha256=9XaDWanm31NNpXOpjZh2HxSXR5owVdYJ2cbNG5D8wY8,244
25
- repo_review-0.12.1.dist-info/licenses/LICENSE,sha256=X7yOxzyAEckYl17p01lZzbraqDVmWEWXE8BnKKRrh7c,1525
26
- repo_review-0.12.1.dist-info/RECORD,,
22
+ repo_review-0.12.3.dist-info/METADATA,sha256=AxGI9mVQV_fi84ygvOKqio_-GRB5cztOtIXwox09QrY,10665
23
+ repo_review-0.12.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
24
+ repo_review-0.12.3.dist-info/entry_points.txt,sha256=9XaDWanm31NNpXOpjZh2HxSXR5owVdYJ2cbNG5D8wY8,244
25
+ repo_review-0.12.3.dist-info/licenses/LICENSE,sha256=X7yOxzyAEckYl17p01lZzbraqDVmWEWXE8BnKKRrh7c,1525
26
+ repo_review-0.12.3.dist-info/RECORD,,