repo-review 0.9.2__tar.gz → 0.9.3__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.
Files changed (63) hide show
  1. {repo_review-0.9.2 → repo_review-0.9.3}/.pre-commit-config.yaml +6 -6
  2. {repo_review-0.9.2 → repo_review-0.9.3}/PKG-INFO +46 -14
  3. {repo_review-0.9.2 → repo_review-0.9.3}/README.md +43 -12
  4. repo_review-0.9.3/docs/api/repo_review.resources.rst +7 -0
  5. {repo_review-0.9.2 → repo_review-0.9.3}/docs/api/repo_review.rst +16 -0
  6. {repo_review-0.9.2 → repo_review-0.9.3}/docs/conf.py +2 -0
  7. {repo_review-0.9.2 → repo_review-0.9.3}/docs/index.html +6 -1
  8. {repo_review-0.9.2 → repo_review-0.9.3}/docs/plugins.md +64 -5
  9. {repo_review-0.9.2 → repo_review-0.9.3}/pyproject.toml +9 -1
  10. {repo_review-0.9.2 → repo_review-0.9.3}/src/repo_review/_version.py +2 -2
  11. repo_review-0.9.3/src/repo_review/resources/__init__.py +8 -0
  12. repo_review-0.9.3/src/repo_review/resources/repo-review.schema.json +24 -0
  13. repo_review-0.9.3/src/repo_review/schema.py +24 -0
  14. repo_review-0.9.3/tests/test_package.py +45 -0
  15. repo_review-0.9.2/tests/test_package.py +0 -29
  16. {repo_review-0.9.2 → repo_review-0.9.3}/.devcontainer/devcontainer.json +0 -0
  17. {repo_review-0.9.2 → repo_review-0.9.3}/.git_archival.txt +0 -0
  18. {repo_review-0.9.2 → repo_review-0.9.3}/.gitattributes +0 -0
  19. {repo_review-0.9.2 → repo_review-0.9.3}/.github/CONTRIBUTING.md +0 -0
  20. {repo_review-0.9.2 → repo_review-0.9.3}/.github/dependabot.yml +0 -0
  21. {repo_review-0.9.2 → repo_review-0.9.3}/.github/matchers/pylint.json +0 -0
  22. {repo_review-0.9.2 → repo_review-0.9.3}/.github/workflows/cd.yml +0 -0
  23. {repo_review-0.9.2 → repo_review-0.9.3}/.github/workflows/ci.yml +0 -0
  24. {repo_review-0.9.2 → repo_review-0.9.3}/.gitignore +0 -0
  25. {repo_review-0.9.2 → repo_review-0.9.3}/.pre-commit-hooks.yaml +0 -0
  26. {repo_review-0.9.2 → repo_review-0.9.3}/.readthedocs.yaml +0 -0
  27. {repo_review-0.9.2 → repo_review-0.9.3}/LICENSE +0 -0
  28. {repo_review-0.9.2 → repo_review-0.9.3}/action.yml +0 -0
  29. {repo_review-0.9.2 → repo_review-0.9.3}/docs/.nojekyll +0 -0
  30. {repo_review-0.9.2 → repo_review-0.9.3}/docs/changelog.md +0 -0
  31. {repo_review-0.9.2 → repo_review-0.9.3}/docs/checks.md +0 -0
  32. {repo_review-0.9.2 → repo_review-0.9.3}/docs/cli.md +0 -0
  33. {repo_review-0.9.2 → repo_review-0.9.3}/docs/families.md +0 -0
  34. {repo_review-0.9.2 → repo_review-0.9.3}/docs/fixtures.md +0 -0
  35. {repo_review-0.9.2 → repo_review-0.9.3}/docs/index.md +0 -0
  36. {repo_review-0.9.2 → repo_review-0.9.3}/docs/intro.md +0 -0
  37. {repo_review-0.9.2 → repo_review-0.9.3}/docs/programmatic.md +0 -0
  38. {repo_review-0.9.2 → repo_review-0.9.3}/docs/webapp.js +0 -0
  39. {repo_review-0.9.2 → repo_review-0.9.3}/docs/webapp.md +0 -0
  40. {repo_review-0.9.2 → repo_review-0.9.3}/noxfile.py +0 -0
  41. {repo_review-0.9.2 → repo_review-0.9.3}/src/repo_review/__init__.py +0 -0
  42. {repo_review-0.9.2 → repo_review-0.9.3}/src/repo_review/__main__.py +0 -0
  43. {repo_review-0.9.2 → repo_review-0.9.3}/src/repo_review/_compat/__init__.py +0 -0
  44. {repo_review-0.9.2 → repo_review-0.9.3}/src/repo_review/_compat/importlib/__init__.py +0 -0
  45. {repo_review-0.9.2 → repo_review-0.9.3}/src/repo_review/_compat/importlib/resources/__init__.py +0 -0
  46. {repo_review-0.9.2 → repo_review-0.9.3}/src/repo_review/_compat/importlib/resources/abc.py +0 -0
  47. {repo_review-0.9.2 → repo_review-0.9.3}/src/repo_review/_compat/tomllib.py +0 -0
  48. {repo_review-0.9.2 → repo_review-0.9.3}/src/repo_review/_compat/typing.py +0 -0
  49. {repo_review-0.9.2 → repo_review-0.9.3}/src/repo_review/_version.pyi +0 -0
  50. {repo_review-0.9.2 → repo_review-0.9.3}/src/repo_review/checks.py +0 -0
  51. {repo_review-0.9.2 → repo_review-0.9.3}/src/repo_review/families.py +0 -0
  52. {repo_review-0.9.2 → repo_review-0.9.3}/src/repo_review/fixtures.py +0 -0
  53. {repo_review-0.9.2 → repo_review-0.9.3}/src/repo_review/ghpath.py +0 -0
  54. {repo_review-0.9.2 → repo_review-0.9.3}/src/repo_review/html.py +0 -0
  55. {repo_review-0.9.2 → repo_review-0.9.3}/src/repo_review/processor.py +0 -0
  56. {repo_review-0.9.2 → repo_review-0.9.3}/src/repo_review/py.typed +0 -0
  57. {repo_review-0.9.2 → repo_review-0.9.3}/tests/test_checks.py +0 -0
  58. {repo_review-0.9.2 → repo_review-0.9.3}/tests/test_cmd.py +0 -0
  59. {repo_review-0.9.2 → repo_review-0.9.3}/tests/test_families.py +0 -0
  60. {repo_review-0.9.2 → repo_review-0.9.3}/tests/test_fixtures.py +0 -0
  61. {repo_review-0.9.2 → repo_review-0.9.3}/tests/test_self.py +0 -0
  62. {repo_review-0.9.2 → repo_review-0.9.3}/tests/test_utilities/pyproject.py +0 -0
  63. {repo_review-0.9.2 → repo_review-0.9.3}/tests/test_utilities/pyproject.toml +0 -0
@@ -3,25 +3,25 @@ ci:
3
3
  autofix_commit_msg: "style: pre-commit fixes"
4
4
 
5
5
  repos:
6
- - repo: https://github.com/psf/black
6
+ - repo: https://github.com/psf/black-pre-commit-mirror
7
7
  rev: 23.7.0
8
8
  hooks:
9
9
  - id: black-jupyter
10
10
 
11
- - repo: https://github.com/asottile/blacken-docs
12
- rev: 1.15.0
11
+ - repo: https://github.com/adamchainz/blacken-docs
12
+ rev: 1.16.0
13
13
  hooks:
14
14
  - id: blacken-docs
15
15
  additional_dependencies: [black==23.7.0]
16
16
 
17
17
  - repo: https://github.com/astral-sh/ruff-pre-commit
18
- rev: "v0.0.281"
18
+ rev: "v0.0.285"
19
19
  hooks:
20
20
  - id: ruff
21
21
  args: ["--fix", "--show-fixes"]
22
22
 
23
23
  - repo: https://github.com/pre-commit/mirrors-prettier
24
- rev: "v3.0.0"
24
+ rev: "v3.0.2"
25
25
  hooks:
26
26
  - id: prettier
27
27
  types_or: [yaml, markdown, html, css, scss, javascript, json]
@@ -48,7 +48,7 @@ repos:
48
48
  - id: rst-inline-touching-normal
49
49
 
50
50
  - repo: https://github.com/pre-commit/mirrors-mypy
51
- rev: v1.4.1
51
+ rev: v1.5.1
52
52
  hooks:
53
53
  - id: mypy
54
54
  files: (src|web|tests)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: repo_review
3
- Version: 0.9.2
3
+ Version: 0.9.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
@@ -47,7 +47,8 @@ Requires-Dist: sphinxcontrib-programoutput; extra == 'docs'
47
47
  Requires-Dist: sphinxext-opengraph; extra == 'docs'
48
48
  Provides-Extra: test
49
49
  Requires-Dist: pytest>=7; extra == 'test'
50
- Requires-Dist: sp-repo-review; extra == 'test'
50
+ Requires-Dist: sp-repo-review>=2023.08.23; extra == 'test'
51
+ Requires-Dist: validate-pyproject>=0.14; extra == 'test'
51
52
  Description-Content-Type: text/markdown
52
53
 
53
54
  # repo-review
@@ -71,22 +72,25 @@ output formats are supported; `rich`, `svg`, `html`, and `json`.
71
72
 
72
73
  `sp-repo-review` provides checks based on the
73
74
  [Scientific-Python Development Guide][] at [scientific-python/cookie][]. A live
74
- WebAssembly demo using `sp-repo-review` is
75
+ WebAssembly demo using [sp-repo-review][] is
75
76
  [here][repo-review-demo].
76
77
 
77
78
  ## Running repo-review
78
79
 
79
80
  Repo-review supports running multiple ways:
80
81
 
81
- - From the command line on a local folder
82
+ - [From the command line][cli] on a local folder
82
83
  - From the command line on a remote repository on GitHub (`gh:org/repo@branch`)
83
- - From WebAssembly in [Pyodide][] (example in `docs/index.html`)
84
+ - [From WebAssembly][webapp] in [Pyodide][] (example in `docs/index.html`)
85
+ - [From pre-commit][intro-pre-commit]
86
+ - [From GitHub Actions][intro-github-actions]
87
+ - [From Python][programmatic-usage]
84
88
 
85
89
  If the root of a package is not the repository root, pass `--package-dir a/b/c`.
86
90
 
87
91
  ## Configuration
88
92
 
89
- Repo-review supports configuration via `pyproject.toml`:
93
+ Repo-review [supports configuration][intro-configuring] via `pyproject.toml`:
90
94
 
91
95
  ```toml
92
96
  [tool.repo-review]
@@ -119,7 +123,7 @@ This project is intended to be fun and easy to develop and design checks for -
119
123
  it requires and uses Python 3.10, and uses a lot of the new features in 3.9 and
120
124
  3.10. It's maybe not entirely conventional, but it enables very simple plugin
121
125
  development. It works locally, remotely, and in WebAssembly (using
122
- [Pyodide][]).
126
+ [Pyodide][]). [See the docs][writing-a-plugin].
123
127
 
124
128
  There are a few key designs that are very useful and make this possible. First,
125
129
  all paths are handled as Traversables. This allows a simple Traversable
@@ -127,13 +131,14 @@ implementation based on `open_url` to provide a web interface for use in the
127
131
  webapp. It also would allow `zipfile.Path` to work just as well, too - no need
128
132
  to extract.
129
133
 
130
- Checks can request fixtures (like [pytest][]) as arguments. Check files can add new
131
- fixtures as needed. Fixtures are are specified with entry points, and take any
132
- other fixture as arguments as well - the `root` and `package` fixtures
133
- represents the root of the repository and of the package you are checking,
134
- respectively, and are the basis for all other fixtures. `pyproject` is provided
135
- as well. Checks are specified via an entrypoint that returns a dict of checks;
136
- this also can accept fixtures, allowing dynamic check listings.
134
+ [Checks][] can request [fixtures][] (like [pytest][]) as arguments. Check files
135
+ can add new fixtures as needed. Fixtures are are specified with entry points,
136
+ and take any other fixture as arguments as well - the `root` and `package`
137
+ fixtures represents the root of the repository and of the package you are
138
+ checking, respectively, and are the basis for the other fixtures, which are
139
+ topologically sorted and cached. `pyproject` is provided as well. Checks are
140
+ specified via an entrypoint that returns a dict of checks; this can also can
141
+ accept fixtures, allowing dynamic check listings.
137
142
 
138
143
  Check files do not depend on the main library, and can be extended (similar to
139
144
  Flake8). You register new check files via entry-points - so extending this is
@@ -154,6 +159,17 @@ get a `None` result and the check method will not run. The front-end (Rich
154
159
  powered CLI or Pyodide webapp) will render the markdown-formatted check
155
160
  docstring only if the result is `False`.
156
161
 
162
+ Checks are organized by [Families][]. A plugin can customize the display name,
163
+ change the sort order, and add an optional (dynamic) description. Like the other
164
+ collection functions, the family entry-point also supports fixtures.
165
+
166
+ ## Plugins
167
+
168
+ Feel free to request your plugin be added to this list.
169
+
170
+ - [sp-repo-review][]: Checks based on the [Scientific-Python Development Guide][].
171
+ - [validate-pyproject][]: Adds a check to validate pyproject sections, also supports plugins.
172
+
157
173
  ## Links
158
174
 
159
175
  This project inspired [Try-PyHF](https://kratsg.github.io/try-pyhf/), an
@@ -182,5 +198,21 @@ This was developed for [Scikit-HEP][] before moving to Scientific-Python.
182
198
  [scientific-python development guide]: https://learn.scientific-python.org/development
183
199
  [scientific-python/cookie]: https://github.com/scientific-python/cookie
184
200
  [scikit-hep]: https://scikit-hep.org
201
+ [sp-repo-review]: https://pypi.org/project/sp-repo-review
202
+ [validate-pyproject]: https://validate-pyproject.readthedocs.io
203
+
204
+ [intro-pre-commit]: https://repo-review.readthedocs.io/en/latest/intro.html#pre-commit
205
+ [intro-github-actions]: https://repo-review.readthedocs.io/en/latest/intro.html#github-actions
206
+ [cli]: https://repo-review.readthedocs.io/en/latest/cli.html
207
+ [programmatic-usage]: https://repo-review.readthedocs.io/en/latest/programmatic.html
208
+ [webapp]: https://repo-review.readthedocs.io/en/latest/webapp.html
209
+ [intro-configuring]: https://repo-review.readthedocs.io/en/latest/intro.html#configuring
210
+ [writing-a-plugin]: https://repo-review.readthedocs.io/en/latest/plugins.html
211
+ [fixtures]: https://repo-review.readthedocs.io/en/latest/fixtures.html
212
+ [checks]: https://repo-review.readthedocs.io/en/latest/checks.html
213
+ [families]: https://repo-review.readthedocs.io/en/latest/families.html
214
+ [changelog]: https://repo-review.readthedocs.io/en/latest/changelog.html
215
+ [api]: https://repo-review.readthedocs.io/en/latest/api/repo_review.html
216
+
185
217
 
186
218
  <!-- prettier-ignore-end -->
@@ -19,22 +19,25 @@ output formats are supported; `rich`, `svg`, `html`, and `json`.
19
19
 
20
20
  `sp-repo-review` provides checks based on the
21
21
  [Scientific-Python Development Guide][] at [scientific-python/cookie][]. A live
22
- WebAssembly demo using `sp-repo-review` is
22
+ WebAssembly demo using [sp-repo-review][] is
23
23
  [here][repo-review-demo].
24
24
 
25
25
  ## Running repo-review
26
26
 
27
27
  Repo-review supports running multiple ways:
28
28
 
29
- - From the command line on a local folder
29
+ - [From the command line][cli] on a local folder
30
30
  - From the command line on a remote repository on GitHub (`gh:org/repo@branch`)
31
- - From WebAssembly in [Pyodide][] (example in `docs/index.html`)
31
+ - [From WebAssembly][webapp] in [Pyodide][] (example in `docs/index.html`)
32
+ - [From pre-commit][intro-pre-commit]
33
+ - [From GitHub Actions][intro-github-actions]
34
+ - [From Python][programmatic-usage]
32
35
 
33
36
  If the root of a package is not the repository root, pass `--package-dir a/b/c`.
34
37
 
35
38
  ## Configuration
36
39
 
37
- Repo-review supports configuration via `pyproject.toml`:
40
+ Repo-review [supports configuration][intro-configuring] via `pyproject.toml`:
38
41
 
39
42
  ```toml
40
43
  [tool.repo-review]
@@ -67,7 +70,7 @@ This project is intended to be fun and easy to develop and design checks for -
67
70
  it requires and uses Python 3.10, and uses a lot of the new features in 3.9 and
68
71
  3.10. It's maybe not entirely conventional, but it enables very simple plugin
69
72
  development. It works locally, remotely, and in WebAssembly (using
70
- [Pyodide][]).
73
+ [Pyodide][]). [See the docs][writing-a-plugin].
71
74
 
72
75
  There are a few key designs that are very useful and make this possible. First,
73
76
  all paths are handled as Traversables. This allows a simple Traversable
@@ -75,13 +78,14 @@ implementation based on `open_url` to provide a web interface for use in the
75
78
  webapp. It also would allow `zipfile.Path` to work just as well, too - no need
76
79
  to extract.
77
80
 
78
- Checks can request fixtures (like [pytest][]) as arguments. Check files can add new
79
- fixtures as needed. Fixtures are are specified with entry points, and take any
80
- other fixture as arguments as well - the `root` and `package` fixtures
81
- represents the root of the repository and of the package you are checking,
82
- respectively, and are the basis for all other fixtures. `pyproject` is provided
83
- as well. Checks are specified via an entrypoint that returns a dict of checks;
84
- this also can accept fixtures, allowing dynamic check listings.
81
+ [Checks][] can request [fixtures][] (like [pytest][]) as arguments. Check files
82
+ can add new fixtures as needed. Fixtures are are specified with entry points,
83
+ and take any other fixture as arguments as well - the `root` and `package`
84
+ fixtures represents the root of the repository and of the package you are
85
+ checking, respectively, and are the basis for the other fixtures, which are
86
+ topologically sorted and cached. `pyproject` is provided as well. Checks are
87
+ specified via an entrypoint that returns a dict of checks; this can also can
88
+ accept fixtures, allowing dynamic check listings.
85
89
 
86
90
  Check files do not depend on the main library, and can be extended (similar to
87
91
  Flake8). You register new check files via entry-points - so extending this is
@@ -102,6 +106,17 @@ get a `None` result and the check method will not run. The front-end (Rich
102
106
  powered CLI or Pyodide webapp) will render the markdown-formatted check
103
107
  docstring only if the result is `False`.
104
108
 
109
+ Checks are organized by [Families][]. A plugin can customize the display name,
110
+ change the sort order, and add an optional (dynamic) description. Like the other
111
+ collection functions, the family entry-point also supports fixtures.
112
+
113
+ ## Plugins
114
+
115
+ Feel free to request your plugin be added to this list.
116
+
117
+ - [sp-repo-review][]: Checks based on the [Scientific-Python Development Guide][].
118
+ - [validate-pyproject][]: Adds a check to validate pyproject sections, also supports plugins.
119
+
105
120
  ## Links
106
121
 
107
122
  This project inspired [Try-PyHF](https://kratsg.github.io/try-pyhf/), an
@@ -130,5 +145,21 @@ This was developed for [Scikit-HEP][] before moving to Scientific-Python.
130
145
  [scientific-python development guide]: https://learn.scientific-python.org/development
131
146
  [scientific-python/cookie]: https://github.com/scientific-python/cookie
132
147
  [scikit-hep]: https://scikit-hep.org
148
+ [sp-repo-review]: https://pypi.org/project/sp-repo-review
149
+ [validate-pyproject]: https://validate-pyproject.readthedocs.io
150
+
151
+ [intro-pre-commit]: https://repo-review.readthedocs.io/en/latest/intro.html#pre-commit
152
+ [intro-github-actions]: https://repo-review.readthedocs.io/en/latest/intro.html#github-actions
153
+ [cli]: https://repo-review.readthedocs.io/en/latest/cli.html
154
+ [programmatic-usage]: https://repo-review.readthedocs.io/en/latest/programmatic.html
155
+ [webapp]: https://repo-review.readthedocs.io/en/latest/webapp.html
156
+ [intro-configuring]: https://repo-review.readthedocs.io/en/latest/intro.html#configuring
157
+ [writing-a-plugin]: https://repo-review.readthedocs.io/en/latest/plugins.html
158
+ [fixtures]: https://repo-review.readthedocs.io/en/latest/fixtures.html
159
+ [checks]: https://repo-review.readthedocs.io/en/latest/checks.html
160
+ [families]: https://repo-review.readthedocs.io/en/latest/families.html
161
+ [changelog]: https://repo-review.readthedocs.io/en/latest/changelog.html
162
+ [api]: https://repo-review.readthedocs.io/en/latest/api/repo_review.html
163
+
133
164
 
134
165
  <!-- prettier-ignore-end -->
@@ -0,0 +1,7 @@
1
+ repo\_review.resources package
2
+ ==============================
3
+
4
+ .. automodule:: repo_review.resources
5
+ :members:
6
+ :undoc-members:
7
+ :show-inheritance:
@@ -6,6 +6,14 @@ repo\_review package
6
6
  :undoc-members:
7
7
  :show-inheritance:
8
8
 
9
+ Subpackages
10
+ -----------
11
+
12
+ .. toctree::
13
+ :maxdepth: 4
14
+
15
+ repo_review.resources
16
+
9
17
  Submodules
10
18
  ----------
11
19
 
@@ -56,3 +64,11 @@ repo\_review.processor module
56
64
  :members:
57
65
  :undoc-members:
58
66
  :show-inheritance:
67
+
68
+ repo\_review.schema module
69
+ --------------------------
70
+
71
+ .. automodule:: repo_review.schema
72
+ :members:
73
+ :undoc-members:
74
+ :show-inheritance:
@@ -61,6 +61,8 @@ sphinx_github_changelog_token = os.environ.get("GITHUB_API_TOKEN")
61
61
  commit = os.environ.get("READTHEDOCS_GIT_COMMIT_HASH", "main")
62
62
  code_url = "https://github.com/scientific-python/repo-review/blob"
63
63
 
64
+ linkcheck_ignore = [r"https://pypi.org/project/repo-review/v0\.[23456]"]
65
+
64
66
 
65
67
  def linkcode_resolve(domain: str, info: dict[str, str]) -> str | None:
66
68
  if domain != "py":
@@ -63,7 +63,12 @@
63
63
  root.render(
64
64
  <App
65
65
  header={true}
66
- deps={["sp-repo-review==2023.08.03", "repo-review==0.9.2"]}
66
+ deps={[
67
+ "sp-repo-review==2023.08.23",
68
+ "repo-review==0.9.2",
69
+ "validate-pyproject==0.14",
70
+ "scikit-build-core==0.5.0",
71
+ ]}
67
72
  />,
68
73
  );
69
74
  </script>
@@ -8,7 +8,66 @@ standardized backend, such as `hatchling`, `flit-core`, `pdm-backend`, or
8
8
  `setuptools>=61`. If you are using some other build backend, please adjust
9
9
  accordingly.
10
10
 
11
- ## Avoiding CLI requirements on WebAssembly usage
11
+ ## Entry points
12
+
13
+ You need to specify entry points as listed in the fixtures/checks/families
14
+ pages in order for repo-review to use your plugin. In summary, they look like this:
15
+
16
+ ```toml
17
+ [project.entry-points]
18
+ "repo_review.fixtures".fixture_name = "my_plugin_package.my_fixture_module:fixture_name"
19
+ "repo_review.checks".anything = "my_plugin_package.my_checks_module:repo_review_checks"
20
+ "repo_review.families".anything = "my_plugin_package.my_family_module:repo_review_families"
21
+ ```
22
+
23
+ Only the fixture entry-point name matters (it's the name of the fixture);
24
+ checks and families produce multiple items, so they can be under any name.
25
+
26
+ ## Testing
27
+
28
+ If you'd like to test your plugin, add `repo-review; python_version>="3.10"` to
29
+ your test dependencies (if your package is only a plugin for repo-review, you
30
+ don't need the Python limit there). Then add some valid and/or invalid examples
31
+ to your test suite (you can write them out during testing, as well, which is
32
+ what is shown below). Then a test looks like this:
33
+
34
+ ```python
35
+ from pathlib import Path
36
+
37
+ import pytest
38
+
39
+ repo_review_processor = pytest.importorskip("repo_review.processor")
40
+
41
+
42
+ def test_has_tool_ruff(tmp_path: Path) -> None:
43
+ # In this example, tool.ruff is required to be present by this plugin
44
+ d = tmp_path / "some_package"
45
+ d.mkdir()
46
+ d.joinpath("pyproject.toml").write_text("[tool.ruff]")
47
+ processed = repo_review_processor.process(d)
48
+ assert all(r.result for r in processed.results), f"{processed.results}"
49
+ ```
50
+
51
+ You have `processed.results` and `processed.families` from the return of
52
+ {func}`~repo_review.processor.process` to work with. You can also run
53
+ {func}`~repo_review.processor.collect_all` to get `.fixtures`, `.checks`, and
54
+ `.families`.
55
+
56
+ ## An existing package
57
+
58
+ Since writing a plugin does not require depending on repo-review, you can also
59
+ integrate your plugins into existing packages. If that's the case, you only
60
+ need to add your entry-points (see the links above), and tests.
61
+
62
+ ## A plugin-only package
63
+
64
+ If you are writing a package that is only a plugin for repo-review, there are
65
+ several things you can do if you'd like a user to be able to run the package
66
+ directly. `sp-repo-review` does these things to make it easy to run as a
67
+ complete package. This design is mostly useful if you are providing a complete
68
+ set of checks for an ecosystem.
69
+
70
+ ### Avoiding CLI requirements on WebAssembly usage
12
71
 
13
72
  Repo-review uses `repo-review[cli]` to keep CLI requirements from being
14
73
  included in the base package, and plugins can follow this if they want to be
@@ -21,7 +80,7 @@ cli = [
21
80
  ]
22
81
  ```
23
82
 
24
- ## Custom entry-point (optional)
83
+ ### Custom entry-point (optional)
25
84
 
26
85
  If you want to provide your own CLI name, you can
27
86
  add this to your `pyproject.toml`:
@@ -34,7 +93,7 @@ my_plugin_cli_name = "repo_review.__main__:main"
34
93
  However, there is no benefit over just running `repo-review`, so this is not
35
94
  really recommended.
36
95
 
37
- ## Pipx run support (recommended)
96
+ ### Pipx run support (recommended)
38
97
 
39
98
  If you chose not to add a custom command-line entry point (above), you should
40
99
  still support `pipx run <your-plugin>`, and you can do that by adding the
@@ -45,7 +104,7 @@ following to your `pyproject.toml`:
45
104
  my_plugin_package_name = "repo_review.__main__:main"
46
105
  ```
47
106
 
48
- ## Pre-commit support
107
+ ### Pre-commit support
49
108
 
50
109
  You can add a `.pre-commit-hooks.yaml` file with contents similar to this to
51
110
  natively support pre-commit:
@@ -63,7 +122,7 @@ minimum_pre_commit_version: 2.9.0
63
122
  You can also narrow down the `files` / `types_or` if your plugin only supports
64
123
  a subset of files (which most should).
65
124
 
66
- ## GitHub Actions support
125
+ ### GitHub Actions support
67
126
 
68
127
  You can add an `action.yml` file similar to this to natively support GitHub
69
128
  Actions & dependabot:
@@ -44,7 +44,8 @@ cli = [
44
44
  ]
45
45
  test = [
46
46
  "pytest >=7",
47
- "sp-repo-review",
47
+ "sp-repo-review >=2023.08.23",
48
+ "validate-pyproject >=0.14",
48
49
  ]
49
50
  dev = [
50
51
  "repo-review[test,cli]",
@@ -75,6 +76,9 @@ repo-review = "repo_review.__main__:main"
75
76
  pyproject = "repo_review.fixtures:pyproject"
76
77
  list_all = "repo_review.fixtures:list_all"
77
78
 
79
+ [project.entry-points."validate_pyproject.tool_schema"]
80
+ repo-review = "repo_review.schema:get_schema"
81
+
78
82
 
79
83
  [tool.hatch]
80
84
  version.source = "vcs"
@@ -180,3 +184,7 @@ flake8-unused-arguments.ignore-variadic-names = true
180
184
  [tool.ruff.per-file-ignores]
181
185
  "src/repo_review/_compat/**.py" = ["TID251"]
182
186
  "src/**/__main__.py" = ["T20"]
187
+
188
+
189
+ [tool.repo-review]
190
+ ignore = ["PC110"]
@@ -1,4 +1,4 @@
1
1
  # file generated by setuptools_scm
2
2
  # don't change, don't track in version control
3
- __version__ = version = '0.9.2'
4
- __version_tuple__ = version_tuple = (0, 9, 2)
3
+ __version__ = version = '0.9.3'
4
+ __version_tuple__ = version_tuple = (0, 9, 3)
@@ -0,0 +1,8 @@
1
+ from __future__ import annotations
2
+
3
+ import importlib.resources
4
+
5
+ __all__ = ["resources"]
6
+
7
+
8
+ resources = importlib.resources.files(__name__)
@@ -0,0 +1,24 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "$id": "https://github.com/scientific-python/repo-review/blob/main/src/repo_review/resources/repo-review.schema.json",
4
+ "description": "Repo-review's settings.",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "properties": {
8
+ "select": {
9
+ "$ref": "#/$defs/checks"
10
+ },
11
+ "ignore": {
12
+ "$ref": "#/$defs/checks"
13
+ }
14
+ },
15
+ "$defs": {
16
+ "checks": {
17
+ "type": "array",
18
+ "items": {
19
+ "type": "string",
20
+ "pattern": "^[A-Z]+[0-9]*$"
21
+ }
22
+ }
23
+ }
24
+ }
@@ -0,0 +1,24 @@
1
+ """
2
+ This accesses the schema for repo-review's tool section.
3
+ """
4
+
5
+ from __future__ import annotations
6
+
7
+ import json
8
+ from typing import Any
9
+
10
+ from .resources import resources
11
+
12
+ __all__ = ["get_schema"]
13
+
14
+
15
+ def __dir__() -> list[str]:
16
+ return __all__
17
+
18
+
19
+ def get_schema(tool_name: str = "repo-review") -> dict[str, Any]:
20
+ "Get the stored complete schema for repo-review settings."
21
+ assert tool_name == "repo-review", "Only repo-review is supported."
22
+
23
+ with resources.joinpath("repo-review.schema.json").open(encoding="utf-8") as f:
24
+ return json.load(f) # type: ignore[no-any-return]
@@ -0,0 +1,45 @@
1
+ from __future__ import annotations
2
+
3
+ import textwrap
4
+ from pathlib import Path
5
+
6
+ import pytest
7
+
8
+ import repo_review as m
9
+ from repo_review.processor import process
10
+
11
+ DIR = Path(__file__).parent.resolve()
12
+
13
+
14
+ def test_version():
15
+ assert m.__version__
16
+
17
+
18
+ def test_local():
19
+ pytest.importorskip("sp_repo_review")
20
+ pytest.importorskip("validate_pyproject")
21
+ package = DIR.parent
22
+ results = process(package)
23
+ assert "hatchling.build" in results.families["general"]["description"]
24
+ assert "BSD License" in results.families["general"]["description"]
25
+ assert "[tool.repo-review]" in results.families["validate-pyproject"]["description"]
26
+ for result in results.results:
27
+ assert result.result
28
+
29
+
30
+ def test_broken_validate_pyproject(tmp_path: Path) -> None:
31
+ pytest.importorskip("validate_pyproject")
32
+ tmp_path.joinpath("pyproject.toml").write_text(
33
+ textwrap.dedent(
34
+ """\
35
+ [tool.repo-review]
36
+ ignore = ["a2"]
37
+ """
38
+ )
39
+ )
40
+
41
+ results = process(tmp_path)
42
+
43
+ (result,) = (r for r in results.results if r.name == "VPP001")
44
+ assert "must match pattern" in result.err_msg
45
+ assert not result.result
@@ -1,29 +0,0 @@
1
- from __future__ import annotations
2
-
3
- from pathlib import Path
4
-
5
- import pytest
6
-
7
- import repo_review as m
8
- from repo_review.ghpath import GHPath
9
- from repo_review.processor import process
10
-
11
- DIR = Path(__file__).parent.resolve()
12
-
13
-
14
- def test_version():
15
- assert m.__version__
16
-
17
-
18
- @pytest.mark.skip(reason="Can be rate limited")
19
- def test_pyodide():
20
- pytest.importorskip("sp_repo_review")
21
- package = GHPath(repo="scientific-python/repo-review", branch="main")
22
- results = process(package)
23
- assert results
24
-
25
-
26
- def test_local():
27
- package = DIR.parent
28
- results = process(package)
29
- assert results
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes