repo-review 0.10.6__tar.gz → 0.11.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.
Files changed (67) hide show
  1. {repo_review-0.10.6 → repo_review-0.11.0}/.devcontainer/devcontainer.json +1 -1
  2. {repo_review-0.10.6 → repo_review-0.11.0}/.github/CONTRIBUTING.md +31 -21
  3. repo_review-0.11.0/.github/ISSUE_TEMPLATE/new-issue.md +11 -0
  4. {repo_review-0.10.6 → repo_review-0.11.0}/.github/workflows/ci.yml +19 -17
  5. {repo_review-0.10.6 → repo_review-0.11.0}/.pre-commit-config.yaml +14 -2
  6. {repo_review-0.10.6 → repo_review-0.11.0}/PKG-INFO +1 -1
  7. {repo_review-0.10.6 → repo_review-0.11.0}/docs/index.html +4 -4
  8. {repo_review-0.10.6 → repo_review-0.11.0}/docs/webapp.js +4 -7
  9. {repo_review-0.10.6 → repo_review-0.11.0}/pyproject.toml +47 -3
  10. {repo_review-0.10.6 → repo_review-0.11.0}/src/repo_review/_version.py +2 -2
  11. {repo_review-0.10.6 → repo_review-0.11.0}/src/repo_review/ghpath.py +7 -1
  12. {repo_review-0.10.6 → repo_review-0.11.0}/tests/test_multi.py +7 -3
  13. repo_review-0.10.6/noxfile.py +0 -138
  14. {repo_review-0.10.6 → repo_review-0.11.0}/.git_archival.txt +0 -0
  15. {repo_review-0.10.6 → repo_review-0.11.0}/.gitattributes +0 -0
  16. {repo_review-0.10.6 → repo_review-0.11.0}/.github/dependabot.yml +0 -0
  17. {repo_review-0.10.6 → repo_review-0.11.0}/.github/matchers/pylint.json +0 -0
  18. {repo_review-0.10.6 → repo_review-0.11.0}/.github/workflows/cd.yml +0 -0
  19. {repo_review-0.10.6 → repo_review-0.11.0}/.gitignore +0 -0
  20. {repo_review-0.10.6 → repo_review-0.11.0}/.pre-commit-hooks.yaml +0 -0
  21. {repo_review-0.10.6 → repo_review-0.11.0}/.readthedocs.yaml +0 -0
  22. {repo_review-0.10.6 → repo_review-0.11.0}/LICENSE +0 -0
  23. {repo_review-0.10.6 → repo_review-0.11.0}/README.md +0 -0
  24. {repo_review-0.10.6 → repo_review-0.11.0}/action.yml +0 -0
  25. {repo_review-0.10.6 → repo_review-0.11.0}/docs/.nojekyll +0 -0
  26. {repo_review-0.10.6 → repo_review-0.11.0}/docs/api/repo_review.resources.rst +0 -0
  27. {repo_review-0.10.6 → repo_review-0.11.0}/docs/api/repo_review.rst +0 -0
  28. {repo_review-0.10.6 → repo_review-0.11.0}/docs/changelog.md +0 -0
  29. {repo_review-0.10.6 → repo_review-0.11.0}/docs/checks.md +0 -0
  30. {repo_review-0.10.6 → repo_review-0.11.0}/docs/cli.md +0 -0
  31. {repo_review-0.10.6 → repo_review-0.11.0}/docs/conf.py +0 -0
  32. {repo_review-0.10.6 → repo_review-0.11.0}/docs/families.md +0 -0
  33. {repo_review-0.10.6 → repo_review-0.11.0}/docs/fixtures.md +0 -0
  34. {repo_review-0.10.6 → repo_review-0.11.0}/docs/index.md +0 -0
  35. {repo_review-0.10.6 → repo_review-0.11.0}/docs/intro.md +0 -0
  36. {repo_review-0.10.6 → repo_review-0.11.0}/docs/plugins.md +0 -0
  37. {repo_review-0.10.6 → repo_review-0.11.0}/docs/programmatic.md +0 -0
  38. {repo_review-0.10.6 → repo_review-0.11.0}/docs/webapp.md +0 -0
  39. {repo_review-0.10.6 → repo_review-0.11.0}/src/repo_review/__init__.py +0 -0
  40. {repo_review-0.10.6 → repo_review-0.11.0}/src/repo_review/__main__.py +0 -0
  41. {repo_review-0.10.6 → repo_review-0.11.0}/src/repo_review/_compat/__init__.py +0 -0
  42. {repo_review-0.10.6 → repo_review-0.11.0}/src/repo_review/_compat/importlib/__init__.py +0 -0
  43. {repo_review-0.10.6 → repo_review-0.11.0}/src/repo_review/_compat/importlib/resources/__init__.py +0 -0
  44. {repo_review-0.10.6 → repo_review-0.11.0}/src/repo_review/_compat/importlib/resources/abc.py +0 -0
  45. {repo_review-0.10.6 → repo_review-0.11.0}/src/repo_review/_compat/tomllib.py +0 -0
  46. {repo_review-0.10.6 → repo_review-0.11.0}/src/repo_review/_compat/typing.py +0 -0
  47. {repo_review-0.10.6 → repo_review-0.11.0}/src/repo_review/_version.pyi +0 -0
  48. {repo_review-0.10.6 → repo_review-0.11.0}/src/repo_review/checks.py +0 -0
  49. {repo_review-0.10.6 → repo_review-0.11.0}/src/repo_review/families.py +0 -0
  50. {repo_review-0.10.6 → repo_review-0.11.0}/src/repo_review/fixtures.py +0 -0
  51. {repo_review-0.10.6 → repo_review-0.11.0}/src/repo_review/html.py +0 -0
  52. {repo_review-0.10.6 → repo_review-0.11.0}/src/repo_review/processor.py +0 -0
  53. {repo_review-0.10.6 → repo_review-0.11.0}/src/repo_review/py.typed +0 -0
  54. {repo_review-0.10.6 → repo_review-0.11.0}/src/repo_review/resources/__init__.py +0 -0
  55. {repo_review-0.10.6 → repo_review-0.11.0}/src/repo_review/resources/repo-review.schema.json +0 -0
  56. {repo_review-0.10.6 → repo_review-0.11.0}/src/repo_review/schema.py +0 -0
  57. {repo_review-0.10.6 → repo_review-0.11.0}/src/repo_review/testing.py +0 -0
  58. {repo_review-0.10.6 → repo_review-0.11.0}/tests/conftest.py +0 -0
  59. {repo_review-0.10.6 → repo_review-0.11.0}/tests/test_checks.py +0 -0
  60. {repo_review-0.10.6 → repo_review-0.11.0}/tests/test_cmd.py +0 -0
  61. {repo_review-0.10.6 → repo_review-0.11.0}/tests/test_depends.py +0 -0
  62. {repo_review-0.10.6 → repo_review-0.11.0}/tests/test_families.py +0 -0
  63. {repo_review-0.10.6 → repo_review-0.11.0}/tests/test_fixtures.py +0 -0
  64. {repo_review-0.10.6 → repo_review-0.11.0}/tests/test_package.py +0 -0
  65. {repo_review-0.10.6 → repo_review-0.11.0}/tests/test_self.py +0 -0
  66. {repo_review-0.10.6 → repo_review-0.11.0}/tests/test_utilities/pyproject.py +0 -0
  67. {repo_review-0.10.6 → repo_review-0.11.0}/tests/test_utilities/pyproject.toml +0 -0
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "repo-review[dev]",
3
3
  "image": "mcr.microsoft.com/devcontainers/python:0-3.11",
4
- "postCreateCommand": "pipx install nox && pip install -e.[cli,test] pylint",
4
+ "postCreateCommand": "pipx install hatch && pip install -e.[cli,test] pylint",
5
5
  "customizations": {
6
6
  "vscode": {
7
7
  "extensions": [
@@ -5,28 +5,32 @@ detailed description of best practices for developing Scikit-HEP packages.
5
5
 
6
6
  ## Quick development
7
7
 
8
- The fastest way to start with development is to use nox. If you don't have nox,
9
- you can use `pipx run nox` to run it without installing, or `pipx install nox`.
10
- If you don't have pipx (pip for applications), then you can install with with
11
- `pip install pipx` (the only case were installing an application with regular
12
- pip is reasonable). If you use macOS, then pipx and nox are both in brew, use
13
- `brew install pipx nox`.
8
+ The fastest way to start with development is to use hatch. If you don't have
9
+ hatch, you can use `pipx run hatch` to run it without installing, or `pipx
10
+ install hatch`. If you don't have pipx (pip for applications), then you can
11
+ install with with `pip install pipx` (the only case were installing an
12
+ application with regular pip is reasonable). If you use macOS, then pipx and
13
+ hatch are both in brew, use `brew install pipx hatch`. Hatch 1.10+ is required.
14
14
 
15
- To use, run `nox`. This will lint and test using every installed version of
16
- Python on your system, skipping ones that are not installed. You can also run
17
- specific jobs:
15
+ Here are some common tasks you might want to run:
18
16
 
19
17
  ```console
20
- $ nox -s lint # Lint only
21
- $ nox -s tests # Tests
22
- $ nox -s docs -- --serve # Build and serve the docs
23
- $ nox -s build # Make an SDist and wheel
18
+ $ hatch run lint:lint # all linters (pre-commit)
19
+ $ hatch run pylint:lint # pylint
20
+ $ hatch fmt # just format & basic lint
21
+ $ hatch tests # run the tests
22
+ $ hatch build # build SDist and wheel
23
+ $ hatch run docs:serve # build and serve the docs
24
+ $ hatch run docs:html # just build the docs
25
+ $ hatch run docs:man # build manpage
26
+ $ hatch run docs:linkcheck # check for broken links
27
+ $ hatch run api-docs:build # rebuild the API docs
28
+ $ hatch run webapp:serve # serve the webapp
29
+ $ hatch run example:repo-review <args> # Run an example
24
30
  ```
25
31
 
26
- Nox handles everything for you, including setting up an temporary virtual
27
- environment for each run.
28
-
29
- You can also use `nox -s run -- .` to run an example set of checks on a repo.
32
+ Hatch handles everything for you, including setting up an temporary virtual
33
+ environment.
30
34
 
31
35
  ## Setting up a development environment manually
32
36
 
@@ -71,19 +75,25 @@ pytest
71
75
  You can build the docs using:
72
76
 
73
77
  ```bash
74
- nox -s docs
78
+ hatch run docs:docs
75
79
  ```
76
80
 
77
81
  You can see a preview with:
78
82
 
79
83
  ```bash
80
- nox -s docs -- --serve
84
+ hatch run docs:serve
85
+ ```
86
+
87
+ You can rebuild the API docs with:
88
+
89
+ ```bash
90
+ $ hatch run api-docs:build
81
91
  ```
82
92
 
83
93
  ## Pre-commit
84
94
 
85
95
  This project uses pre-commit for all style checking. While you can run it with
86
- nox, this is such an important tool that it deserves to be installed on its
96
+ hatch, this is such an important tool that it deserves to be installed on its
87
97
  own. Install pre-commit and run:
88
98
 
89
99
  ```bash
@@ -94,5 +104,5 @@ to check all files.
94
104
 
95
105
  ## Running DevContainer
96
106
 
97
- You can use DevContainer, such as in GitHub Codespaces or locally. Nox and a
107
+ You can use DevContainer, such as in GitHub Codespaces or locally. Hatch and a
98
108
  local install will be available.
@@ -0,0 +1,11 @@
1
+ ---
2
+ name: New Issue
3
+ about: Prepare a new bug report or feature request
4
+ title: ""
5
+ labels: ""
6
+ assignees: ""
7
+ ---
8
+
9
+ <!--
10
+ Thanks for making a bug report or feature request! Please note, repo-review is a framework for running checks. If you have an issue with a particular check, please open the issue with the plugin that provides the check. The repo-review demo uses the sp-repo-review plugin, which lives at http://github.com/scientific-python/cookie, for example.
11
+ -->
@@ -32,16 +32,14 @@ jobs:
32
32
  - name: Run PyLint
33
33
  run: |
34
34
  echo "::add-matcher::$GITHUB_WORKSPACE/.github/matchers/pylint.json"
35
- pipx run --python=python nox -s pylint
35
+ pipx run --python=python hatch run pylint:lint
36
36
 
37
37
  checks:
38
- name: Check Python ${{ matrix.python-version }} on ${{ matrix.runs-on }}
38
+ name: Check Python on ${{ matrix.runs-on }}
39
39
  runs-on: ${{ matrix.runs-on }}
40
- needs: [pre-commit]
41
40
  strategy:
42
41
  fail-fast: false
43
42
  matrix:
44
- python-version: ["3.10", "3.11", "3.12"]
45
43
  runs-on: [ubuntu-latest, macos-latest, windows-latest]
46
44
 
47
45
  steps:
@@ -51,18 +49,19 @@ jobs:
51
49
 
52
50
  - uses: actions/setup-python@v5
53
51
  with:
54
- python-version: ${{ matrix.python-version }}
52
+ python-version: |
53
+ 3.10
54
+ 3.11
55
+ 3.12
55
56
 
56
57
  - name: Setup uv
57
58
  uses: yezz123/setup-uv@v4
58
- with:
59
- uv-venv: ".venv"
60
59
 
61
- - name: Install package
62
- run: uv pip install .[test,cli]
60
+ - name: Install hatch
61
+ run: uv pip install --system hatch
63
62
 
64
- - name: Test package
65
- run: python -m pytest -ra
63
+ - name: Test package (all Pythons)
64
+ run: hatch test -a
66
65
  env:
67
66
  PYTHONUTF8: "1"
68
67
 
@@ -88,19 +87,22 @@ jobs:
88
87
  - name: Setup uv
89
88
  uses: yezz123/setup-uv@v4
90
89
 
91
- - uses: wntrblm/nox@2024.04.15
90
+ - uses: actions/setup-python@v5
92
91
  with:
93
- python-versions: "3.11"
92
+ python-version: "3.12"
93
+
94
+ - name: Install hatch
95
+ run: uv pip install --system hatch
94
96
 
95
97
  - name: Linkcheck
96
- run: nox -s docs -- -b linkcheck
98
+ run: hatch run docs:linkcheck
97
99
 
98
100
  - name: Build docs with warnings as errors
99
- run: nox -s docs -- -W
101
+ run: hatch run docs:html -W
100
102
 
101
103
  - name: Verify no changes required to API docs
102
104
  run: |
103
- nox -s build_api_docs
105
+ hatch run api-docs:build
104
106
  git diff --exit-code
105
107
 
106
108
  action:
@@ -114,4 +116,4 @@ jobs:
114
116
  - name: Run repo-review action
115
117
  uses: ./
116
118
  with:
117
- plugins: sp-repo-review==2024.03.10
119
+ plugins: sp-repo-review==2024.04.23
@@ -10,7 +10,7 @@ repos:
10
10
  additional_dependencies: [black==23.*]
11
11
 
12
12
  - repo: https://github.com/astral-sh/ruff-pre-commit
13
- rev: "v0.4.1"
13
+ rev: "v0.4.2"
14
14
  hooks:
15
15
  - id: ruff
16
16
  args: ["--fix", "--show-fixes"]
@@ -44,7 +44,7 @@ repos:
44
44
  - id: rst-inline-touching-normal
45
45
 
46
46
  - repo: https://github.com/pre-commit/mirrors-mypy
47
- rev: v1.9.0
47
+ rev: v1.10.0
48
48
  hooks:
49
49
  - id: mypy
50
50
  files: (src|web|tests)
@@ -75,3 +75,15 @@ repos:
75
75
  language: pygrep
76
76
  entry: PyBind|Numpy|Cmake|CCache|Github|PyTest
77
77
  exclude: .pre-commit-config.yaml
78
+
79
+ - repo: https://github.com/henryiii/validate-pyproject-schema-store
80
+ rev: 2024.04.29
81
+ hooks:
82
+ - id: validate-pyproject
83
+
84
+ - repo: https://github.com/python-jsonschema/check-jsonschema
85
+ rev: 0.28.2
86
+ hooks:
87
+ - id: check-dependabot
88
+ - id: check-github-workflows
89
+ - id: check-readthedocs
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: repo_review
3
- Version: 0.10.6
3
+ Version: 0.11.0
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
@@ -6,7 +6,7 @@
6
6
  content="initial-scale=1, width=device-width"
7
7
  />
8
8
  <script
9
- src="https://cdn.jsdelivr.net/pyodide/v0.23.3/full/pyodide.js"
9
+ src="https://cdn.jsdelivr.net/pyodide/v0.25.1/full/pyodide.js"
10
10
  crossorigin
11
11
  ></script>
12
12
  <!-- Production -->
@@ -19,7 +19,7 @@
19
19
  crossorigin
20
20
  ></script>
21
21
  <script
22
- src="https://unpkg.com/@mui/material@v5.13.3/umd/material-ui.production.min.js"
22
+ src="https://unpkg.com/@mui/material@v5.15.16/umd/material-ui.production.min.js"
23
23
  crossorigin
24
24
  ></script>
25
25
  <!-- Development
@@ -32,7 +32,7 @@
32
32
  crossorigin
33
33
  ></script>
34
34
  <script
35
- src="https://unpkg.com/@mui/material@v5.13.3/umd/material-ui.development.js"
35
+ src="https://unpkg.com/@mui/material@v5.15.16/umd/material-ui.development.js"
36
36
  crossorigin
37
37
  ></script>
38
38
  -->
@@ -65,7 +65,7 @@
65
65
  header={true}
66
66
  deps={[
67
67
  "repo-review~=0.10.0",
68
- "sp-repo-review==2024.03.10",
68
+ "sp-repo-review==2024.04.23",
69
69
  "validate-pyproject-schema-store==2024.04.20",
70
70
  "validate-pyproject[all]~=0.16.0",
71
71
  ]}
@@ -33,7 +33,6 @@ function IfUrlLink({ name, url, color }) {
33
33
  return (
34
34
  <MaterialUI.Typography
35
35
  sx={{ display: "inline" }}
36
- component="span"
37
36
  variant="body2"
38
37
  color={color}
39
38
  component="a"
@@ -192,12 +191,13 @@ function MyThemeProvider(props) {
192
191
  class App extends React.Component {
193
192
  constructor(props) {
194
193
  super(props);
195
- const deps_str = props.deps.join(" ");
194
+ const inner_deps_str = props.deps.join("\n");
195
+ const deps_str = `<pre><code>${inner_deps_str}</code></pre>`;
196
196
  this.state = {
197
197
  results: [],
198
198
  repo: urlParams.get("repo") || "",
199
199
  branch: urlParams.get("branch") || "",
200
- msg: `${DEFAULT_MSG} Packages: ${deps_str}`,
200
+ msg: `<p>${DEFAULT_MSG}</p><h4>Packages:</h4> ${deps_str}`,
201
201
  progress: false,
202
202
  err_msg: "",
203
203
  url: "",
@@ -229,12 +229,9 @@ class App extends React.Component {
229
229
  var families_checks;
230
230
  try {
231
231
  families_checks = pyodide.runPython(`
232
- from pyodide.http import open_url
233
232
  from repo_review.processor import process, md_as_html
234
233
  from repo_review.ghpath import GHPath
235
234
 
236
- GHPath.open_url = staticmethod(open_url)
237
-
238
235
  package = GHPath(repo="${state.repo}", branch="${state.branch}")
239
236
  result = process(package)
240
237
 
@@ -366,7 +363,7 @@ class App extends React.Component {
366
363
  <MaterialUI.Paper elevation={3}>
367
364
  <MaterialUI.Box sx={{ p: 2 }}>
368
365
  <MaterialUI.Typography variant="body1" component="div">
369
- {this.state.msg}
366
+ <span dangerouslySetInnerHTML={{ __html: this.state.msg }} />
370
367
  </MaterialUI.Typography>
371
368
  {this.state.progress && <MaterialUI.LinearProgress />}
372
369
  {this.state.err_msg && (
@@ -84,6 +84,46 @@ repo-review = "repo_review.schema:get_schema"
84
84
  version.source = "vcs"
85
85
  build.hooks.vcs.version-file = "src/repo_review/_version.py"
86
86
 
87
+ [tool.hatch.envs.default]
88
+ installer = "uv"
89
+
90
+ [tool.hatch.envs.hatch-test]
91
+ features = ["test", "cli"]
92
+
93
+ [tool.hatch.envs.lint]
94
+ dependencies = ["pre-commit"]
95
+ skip-install = true
96
+ scripts.lint = "pre-commit run --all-files --show-diff-on-failure {args}"
97
+
98
+ [tool.hatch.envs.pylint]
99
+ features = ["cli"]
100
+ dependencies = ["pylint"]
101
+ scripts.lint = "pylint repo_review {args}"
102
+
103
+ [tool.hatch.envs.docs]
104
+ features = ["docs"]
105
+ dependencies = ["sphinx-autobuild"]
106
+ scripts.linkcheck = "sphinx-build -b=linkcheck docs docs/_build/linkcheck {args}"
107
+ scripts.html = "sphinx-build --keep-going -n -T -b=html docs docs/_build/html {args}"
108
+ scripts.serve = "sphinx-autobuild -n -T -b=html docs docs/_build/html {args}"
109
+ scripts.man = "sphinx-build --keep-going -n -T -b=man docs docs/_build/man {args}"
110
+
111
+ [tool.hatch.envs.api-docs]
112
+ skip-install = true
113
+ dependencies = ["sphinx"]
114
+ scripts.build = "sphinx-apidoc -o docs/api/ --module-first --no-toc --force src/repo_review"
115
+
116
+ [tool.hatch.envs.example]
117
+ features = ["cli"]
118
+ post-install-commands = ["$HATCH_UV pip install -e tests/test_utilities"]
119
+
120
+ [tool.hatch.envs.webapp]
121
+ skip-install = true
122
+ scripts.serve = "cd docs && echo 'Serving on http://localhost:8080' && python -m http.server 8080"
123
+
124
+ [[tool.hatch.envs.hatch-test.matrix]]
125
+ python = ["3.12", "3.11", "3.10"]
126
+
87
127
 
88
128
  [tool.pytest.ini_options]
89
129
  minversion = "7.0"
@@ -92,6 +132,8 @@ xfail_strict = true
92
132
  log_cli_level = "INFO"
93
133
  filterwarnings = [
94
134
  "error",
135
+ "ignore:OptionHighlighter:DeprecationWarning", # rich-click triggers its own warning
136
+ "ignore:`highlighter`:DeprecationWarning", # rich-click triggers its own warning
95
137
  ]
96
138
  testpaths = ["tests"]
97
139
  pythonpath = ["tests/test_utilities"]
@@ -113,8 +155,9 @@ disallow_untyped_defs = true
113
155
 
114
156
 
115
157
  [tool.pylint]
116
- master.py-version = "3.10"
117
- master.ignore-paths= ["src/repo_review/_version.py"]
158
+ py-version = "3.10"
159
+ ignore-paths = ["src/repo_review/_version.py"]
160
+ ignored-modules = ["pyodide"]
118
161
  reports.output-format = "colorized"
119
162
  similarities.ignore-imports = "yes"
120
163
  messages_control.disable = [
@@ -131,6 +174,7 @@ messages_control.disable = [
131
174
  "no-member", # better handled by mypy, etc.
132
175
  "used-before-assignment", # False positive on conditional import
133
176
  "unnecessary-ellipsis", # Not correct for typing
177
+ "import-outside-toplevel", # better handled elsewhere
134
178
  ]
135
179
 
136
180
 
@@ -160,7 +204,7 @@ extend-select = [
160
204
  "YTT", # flake8-2020
161
205
  ]
162
206
  ignore = [
163
- "ISC001", # May collide with formatter
207
+ "ISC001", # May collide with formatter
164
208
  "PT004", # Incorrect check, usefixtures is the correct way to do this
165
209
  "PLR09", # Too many X
166
210
  "PLR2004", # Magic value in comparison
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '0.10.6'
16
- __version_tuple__ = version_tuple = (0, 10, 6)
15
+ __version__ = version = '0.11.0'
16
+ __version_tuple__ = version_tuple = (0, 11, 0)
@@ -7,6 +7,7 @@ from __future__ import annotations
7
7
  import dataclasses
8
8
  import io
9
9
  import json
10
+ import sys
10
11
  import typing
11
12
  from collections.abc import Iterator
12
13
  from typing import Literal
@@ -47,7 +48,12 @@ class GHPath(Traversable):
47
48
 
48
49
  @staticmethod
49
50
  def open_url(url: str) -> io.StringIO:
50
- "This method can be overridden for pyodide with pyodide.open_url"
51
+ "This method can be overridden manually for WASM. Supports pyodide currently."
52
+ if sys.platform == "emscripten":
53
+ import pyodide.http
54
+
55
+ return pyodide.http.open_url(url)
56
+
51
57
  import urllib.request # pylint: disable=import-outside-toplevel
52
58
 
53
59
  with urllib.request.urlopen(url) as response:
@@ -41,7 +41,7 @@ def multiple_packages(tmp_path: Path) -> tuple[str, str]:
41
41
  @pytest.mark.usefixtures("local_entry_points")
42
42
  def test_multiple_packages_rich(multiple_packages: Sequence[str]) -> None:
43
43
  runner = CliRunner()
44
- result = runner.invoke(main, [*multiple_packages])
44
+ result = runner.invoke(main, [*multiple_packages], catch_exceptions=False)
45
45
  assert result.exit_code == 0
46
46
  assert "package_1" in result.output
47
47
  assert "package_2" in result.output
@@ -51,7 +51,9 @@ def test_multiple_packages_rich(multiple_packages: Sequence[str]) -> None:
51
51
  @pytest.mark.usefixtures("local_entry_points")
52
52
  def test_multiple_packages_json(multiple_packages: Sequence[str]) -> None:
53
53
  runner = CliRunner()
54
- result = runner.invoke(main, [*multiple_packages, "--format", "json"])
54
+ result = runner.invoke(
55
+ main, [*multiple_packages, "--format", "json"], catch_exceptions=False
56
+ )
55
57
  assert result.exit_code == 0
56
58
  output = json.loads(result.output)
57
59
  assert len(output) == 2
@@ -62,7 +64,9 @@ def test_multiple_packages_json(multiple_packages: Sequence[str]) -> None:
62
64
  @pytest.mark.usefixtures("local_entry_points")
63
65
  def test_multiple_packages_html(multiple_packages: Sequence[str]) -> None:
64
66
  runner = CliRunner()
65
- result = runner.invoke(main, [*multiple_packages, "--format", "html"])
67
+ result = runner.invoke(
68
+ main, [*multiple_packages, "--format", "html"], catch_exceptions=False
69
+ )
66
70
  assert result.exit_code == 0
67
71
  tree = ET.fromstring(f"<body>{result.output}</body>")
68
72
  assert len(tree) == 2
@@ -1,138 +0,0 @@
1
- from __future__ import annotations
2
-
3
- import argparse
4
- import shutil
5
- from pathlib import Path
6
-
7
- import nox
8
-
9
- DIR = Path(__file__).parent.resolve()
10
-
11
- nox.needs_version = ">=2024.3.2"
12
- nox.options.default_venv_backend = "uv|virtualenv"
13
- nox.options.sessions = ["lint", "pylint", "tests"]
14
-
15
-
16
- @nox.session(reuse_venv=True)
17
- def run(session: nox.Session) -> None:
18
- """
19
- Run the program with a few example checks.
20
- """
21
-
22
- session.install("-e", ".[cli]")
23
- session.install("-e", "tests/test_utilities")
24
- session.run("python", "-m", "repo_review", *session.posargs)
25
-
26
-
27
- @nox.session
28
- def lint(session: nox.Session) -> None:
29
- """
30
- Run the linter.
31
- """
32
- session.install("pre-commit")
33
- session.run("pre-commit", "run", "--all-files", *session.posargs)
34
-
35
-
36
- @nox.session
37
- def pylint(session: nox.Session) -> None:
38
- """
39
- Run PyLint.
40
- """
41
- # This needs to be installed into the package environment, and is slower
42
- # than a pre-commit check
43
- session.install("-e.[cli]", "pylint")
44
- session.run("pylint", "src", *session.posargs)
45
-
46
-
47
- @nox.session
48
- def tests(session: nox.Session) -> None:
49
- """
50
- Run the unit and regular tests.
51
- """
52
- session.install("-e.[test,cli]")
53
- session.run("pytest", *session.posargs)
54
-
55
-
56
- @nox.session(reuse_venv=True)
57
- def build(session: nox.Session) -> None:
58
- """
59
- Build an SDist and wheel.
60
- """
61
-
62
- build_p = DIR.joinpath("build")
63
- if build_p.exists():
64
- shutil.rmtree(build_p)
65
-
66
- session.install("build")
67
- session.run("python", "-m", "build")
68
-
69
-
70
- @nox.session(venv_backend="none")
71
- def serve(session: nox.Session) -> None:
72
- """
73
- Serve the webapp.
74
- """
75
-
76
- session.cd("docs")
77
- session.log("Serving on http://localhost:8080")
78
- session.run("python3", "-m", "http.server", "8080")
79
-
80
-
81
- @nox.session(reuse_venv=True)
82
- def docs(session: nox.Session) -> None:
83
- """
84
- Build the docs. Pass "--serve" to serve.
85
- """
86
-
87
- parser = argparse.ArgumentParser()
88
- parser.add_argument("--serve", action="store_true", help="Serve after building")
89
- parser.add_argument(
90
- "-b", dest="builder", default="html", help="Build target (default: html)"
91
- )
92
- args, posargs = parser.parse_known_args(session.posargs)
93
-
94
- if args.builder != "html" and args.serve:
95
- session.error("Must not specify non-HTML builder with --serve")
96
-
97
- extra_installs = ["sphinx-autobuild"] if args.serve else []
98
-
99
- session.install("-e.[docs]", *extra_installs)
100
- session.chdir("docs")
101
-
102
- if args.builder == "linkcheck":
103
- session.run(
104
- "sphinx-build", "-b", "linkcheck", ".", "_build/linkcheck", *posargs
105
- )
106
- return
107
-
108
- shared_args = (
109
- "-n", # nitpicky mode
110
- "-T", # full tracebacks
111
- f"-b={args.builder}",
112
- ".",
113
- f"_build/{args.builder}",
114
- *posargs,
115
- )
116
-
117
- if args.serve:
118
- session.run("sphinx-autobuild", *shared_args)
119
- else:
120
- session.run("sphinx-build", "--keep-going", *shared_args)
121
-
122
-
123
- @nox.session
124
- def build_api_docs(session: nox.Session) -> None:
125
- """
126
- Build (regenerate) API docs.
127
- """
128
- session.install("sphinx")
129
- session.chdir("docs")
130
- session.run(
131
- "sphinx-apidoc",
132
- "-o",
133
- "api/",
134
- "--module-first",
135
- "--no-toc",
136
- "--force",
137
- "../src/repo_review",
138
- )
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes