Skip to content

Commit a777e54

Browse files
committed
feat: cross-link checks with guide
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
1 parent 1a160ee commit a777e54

File tree

18 files changed

+258
-145
lines changed

18 files changed

+258
-145
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ repos:
3232
- id: check-yaml
3333
- id: debug-statements
3434
- id: end-of-file-fixer
35+
exclude: ^docs/_includes/rr.html$
3536
- id: mixed-line-ending
3637
- id: name-tests-test
3738
args: ["--pytest-test-first"]
@@ -66,7 +67,7 @@ repos:
6667
- id: prettier
6768
types_or: [yaml, markdown, html, css, scss, javascript, json]
6869
args: [--prose-wrap=always]
69-
exclude: ^.readthedocs.yml
70+
exclude: ^docs/_includes/rr.html$
7071

7172
- repo: https://github.com/codespell-project/codespell
7273
rev: "v2.2.4"

docs/_includes/rr.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<span class="rr-btn" id="{{ include.id }}">{{ include.id }}</span>

docs/_sass/custom/custom.scss

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,3 +131,21 @@ blockquote > h2 {
131131
font-weight: 300;
132132
letter-spacing: 2px;
133133
}
134+
135+
.rr-btn {
136+
border-radius: 4px;
137+
background-color: #808080;
138+
color: white;
139+
padding: 1px 4px;
140+
font-size: 9pt;
141+
font-family: sans-serif;
142+
display: inline-block;
143+
text-align: center;
144+
line-height: 1;
145+
}
146+
.rr-btn::before {
147+
content: "sp-repo-review";
148+
font-size: 5pt;
149+
display: block;
150+
text-align: center;
151+
}

docs/pages/guides/gha_basic.md

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ custom_title: GitHub Actions introduction
99

1010
{% include toc.html %}
1111

12-
The recommended CI for scientific Python projects is GitHub Actions (GHA),
13-
although its predecessor Azure is also in heavy usage, and other popular
14-
services (Travis, Appveyor, and Circle CI) may be found in a few packages. GHA
15-
is preferred due to the flexible, extensible design and the tight integration
16-
with the GitHub permissions model (and UI). Here is a guide in setting up a new
17-
package with GHA.
12+
{% include rr.html id="GH100" %} The recommended CI for scientific Python
13+
projects is GitHub Actions (GHA), although its predecessor Azure is also in
14+
heavy usage, and other popular services (Travis, Appveyor, and Circle CI) may be
15+
found in a few packages. GHA is preferred due to the flexible, extensible design
16+
and the tight integration with the GitHub permissions model (and UI). Here is a
17+
guide in setting up a new package with GHA.
1818

1919
GHA is made up of workflows which consist of actions. Here are some of the
2020
workflows you will probably want in your package. These should be in a file
@@ -36,11 +36,11 @@ on:
3636
jobs:
3737
```
3838
39-
This gives the workflow a nice name, and defines the conditions under which it
40-
runs. This will run on all pull requests, or pushes to main. If you use a
41-
develop branch, you probably will want to include that. You can also specify
42-
specific branches for pull requests instead of running on all PRs (will run on
43-
PRs targeting those branches only).
39+
This gives the workflow a nice name {% include rr.html id="GH101" %}, and
40+
defines the conditions under which it runs. This will run on all pull requests,
41+
or pushes to main. If you use a develop branch, you probably will want to
42+
include that. You can also specify specific branches for pull requests instead
43+
of running on all PRs (will run on PRs targeting those branches only).
4444
4545
## Pre-commit
4646
@@ -124,9 +124,10 @@ you were building a final package.
124124

125125
## Updating
126126

127-
If you use non-default actions in your repository (you will see some in the
128-
following pages), then it's a good idea to keep them up to date. GitHub provided
129-
a way to do this with dependabot. Just add the following file as
127+
{% include rr.html id="GH200" %} {% include rr.html id="GH210" %} If you use
128+
non-default actions in your repository (you will see some in the following
129+
pages), then it's a good idea to keep them up to date. GitHub provided a way to
130+
do this with dependabot. Just add the following file as
130131
`.github/dependabot.yml`:
131132

132133
```yaml
@@ -143,7 +144,8 @@ This will check to see if there are updates to the action weekly, and will make
143144
a PR if there are updates, including the changelog and commit summary in the PR.
144145
If you select a name like `v1`, this should only look for updates of the same
145146
form (since April 2022) - there is no need to restrict updates for "moving tag"
146-
updates anymore. You can also use SHA's and dependabot will respect that too.
147+
updates anymore {% include rr.html id="PY006" %}. You can also use SHA's and
148+
dependabot will respect that too.
147149

148150
You can use this for other ecosystems too, including Python.
149151

@@ -253,7 +255,8 @@ permissions:
253255
id-token: write
254256
```
255257

256-
You probably only want one deployment at a time, so you can use:
258+
{% include rr.html id="GH103" %} You probably only want one deployment at a
259+
time, so you can use:
257260

258261
```yaml
259262
concurrency:
@@ -325,8 +328,9 @@ These are some things you might need.
325328

326329
### Cancel existing runs
327330

328-
If you add the following, you can ensure only one run per PR/branch happens at a
329-
time, cancelling the old run when a new one starts:
331+
{% include rr.html id="GH102" %} If you add the following, you can ensure only
332+
one run per PR/branch happens at a time, cancelling the old run when a new one
333+
starts:
330334

331335
{% raw %}
332336

docs/pages/guides/nox.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ is _much_ faster than explaining how to get setup or manually messing with
3232
virtual environments. It is also highly reproducible, creating and destroying
3333
the temporary environment each time.
3434

35-
You _should_ use nox to make it easy and simple for new contributors to run
36-
things. You _should_ use nox to make specialized developer tasks easy. You
37-
_should_ use nox to avoid making single-use virtual environments for docs and
38-
other rarely run tasks.
35+
{% include rr.html id="PY007" %} You _should_ use nox to make it easy and simple
36+
for new contributors to run things. You _should_ use nox to make specialized
37+
developer tasks easy. You _should_ use nox to avoid making single-use virtual
38+
environments for docs and other rarely run tasks.
3939

4040
Nox doesn't handle binary builds very well, so for compiled projects, it might
4141
be best left to just specialized tasks.

docs/pages/guides/packaging_classic.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ generally not found in scientific Python packages, but not discouraged; all
8787
tools build the same wheels (and they often build setuptools compliant SDists,
8888
as well).
8989

90+
{% include rr.html id="PP003" %} Note that `"wheel"` is never required; it is
91+
injected automatically by setuptools only when needed.
92+
9093
### Special additions: NumPy
9194

9295
You may want to build against NumPy (mostly for Cython packages, pybind11 does

docs/pages/guides/packaging_simple.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ is coming.
3838
3939
## pyproject.toml: build-system
4040

41-
Packages must have a `pyproject.toml` file that selects the backend:
41+
{% include rr.html id="PY001" %} Packages must have a `pyproject.toml` file
42+
{% include rr.html id="PP001" %} that selects the backend:
4243

4344
<div class="skhep-bar d-flex m-2" style="justify-content:center;">
4445
<button class="skhep-bar-item hatch-btn btn m-2 btn-purple" onclick="openTab('hatch')">Hatchling</button>
@@ -141,6 +142,11 @@ detection, while Trampolim and whey do not, requiring a `tool` setting.
141142
If you don't match your package name and import name (which you should except
142143
for very special cases), you will likely need extra configuration here.
143144

145+
You should have a `README` {% include rr.html id="PY002" %} and a `LICENSE` {%
146+
include rr.html id="PY003" %} file. You should have a `docs/` folder {% include
147+
rr.html id="PY003" %}. You should have a `/tests` folder (recommended) and/or a
148+
`src/<package>/tests` folder.
149+
144150
## Versioning
145151

146152
You can specify the version manually (as shown in the example), but the backends

docs/pages/guides/pytest.md

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ This looks simple, but it is doing several things:
6262
### Configuring pytest
6363

6464
pytest supports configuration in `pytest.ini`, `setup.cfg`, or, since version 6,
65-
`pyproject.toml`. If you can require pytest 6 (in other words, if Python 3.6+ is
66-
fine - pytest is a developer requirement, not a user one, so limiting it is
67-
fine), then use `pyproject.toml`. This is an example configuration:
65+
`pyproject.toml` {% include rr.html id="PP301" %}. Remember, pytest is a
66+
developer requirement, not a user one, so always require 6+ (or 7+) and use
67+
`pyproject.toml`. This is an example configuration:
6868

6969
```toml
7070
[tool.pytest.ini_options]
@@ -79,21 +79,25 @@ testpaths = [
7979
]
8080
```
8181

82-
The `minversion` will print a nicer error if your `pytest` is too old (though,
83-
ironically, it won't read this is the version is too old, so setting "6" or less
84-
in `pyproject.toml` is rather pointless). The `addopts` setting will add
85-
whatever you put there to the command line when you run; `-ra` will print a
86-
summary "r"eport of "a"ll results, which gives you a quick way to review what
87-
tests failed and were skipped, and why. `--showlocals` will print locals in
88-
tracebacks. `--strict-markers` will make sure you don't try to use an
89-
unspecified fixture. And `--strict-config` will error if you make a mistake in
90-
your config. `xfail_strict` will change the default for `xfail` to fail the
91-
tests if it doesn't fail - you can still override locally in a specific xfail
92-
for a flaky failure. `filter_warnings` will cause all warnings to be errors (you
93-
can add allowed warnings here too, see below). `log_cli_level` will report
94-
`INFO` and above log messages on a failure. Finally, `testpaths` will limit
95-
`pytest` to just looking in the folders given - useful if it tries to pick up
96-
things that are not tests from other directories.
82+
{% include rr.html id="PP302" %} The `minversion` will print a nicer error if
83+
your `pytest` is too old (though, ironically, it won't read this is the version
84+
is too old, so setting "6" or less in `pyproject.toml` is rather pointless). The
85+
`addopts` setting will add whatever you put there to the command line when you
86+
run; {% include rr.html id="PP308" %} `-ra` will print a summary "r"eport of
87+
"a"ll results, which gives you a quick way to review what tests failed and were
88+
skipped, and why. `--showlocals` will print locals in tracebacks.
89+
{% include rr.html id="PP307" %} `--strict-markers` will make sure you don't try
90+
to use an unspecified fixture. {% include rr.html id="PP306" %} And
91+
`--strict-config` will error if you make a mistake in your config.
92+
{% include rr.html id="PP305" %} `xfail_strict` will change the default for
93+
`xfail` to fail the tests if it doesn't fail - you can still override locally in
94+
a specific xfail for a flaky failure. {% include rr.html id="PP309" %}
95+
`filter_warnings` will cause all warnings to be errors (you can add allowed
96+
warnings here too, see below). {% include rr.html id="PP304" %} `log_cli_level`
97+
will report `INFO` and above log messages on a failure.
98+
{% include rr.html id="PP303" %} Finally, `testpaths` will limit `pytest` to
99+
just looking in the folders given - useful if it tries to pick up things that
100+
are not tests from other directories.
97101
[See the docs](https://docs.pytest.org/en/stable/customize.html) for more
98102
options.
99103

docs/pages/guides/repo_review.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ permalink: /guides/repo-review/
55
nav_order: 110
66
parent: Topical Guides
77
interactive_repo_review: true
8-
custom_title: Scikit-HEP Repo Review (beta)
98
---
109

1110
You can check the style of a GitHub repository below. Enter any repository, such
@@ -16,14 +15,15 @@ check was skipped because a previous required check failed. Some checks will
1615
fail, that's okay - the goal is bring all possible issues to your attention, not
1716
to force compliance with arbitrary checks.
1817

19-
You can also run [this tool](https://github.com/scikit-hep/repo-review) locally:
18+
You can also run [this tool](https://github.com/scientific-python/repo-review)
19+
locally:
2020

2121
```bash
22-
pipx run 'scikit-hep-repo-review[cli]' <path to repo>
22+
pipx run 'sp-repo-review[cli]' <path to repo>
2323
```
2424

2525
---
2626

2727
{% include interactive_repo_review.html %}
2828

29-
[Open in new page](https://scikit-hep.github.io/repo-review/).
29+
[Open in new page](https://scientific-python.github.io/repo-review/).

0 commit comments

Comments
 (0)