Skip to content

Commit bdfbfa8

Browse files
committed
Merge remote-tracking branch 'origin/main' into sc/tox-warnings-on-freshly-cut-cookie
2 parents a4a08dd + 5e727bb commit bdfbfa8

8 files changed

Lines changed: 113 additions & 85 deletions

File tree

.all-contributorsrc

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@
4343
"question",
4444
"review",
4545
"talk",
46-
"test"
46+
"test",
47+
"tutorial"
4748
]
4849
},
4950
{
@@ -77,7 +78,8 @@
7778
"eventOrganizing",
7879
"review",
7980
"talk",
80-
"test"
81+
"test",
82+
"tutorial"
8183
]
8284
},
8385
{
@@ -105,7 +107,8 @@
105107
"doc",
106108
"question",
107109
"review",
108-
"test"
110+
"test",
111+
"tutorial"
109112
]
110113
},
111114
{
@@ -268,7 +271,10 @@
268271
"doc",
269272
"content",
270273
"maintenance",
271-
"review"
274+
"review",
275+
"talk",
276+
"tutorial",
277+
"eventOrganizing"
272278
]
273279
},
274280
{
@@ -288,7 +294,8 @@
288294
"contributions": [
289295
"bug",
290296
"a11y",
291-
"review"
297+
"review",
298+
"tutorial"
292299
]
293300
},
294301
{
@@ -310,6 +317,15 @@
310317
"a11y",
311318
"code"
312319
]
320+
},
321+
{
322+
"login": "jamesbriant",
323+
"name": "James Briant",
324+
"avatar_url": "https://avatars.githubusercontent.com/u/6298711?v=4",
325+
"profile": "http://james.briant.co.uk",
326+
"contributions": [
327+
"bug"
328+
]
313329
}
314330
]
315331
}

README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Python packages with our recommended tooling set up and ready to go.
1717

1818
> [!NOTE]
1919
> If you're making a package within a community that has an existing
20-
> package template (e.g., [`scikit-hep`](https://github.com/scikit-hep/cookie)),
20+
> package template (e.g., [`SciKit-Surgery`](https://github.com/SciKit-Surgery/PythonTemplate)),
2121
> we recommend using their template instead of this one.
2222
2323
## Using our Python package template
@@ -77,11 +77,11 @@ uv pip install -e ".[dev]"
7777
<tbody>
7878
<tr>
7979
<td align="center" valign="top" width="14.28%"><a href="https://paddyroddy.github.io"><img src="https://avatars.githubusercontent.com/u/15052188?v=4?s=100" width="100px;" alt="Patrick J. Roddy"/><br /><sub><b>Patrick J. Roddy</b></sub></a><br /><a href="#ideas-paddyroddy" title="Ideas, Planning, & Feedback">🤔</a> <a href="#bug-paddyroddy" title="Bug reports">🐛</a> <a href="#code-paddyroddy" title="Code">💻</a> <a href="#content-paddyroddy" title="Content">🖋</a> <a href="#doc-paddyroddy" title="Documentation">📖</a> <a href="#eventOrganizing-paddyroddy" title="Event Organizing">📋</a> <a href="#projectManagement-paddyroddy" title="Project Management">📆</a> <a href="#question-paddyroddy" title="Answering Questions">💬</a> <a href="#review-paddyroddy" title="Reviewed Pull Requests">👀</a> <a href="#talk-paddyroddy" title="Talks">📢</a> <a href="#test-paddyroddy" title="Tests">⚠️</a></td>
80-
<td align="center" valign="top" width="14.28%"><a href="http://scnlf.me"><img src="https://avatars.githubusercontent.com/u/1836192?v=4?s=100" width="100px;" alt="Sam Cunliffe"/><br /><sub><b>Sam Cunliffe</b></sub></a><br /><a href="#ideas-samcunliffe" title="Ideas, Planning, & Feedback">🤔</a> <a href="#bug-samcunliffe" title="Bug reports">🐛</a> <a href="#code-samcunliffe" title="Code">💻</a> <a href="#content-samcunliffe" title="Content">🖋</a> <a href="#doc-samcunliffe" title="Documentation">📖</a> <a href="#eventOrganizing-samcunliffe" title="Event Organizing">📋</a> <a href="#projectManagement-samcunliffe" title="Project Management">📆</a> <a href="#question-samcunliffe" title="Answering Questions">💬</a> <a href="#review-samcunliffe" title="Reviewed Pull Requests">👀</a> <a href="#talk-samcunliffe" title="Talks">📢</a> <a href="#test-samcunliffe" title="Tests">⚠️</a></td>
80+
<td align="center" valign="top" width="14.28%"><a href="http://scnlf.me"><img src="https://avatars.githubusercontent.com/u/1836192?v=4?s=100" width="100px;" alt="Sam Cunliffe"/><br /><sub><b>Sam Cunliffe</b></sub></a><br /><a href="#ideas-samcunliffe" title="Ideas, Planning, & Feedback">🤔</a> <a href="#bug-samcunliffe" title="Bug reports">🐛</a> <a href="#code-samcunliffe" title="Code">💻</a> <a href="#content-samcunliffe" title="Content">🖋</a> <a href="#doc-samcunliffe" title="Documentation">📖</a> <a href="#eventOrganizing-samcunliffe" title="Event Organizing">📋</a> <a href="#projectManagement-samcunliffe" title="Project Management">📆</a> <a href="#question-samcunliffe" title="Answering Questions">💬</a> <a href="#review-samcunliffe" title="Reviewed Pull Requests">👀</a> <a href="#talk-samcunliffe" title="Talks">📢</a> <a href="#test-samcunliffe" title="Tests">⚠️</a> <a href="#tutorial-samcunliffe" title="Tutorials">✅</a></td>
8181
<td align="center" valign="top" width="14.28%"><a href="https://www.davidstansby.com"><img src="https://avatars.githubusercontent.com/u/6197628?v=4?s=100" width="100px;" alt="David Stansby"/><br /><sub><b>David Stansby</b></sub></a><br /><a href="#ideas-dstansby" title="Ideas, Planning, & Feedback">🤔</a> <a href="#bug-dstansby" title="Bug reports">🐛</a> <a href="#code-dstansby" title="Code">💻</a> <a href="#content-dstansby" title="Content">🖋</a> <a href="#doc-dstansby" title="Documentation">📖</a> <a href="#eventOrganizing-dstansby" title="Event Organizing">📋</a> <a href="#projectManagement-dstansby" title="Project Management">📆</a> <a href="#review-dstansby" title="Reviewed Pull Requests">👀</a> <a href="#test-dstansby" title="Tests">⚠️</a></td>
82-
<td align="center" valign="top" width="14.28%"><a href="http://matt-graham.github.io"><img src="https://avatars.githubusercontent.com/u/6746980?v=4?s=100" width="100px;" alt="Matt Graham"/><br /><sub><b>Matt Graham</b></sub></a><br /><a href="#bug-matt-graham" title="Bug reports">🐛</a> <a href="#code-matt-graham" title="Code">💻</a> <a href="#content-matt-graham" title="Content">🖋</a> <a href="#doc-matt-graham" title="Documentation">📖</a> <a href="#design-matt-graham" title="Design">🎨</a> <a href="#eventOrganizing-matt-graham" title="Event Organizing">📋</a> <a href="#review-matt-graham" title="Reviewed Pull Requests">👀</a> <a href="#talk-matt-graham" title="Talks">📢</a> <a href="#test-matt-graham" title="Tests">⚠️</a></td>
82+
<td align="center" valign="top" width="14.28%"><a href="http://matt-graham.github.io"><img src="https://avatars.githubusercontent.com/u/6746980?v=4?s=100" width="100px;" alt="Matt Graham"/><br /><sub><b>Matt Graham</b></sub></a><br /><a href="#bug-matt-graham" title="Bug reports">🐛</a> <a href="#code-matt-graham" title="Code">💻</a> <a href="#content-matt-graham" title="Content">🖋</a> <a href="#doc-matt-graham" title="Documentation">📖</a> <a href="#design-matt-graham" title="Design">🎨</a> <a href="#eventOrganizing-matt-graham" title="Event Organizing">📋</a> <a href="#review-matt-graham" title="Reviewed Pull Requests">👀</a> <a href="#talk-matt-graham" title="Talks">📢</a> <a href="#test-matt-graham" title="Tests">⚠️</a> <a href="#tutorial-matt-graham" title="Tutorials">✅</a></td>
8383
<td align="center" valign="top" width="14.28%"><a href="https://github.com/sfmig"><img src="https://avatars.githubusercontent.com/u/33267254?v=4?s=100" width="100px;" alt="sfmig"/><br /><sub><b>sfmig</b></sub></a><br /><a href="#bug-sfmig" title="Bug reports">🐛</a> <a href="#code-sfmig" title="Code">💻</a> <a href="#content-sfmig" title="Content">🖋</a> <a href="#review-sfmig" title="Reviewed Pull Requests">👀</a> <a href="#test-sfmig" title="Tests">⚠️</a></td>
84-
<td align="center" valign="top" width="14.28%"><a href="https://github.com/p-j-smith"><img src="https://avatars.githubusercontent.com/u/29753790?v=4?s=100" width="100px;" alt="Paul Smith"/><br /><sub><b>Paul Smith</b></sub></a><br /><a href="#bug-p-j-smith" title="Bug reports">🐛</a> <a href="#code-p-j-smith" title="Code">💻</a> <a href="#content-p-j-smith" title="Content">🖋</a> <a href="#doc-p-j-smith" title="Documentation">📖</a> <a href="#question-p-j-smith" title="Answering Questions">💬</a> <a href="#review-p-j-smith" title="Reviewed Pull Requests">👀</a> <a href="#test-p-j-smith" title="Tests">⚠️</a></td>
84+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/p-j-smith"><img src="https://avatars.githubusercontent.com/u/29753790?v=4?s=100" width="100px;" alt="Paul Smith"/><br /><sub><b>Paul Smith</b></sub></a><br /><a href="#bug-p-j-smith" title="Bug reports">🐛</a> <a href="#code-p-j-smith" title="Code">💻</a> <a href="#content-p-j-smith" title="Content">🖋</a> <a href="#doc-p-j-smith" title="Documentation">📖</a> <a href="#question-p-j-smith" title="Answering Questions">💬</a> <a href="#review-p-j-smith" title="Reviewed Pull Requests">👀</a> <a href="#test-p-j-smith" title="Tests">⚠️</a> <a href="#tutorial-p-j-smith" title="Tutorials">✅</a></td>
8585
<td align="center" valign="top" width="14.28%"><a href="https://docs.renovatebot.com/"><img src="https://avatars.githubusercontent.com/u/38656520?v=4?s=100" width="100px;" alt="Renovate Bot"/><br /><sub><b>Renovate Bot</b></sub></a><br /><a href="#maintenance-renovatebot" title="Maintenance">🚧</a></td>
8686
</tr>
8787
<tr>
@@ -103,11 +103,12 @@ uv pip install -e ".[dev]"
103103
<td align="center" valign="top" width="14.28%"><a href="https://pre-commit.ci"><img src="https://avatars.githubusercontent.com/u/64617429?v=4?s=100" width="100px;" alt="pre-commit.ci"/><br /><sub><b>pre-commit.ci</b></sub></a><br /><a href="#maintenance-pre-commit-ci" title="Maintenance">🚧</a></td>
104104
</tr>
105105
<tr>
106-
<td align="center" valign="top" width="14.28%"><a href="https://saransh-cpp.github.io/"><img src="https://avatars.githubusercontent.com/u/74055102?v=4?s=100" width="100px;" alt="Saransh Chopra"/><br /><sub><b>Saransh Chopra</b></sub></a><br /><a href="#doc-Saransh-cpp" title="Documentation">📖</a> <a href="#content-Saransh-cpp" title="Content">🖋</a> <a href="#maintenance-Saransh-cpp" title="Maintenance">🚧</a> <a href="#review-Saransh-cpp" title="Reviewed Pull Requests">👀</a></td>
106+
<td align="center" valign="top" width="14.28%"><a href="https://saransh-cpp.github.io/"><img src="https://avatars.githubusercontent.com/u/74055102?v=4?s=100" width="100px;" alt="Saransh Chopra"/><br /><sub><b>Saransh Chopra</b></sub></a><br /><a href="#doc-Saransh-cpp" title="Documentation">📖</a> <a href="#content-Saransh-cpp" title="Content">🖋</a> <a href="#maintenance-Saransh-cpp" title="Maintenance">🚧</a> <a href="#review-Saransh-cpp" title="Reviewed Pull Requests">👀</a> <a href="#talk-Saransh-cpp" title="Talks">📢</a> <a href="#tutorial-Saransh-cpp" title="Tutorials">✅</a> <a href="#eventOrganizing-Saransh-cpp" title="Event Organizing">📋</a></td>
107107
<td align="center" valign="top" width="14.28%"><a href="http://drandrewmitchell.com"><img src="https://avatars.githubusercontent.com/u/22335636?v=4?s=100" width="100px;" alt="Andrew Mitchell"/><br /><sub><b>Andrew Mitchell</b></sub></a><br /><a href="#bug-MitchellAcoustics" title="Bug reports">🐛</a></td>
108-
<td align="center" valign="top" width="14.28%"><a href="https://www.ucl.ac.uk/advanced-research-computing/advanced-research-computing-centre"><img src="https://avatars.githubusercontent.com/u/24316371?v=4?s=100" width="100px;" alt="Kimberly Meechan"/><br /><sub><b>Kimberly Meechan</b></sub></a><br /><a href="#bug-K-Meech" title="Bug reports">🐛</a> <a href="#a11y-K-Meech" title="Accessibility">️️️️♿️</a> <a href="#review-K-Meech" title="Reviewed Pull Requests">👀</a></td>
108+
<td align="center" valign="top" width="14.28%"><a href="https://www.ucl.ac.uk/advanced-research-computing/advanced-research-computing-centre"><img src="https://avatars.githubusercontent.com/u/24316371?v=4?s=100" width="100px;" alt="Kimberly Meechan"/><br /><sub><b>Kimberly Meechan</b></sub></a><br /><a href="#bug-K-Meech" title="Bug reports">🐛</a> <a href="#a11y-K-Meech" title="Accessibility">️️️️♿️</a> <a href="#review-K-Meech" title="Reviewed Pull Requests">👀</a> <a href="#tutorial-K-Meech" title="Tutorials">✅</a></td>
109109
<td align="center" valign="top" width="14.28%"><a href="https://github.com/jamesprime"><img src="https://avatars.githubusercontent.com/u/17751241?v=4?s=100" width="100px;" alt="James Prime"/><br /><sub><b>James Prime</b></sub></a><br /><a href="#a11y-jamesprime" title="Accessibility">️️️️♿️</a> <a href="#ideas-jamesprime" title="Ideas, Planning, & Feedback">🤔</a></td>
110110
<td align="center" valign="top" width="14.28%"><a href="https://github.com/cuteshaun"><img src="https://avatars.githubusercontent.com/u/28014041?v=4?s=100" width="100px;" alt="Andrii Tsapko"/><br /><sub><b>Andrii Tsapko</b></sub></a><br /><a href="#a11y-cuteshaun" title="Accessibility">️️️️♿️</a> <a href="#code-cuteshaun" title="Code">💻</a></td>
111+
<td align="center" valign="top" width="14.28%"><a href="http://james.briant.co.uk"><img src="https://avatars.githubusercontent.com/u/6298711?v=4?s=100" width="100px;" alt="James Briant"/><br /><sub><b>James Briant</b></sub></a><br /><a href="#bug-jamesbriant" title="Bug reports">🐛</a></td>
111112
</tr>
112113
</tbody>
113114
</table>

docs/pages/linting.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,11 @@ for some of these.
3232
| Name | Short description | 🚦 |
3333
| ---------------------------------------------- | ----------------------------------------------------------------------------- | :-----------------------------------------: |
3434
| [mypy](https://mypy.readthedocs.io/en/stable/) | Static type checker, won't fail if no typing but will if typing is incorrect. | <span class="label label-green">Best</span> |
35+
36+
### Dependency checking
37+
38+
| Name | Short description | 🚦 |
39+
| ----------------------------------------------------------------- | ---------------------------------------------------------------- | :------------------------------------------: |
40+
| [deptry](https://deptry.com/) | Checks for unused dependencies and undeclared dependencies. | <span class="label label-yellow">Good</span> |
41+
| [fawltydeps](https://tweag.github.io/FawltyDeps/) | Checks for unused dependencies and undeclared dependencies. | <span class="label label-yellow">Good</span> |
42+
| [pip-check-reqs](https://github.com/adamtheturtle/pip-check-reqs) | Checks requirements file (requires converting `pyproject.toml`). | <span class="label label-yellow">Good</span> |

docs/pages/templates.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ their package template.
2929
| ------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------- |
3030
| [Napari](https://github.com/napari/cookiecutter-napari-plugin) | Cookiecutter template for authoring (npe2-based) napari plugins. |
3131
| [SciKit-Surgery](https://github.com/SciKit-Surgery/PythonTemplate) | Cookiecutter template developed by the Wellcome EPSRC Centre for Interventional and Surgical Sciences. |
32-
| [Scientific Python](https://github.com/scientific-python/cookie) | Cookiecutter template developed by [SciKit-HEP](https://github.com/scikit-hep) but now adopted by the more general Scientific Python community. |
32+
| [Scientific Python](https://github.com/scientific-python/cookie) | Cookiecutter template developed by [Scikit-HEP](https://github.com/scikit-hep) but now adopted by the more general Scientific Python community. |
3333

3434
### Template engines
3535

hooks/post_gen_project.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def main(initialise_git_repository: str, deploy_docs_to_github_pages: str) -> in
6666
'-d "{{cookiecutter.project_short_description}}" '
6767
"--public "
6868
"-r origin "
69-
"--source {{cookiecutter.project_slug}}\n"
69+
"--source {{cookiecutter.project_slug}}\n",
7070
)
7171
except FileNotFoundError:
7272
# GitHub CLI isn't installed
@@ -78,7 +78,7 @@ def main(initialise_git_repository: str, deploy_docs_to_github_pages: str) -> in
7878
"https://docs.github.com/en/get-started/quickstart/create-a-repo.\n\n"
7979
"Then run:\n\n"
8080
"git remote add origin [email protected]:"
81-
"{{cookiecutter.__repo_name}}.git\n"
81+
"{{cookiecutter.__repo_name}}.git\n",
8282
)
8383
except subprocess.CalledProcessError as e:
8484
# some other error
@@ -98,7 +98,7 @@ def main(initialise_git_repository: str, deploy_docs_to_github_pages: str) -> in
9898
"{{cookiecutter.__repo_url}}/settings/pages\n\n"
9999
"and under 'Built and deployment' selecting 'Deploy from a branch' for "
100100
"the 'Source' drop-down and 'gh-pages' for the 'Branch' drop-down, "
101-
"leaving the branch path drop-down with its default value of '/ (root)'."
101+
"leaving the branch path drop-down with its default value of '/ (root)'.",
102102
)
103103

104104
return _EXIT_SUCCESS
@@ -109,5 +109,5 @@ def main(initialise_git_repository: str, deploy_docs_to_github_pages: str) -> in
109109
main(
110110
"{{ cookiecutter.initialise_git_repository }}",
111111
"{{ cookiecutter.deploy_docs_to_github_pages }}",
112-
)
112+
),
113113
)

tests/conftest.py

Lines changed: 46 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,50 @@
77
import pytest
88

99

10+
@pytest.fixture(scope="function") # noqa: PT003
11+
def default_config() -> dict[str, str]:
12+
"""
13+
Get the minimal default configuration for cutting a cookie in tests.
14+
15+
This is used if `generate_package` is called without arguments.
16+
"""
17+
return {
18+
"github_owner": "test-user",
19+
"project_short_description": "description",
20+
"project_name": "Cookiecutter Test",
21+
"project_slug": "cookiecutter-test",
22+
}
23+
24+
25+
@pytest.fixture(scope="function") # noqa: PT003
26+
def default_config_with(default_config: dict[str, str]) -> typing.Callable:
27+
"""Extend or modify the default configuration with one additional value."""
28+
29+
def _wrapped_with(**kwargs: str) -> dict[str, str]:
30+
return default_config | kwargs
31+
32+
return _wrapped_with
33+
34+
1035
def _generate_package(
1136
config: dict[str, str], path: pathlib.Path
12-
) -> subprocess.CompletedProcess[str]:
37+
) -> tuple[subprocess.CompletedProcess[str], pathlib.Path]:
1338
"""
1439
Generate a project from the cookiecutter template.
1540
16-
Arguments:
17-
---------
18-
config: dict
41+
Parameters
42+
----------
43+
config
1944
A dictionary with values for the cookiecutter template,
2045
as defined in the cookiecutter.json
21-
path: Path
46+
path
2247
Directory to create package in.
2348
49+
Returns
50+
-------
51+
subprocess.CompletedProcess, pathlib.Path
52+
The result of the cookiecutter command and the path to the generated package.
53+
2454
"""
2555
args = [f"{key}={val}" for key, val in config.items()]
2656
cmd = ["cookiecutter", ".", "--no-input", "--output-dir", f"{path}"]
@@ -30,10 +60,18 @@ def _generate_package(
3060
shell=False,
3161
capture_output=True,
3262
text=True,
33-
)
63+
), path / config["project_slug"]
3464

3565

3666
@pytest.fixture
37-
def generate_package() -> typing.Callable:
67+
def generate_package(
68+
default_config: dict[str, str], tmp_path: pathlib.Path
69+
) -> typing.Callable:
3870
"""Generate project from cookiecutter template."""
39-
return _generate_package
71+
72+
def _wrapped_with_tmp_path(
73+
config: dict[str, str] = default_config,
74+
) -> tuple[subprocess.CompletedProcess, pathlib.Path]:
75+
return _generate_package(config, tmp_path)
76+
77+
return _wrapped_with_tmp_path

0 commit comments

Comments
 (0)