Skip to content

Commit 85d1cc4

Browse files
committed
Merge remote-tracking branch 'origin/main' into sc/improve-numeric-readability-scores-tutorial
2 parents e493874 + 2243423 commit 85d1cc4

10 files changed

Lines changed: 152 additions & 31 deletions

File tree

.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
exclude: ^{{cookiecutter.project_slug}}/|^tests/data/test_package_generation/
22
repos:
33
- repo: https://github.com/astral-sh/ruff-pre-commit
4-
rev: v0.11.12
4+
rev: v0.12.1
55
hooks:
66
- id: ruff
77
args:
@@ -24,15 +24,15 @@ repos:
2424
hooks:
2525
- id: toml-sort-fix
2626
- repo: https://github.com/pre-commit/mirrors-mypy
27-
rev: v1.16.0
27+
rev: v1.16.1
2828
hooks:
2929
- id: mypy
3030
args:
3131
- --config-file=pyproject.toml
3232
additional_dependencies:
3333
- pytest
3434
- repo: https://github.com/rbubley/mirrors-prettier
35-
rev: v3.5.3
35+
rev: v3.6.2
3636
hooks:
3737
- id: prettier
3838
args:
@@ -49,7 +49,7 @@ repos:
4949
- --fix=lf
5050
- id: trailing-whitespace
5151
- repo: https://github.com/python-jsonschema/check-jsonschema
52-
rev: 0.33.0
52+
rev: 0.33.1
5353
hooks:
5454
# Schemas taken from https://www.schemastore.org/json/
5555
- id: check-jsonschema

CONTRIBUTING.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,9 @@ Pages all live in the `docs/pages` sub-directory, and are written in markdown.
7575
To build the webpage locally (for testing)
7676

7777
1. [Install jekyll]
78-
2. Run `bundle install` from the `docs/` directory of this repository to
79-
install dependencies.
80-
3. Run `bundle exec jekyll serve` from the root directory of this repository.
81-
This should fire up a local web server and tell you its address. By default
82-
the server will automatically refresh the HTML pages if any changes are made
78+
2. Run `make serve` from the `docs/` directory of this repository to
79+
install dependencies and start a local web server.
80+
The server will automatically refresh the HTML pages if any changes are made
8381
to the markdown sources.
8482

8583
See the [jekyll docs] for more info.

docs/Makefile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
SHELL := /bin/bash
2+
.PHONY: help serve build install clean check
3+
4+
help: ## Show this help
5+
@echo
6+
@grep -E '^[a-zA-Z_0-9-]+:.*?## .*$$' $(MAKEFILE_LIST) \
7+
| awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%s\033[0m|%s\n", $$1, $$2}' \
8+
| column -t -s '|'
9+
@echo
10+
11+
serve: install ## Start a local server and serve the site
12+
bundle exec jekyll serve
13+
14+
build: install ## Build the site
15+
bundle exec jekyll build
16+
17+
install: check ## Pull all jekyll dependencies
18+
bundle install
19+
20+
clean: ## Remove build files
21+
rm -rf _site
22+
23+
check: ## Check ruby (bundle) is installed
24+
@command -v bundle &> /dev/null || { echo >&2 "Please install ruby >= 2.7 to use Jekyll"; exit 1; }

docs/_includes/header_custom.html

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,30 @@
1-
<button class="btn js-toggle-dark-mode" aria-label="Switch to light mode">
2-
3-
</button>
1+
<div class="js-toggle-dark-mode-wrapper">
2+
<button
3+
class="btn js-toggle-dark-mode"
4+
aria-label="Switch to light mode"
5+
type="button"
6+
>
7+
8+
</button>
9+
</div>
410

511
<script>
612
const toggleDarkMode = document.querySelector(".js-toggle-dark-mode");
13+
14+
const setHtmlThemeAttr = (theme) => {
15+
document.documentElement.setAttribute("data-theme", theme);
16+
};
17+
718
jtd.addEvent(toggleDarkMode, "click", function () {
819
if (jtd.getTheme() === "light") {
920
jtd.setTheme("dark");
21+
setHtmlThemeAttr("dark");
1022
toggleDarkMode.textContent = "☼";
1123
toggleDarkMode.ariaLabel = "Switch to light mode";
1224
localStorage.setItem("theme", "dark");
1325
} else {
1426
jtd.setTheme("light");
27+
setHtmlThemeAttr("light");
1528
toggleDarkMode.textContent = "☾";
1629
toggleDarkMode.ariaLabel = "Switch to dark mode";
1730
localStorage.setItem("theme", "light");
@@ -22,12 +35,9 @@
2235
* Meanwhile, we check each time if there is a theme written to local storage and obey it.
2336
*/
2437
window.addEventListener("DOMContentLoaded", function () {
25-
if (localStorage.getItem("theme") === "dark") {
26-
jtd.setTheme("dark");
27-
toggleDarkMode.textContent = "☼";
28-
} else {
29-
jtd.setTheme("light");
30-
toggleDarkMode.textContent = "☾";
31-
}
38+
const theme = localStorage.getItem("theme") === "dark" ? "dark" : "light";
39+
jtd.setTheme(theme);
40+
setHtmlThemeAttr(theme);
41+
toggleDarkMode.textContent = theme === "dark" ? "☼" : "☾";
3242
});
3343
</script>

docs/_sass/custom/custom.scss

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
:root {
2+
--outline-color: #{$outline-color-light};
3+
}
4+
5+
[data-theme="dark"] {
6+
--outline-color: #{$outline-color-dark};
7+
}
8+
19
html,
210
body {
311
height: 100%;
@@ -28,3 +36,71 @@ div.site-logo {
2836
width: 100%;
2937
color: $body-text-color;
3038
}
39+
40+
// Dark mode link styles
41+
html[data-theme="dark"] {
42+
.main-header a,
43+
.main-header button,
44+
.side-bar a {
45+
color: $link-color-dark;
46+
}
47+
48+
main a,
49+
footer a {
50+
color: $link-color-dark;
51+
text-decoration: underline;
52+
text-decoration-color: $link-color-dark;
53+
text-decoration-thickness: 1px;
54+
transition:
55+
text-decoration-thickness 0.2s ease-in-out,
56+
text-underline-offset 0.2s ease-in-out;
57+
}
58+
59+
main a:hover,
60+
footer a:hover {
61+
text-decoration-color: $link-color-dark;
62+
text-decoration-thickness: 2px;
63+
text-underline-offset: 3px;
64+
}
65+
}
66+
67+
// Label colors
68+
main {
69+
.label-green {
70+
background-color: $label-success-bg;
71+
}
72+
73+
.label-red {
74+
background-color: $label-error-bg;
75+
}
76+
}
77+
78+
// Outline styles
79+
.search:focus-within,
80+
.btn:focus,
81+
.btn:active,
82+
.btn:focus:hover,
83+
a:focus-visible,
84+
summary:focus-visible {
85+
outline: none;
86+
box-shadow: 0 0 0 3px var(--outline-color);
87+
border-radius: 2px;
88+
transition: box-shadow 0.2s ease;
89+
}
90+
91+
.aux-nav .aux-nav-list-item {
92+
padding: 5px;
93+
}
94+
95+
.nav-list-item {
96+
padding-left: 1px;
97+
padding-right: 1px;
98+
}
99+
100+
.js-toggle-dark-mode {
101+
height: 100%;
102+
}
103+
104+
.js-toggle-dark-mode-wrapper {
105+
padding: 5px;
106+
}

docs/_sass/custom/setup.scss

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Color palette
2+
$blue-400: #4da6ff;
3+
$green-700: #00755c;
4+
$red-600: #d13c3c;
5+
$purple-500: rgba(215, 186, 255, 0.65);
6+
$lavender: #b69cff;
7+
8+
// Semantic mappings
9+
$link-color-dark: $blue-400;
10+
$label-success-bg: $green-700;
11+
$label-error-bg: $red-600;
12+
$outline-color-light: $lavender;
13+
$outline-color-dark: $purple-500;

hooks/post_gen_project.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ def main(initialise_git_repository: str, deploy_docs_to_github_pages: str) -> in
2222
if initialise_git_repository == "True":
2323
try:
2424
# initialise git repo
25-
subprocess.run( # noqa: S603
25+
subprocess.run(
2626
[ # noqa: S607
2727
"git",
2828
"init",
2929
],
3030
check=True,
3131
)
3232
# old versions of git still default to `master`
33-
subprocess.run( # noqa: S603
33+
subprocess.run(
3434
[ # noqa: S607
3535
"git",
3636
"branch",
@@ -51,7 +51,7 @@ def main(initialise_git_repository: str, deploy_docs_to_github_pages: str) -> in
5151

5252
try:
5353
# check for presence of GitHub CLI
54-
subprocess.run( # noqa: S603
54+
subprocess.run(
5555
[ # noqa: S607
5656
"gh",
5757
"--version",

tests/data/test_package_generation/.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/astral-sh/ruff-pre-commit
3-
rev: v0.11.12
3+
rev: v0.12.1
44
hooks:
55
- id: ruff
66
- id: ruff-format
@@ -19,11 +19,11 @@ repos:
1919
hooks:
2020
- id: toml-sort-fix
2121
- repo: https://github.com/pre-commit/mirrors-mypy
22-
rev: v1.16.0
22+
rev: v1.16.1
2323
hooks:
2424
- id: mypy
2525
- repo: https://github.com/rbubley/mirrors-prettier
26-
rev: v3.5.3
26+
rev: v3.6.2
2727
hooks:
2828
- id: prettier
2929
args:
@@ -41,7 +41,7 @@ repos:
4141
- --fix=lf
4242
- id: trailing-whitespace
4343
- repo: https://github.com/python-jsonschema/check-jsonschema
44-
rev: 0.33.0
44+
rev: 0.33.1
4545
hooks:
4646
# Schemas taken from https://www.schemastore.org/json/
4747
- id: check-jsonschema

tests/test_git_init.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def test_initialisation_of_git_repo(
4747

4848
try:
4949
# check for presence of GitHub CLI
50-
subprocess.run( # noqa: S603
50+
subprocess.run(
5151
[ # noqa: S607
5252
"gh",
5353
"--version",

{{cookiecutter.project_slug}}/.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/astral-sh/ruff-pre-commit
3-
rev: v0.11.12
3+
rev: v0.12.1
44
hooks:
55
- id: ruff
66
- id: ruff-format
@@ -19,11 +19,11 @@ repos:
1919
hooks:
2020
- id: toml-sort-fix
2121
- repo: https://github.com/pre-commit/mirrors-mypy
22-
rev: v1.16.0
22+
rev: v1.16.1
2323
hooks:
2424
- id: mypy
2525
- repo: https://github.com/rbubley/mirrors-prettier
26-
rev: v3.5.3
26+
rev: v3.6.2
2727
hooks:
2828
- id: prettier
2929
args:
@@ -41,7 +41,7 @@ repos:
4141
- --fix=lf
4242
- id: trailing-whitespace
4343
- repo: https://github.com/python-jsonschema/check-jsonschema
44-
rev: 0.33.0
44+
rev: 0.33.1
4545
hooks:
4646
# Schemas taken from https://www.schemastore.org/json/
4747
- id: check-jsonschema

0 commit comments

Comments
 (0)