Skip to content

Commit 6e650a4

Browse files
authored
chore(template): accept new copier update (#37)
Co-authored-by: wpk-nist-gov <5348008+wpk-nist-gov@users.noreply.github.com>
1 parent a9bcfa5 commit 6e650a4

6 files changed

Lines changed: 108 additions & 51 deletions

File tree

.copier-answers.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
2-
_commit: v0.7.0-109-g667a118
2+
_commit: v0.7.0-130-gde18aa4
33
_src_path: https://github.com/usnistgov/cookiecutter-nist-python.git
44
command_line_interface: typer
55
conda_channel: conda-forge

.github/workflows/cd.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ jobs:
8484
smoke-test:
8585
name: Smoke test package
8686
if:
87-
${{ (github.event_name == 'release' && github.event.action == 'published')
88-
|| (github.event_name == 'workflow_dispatch' && inputs.deploy) }}
87+
(github.event_name == 'release' && github.event.action == 'published') ||
88+
(github.event_name == 'workflow_dispatch' && inputs.deploy)
8989
needs:
9090
- dist
9191
runs-on: ubuntu-latest
@@ -112,8 +112,8 @@ jobs:
112112
publish-testpypi:
113113
name: Publish package to testpypi
114114
if:
115-
${{ (github.event_name == 'release' && github.event.action == 'published')
116-
|| (github.event_name == 'workflow_dispatch' && inputs.deploy) }}
115+
(github.event_name == 'release' && github.event.action == 'published') ||
116+
(github.event_name == 'workflow_dispatch' && inputs.deploy)
117117
needs:
118118
- dist
119119
- smoke-test
@@ -136,8 +136,8 @@ jobs:
136136
publish-pypi:
137137
name: Publish package to pypi
138138
if:
139-
${{ (github.event_name == 'release' && github.event.action == 'published')
140-
|| (github.event_name == 'workflow_dispatch' && inputs.deploy) }}
139+
(github.event_name == 'release' && github.event.action == 'published') ||
140+
(github.event_name == 'workflow_dispatch' && inputs.deploy)
141141
needs:
142142
- dist
143143
- smoke-test

.github/workflows/ci.yml

Lines changed: 80 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,31 @@ env:
1313
FORCE_COLOR: "3"
1414
UVX_CONSTRAINT: requirements/lock/uvx-tools.txt
1515
UVX_COMMAND: uvx -crequirements/lock/uvx-tools.txt
16+
EXTRA_PYTHON_VERSIONS: "pypy-3.11"
1617

1718
permissions: {}
1819

1920
jobs:
21+
pre_job:
22+
# continue-on-error: true # Uncomment once integration is finished
23+
runs-on: ubuntu-latest
24+
outputs:
25+
should_skip: ${{ steps.skip_check.outputs.should_skip }}
26+
steps:
27+
- id: skip_check
28+
uses: fkirc/skip-duplicate-actions@f75f66ce1886f00957d99748a42c724f4330bdcf # v5.3.1
29+
with:
30+
paths_ignore: '[".cruft.json", ".copier.yml"]'
31+
2032
build-package:
2133
name: Build & verify package
34+
needs: pre_job
35+
if: needs.pre_job.outputs.should_skip != 'true'
2236
runs-on: ubuntu-latest
23-
2437
steps:
2538
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2639
with:
2740
persist-credentials: false
28-
2941
- uses: hynek/build-and-inspect-python-package@efb823f52190ad02594531168b7a2d5790e66516 # v2.14.0
3042
id: baipp
3143

@@ -40,26 +52,48 @@ jobs:
4052
import json
4153
from pathlib import Path
4254
43-
python_versions = json.loads(os.getenv("python_classifiers"))
4455
default_python_version = Path(".python-version").read_text().strip()
56+
python_versions = json.loads(os.getenv("python_classifiers"))
57+
extra_python_versions = [_.strip() for _ in os.getenv("EXTRA_PYTHON_VERSIONS", "").split(",") if _]
58+
59+
min_python_version = python_versions[0]
60+
max_python_version = python_versions[-1]
61+
minmax_python_versions = [min_python_version, max_python_version, *extra_python_versions]
62+
minmax_default_python_versions = list({*minmax_python_versions, default_python_version})
63+
all_python_versions = list({*python_versions, *extra_python_versions})
64+
65+
print("{default_python_version=:s}")
66+
print("{min_python_version=:s}")
67+
print("{max_python_version=:s}")
68+
print("{minmax_python_versions=}")
69+
print("{minmax_default_python_versions=}")
70+
print("{all_python_version=}")
4571
46-
# min max and default pythons
47-
matrix_test_python = list({ python_versions[0], python_versions[-1], default_python_version, f"pypy-3.11" })
4872
4973
with open(os.getenv("GITHUB_OUTPUT"), "a") as f:
5074
f.write(f"{default_python_version=:s}\n")
51-
f.write(f"matrix_test_python={json.dumps(matrix_test_python)}\n")
75+
f.write(f"{min_python_version=:s}\n")
76+
f.write(f"{max_python_version=:s}\n")
77+
f.write(f"minmax_python_versions={json.dumps(minmax_python_versions)}\n")
78+
f.write(f"minmax_default_python_versions={json.dumps(minmax_default_python_versions)}\n")
79+
f.write(f"all_python_versions={json.dumps(all_python_versions)}\n")
5280
5381
outputs:
54-
supported-python-versions:
55-
${{ steps.baipp.outputs.supported_python_classifiers_json_array }}
5682
default-python-version:
5783
${{ steps.versions.outputs.default_python_version }}
58-
matrix-test-python: ${{ steps.versions.outputs.matrix_test_python }}
84+
min-python-version: ${{ steps.versions.outputs.min_python_version }}
85+
max-python-version: ${{ steps.versions.outputs.max_python_version }}
86+
minmax-python-versions:
87+
${{ steps.versions.outputs.minmax_python_versions }}
88+
minmax-default-python-versions:
89+
${{ steps.versions.outputs.minmax_default_python_versions }}
90+
all-python-version: ${{ steps.versions.outputs.all_python_versions }}
5991

6092
lint:
6193
# only run checks not covered by pre-commit.ci
6294
name: Lint package
95+
needs: pre_job
96+
if: needs.pre_job.outputs.should_skip != 'true'
6397
runs-on: ubuntu-latest
6498
steps:
6599
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -92,8 +126,27 @@ jobs:
92126
prek run --show-diff-on-failure --color=always --all-files
93127
--hook-stage=manual -v
94128
129+
pinact:
130+
name: Pin actions
131+
needs: pre_job
132+
if: needs.pre_job.outputs.should_skip != 'true'
133+
runs-on: ubuntu-latest
134+
permissions:
135+
contents: write
136+
steps:
137+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
138+
with:
139+
persist-credentials: false
140+
141+
- name: Pin actions
142+
uses: suzuki-shunsuke/pinact-action@1081f5ad49ac904b7d977784f338145150a32112 # v1.4.0
143+
with:
144+
skip_push: "true"
145+
95146
typecheck:
96147
name: Typecheck package
148+
needs: pre_job
149+
if: needs.pre_job.outputs.should_skip != 'true'
97150
runs-on: ${{ matrix.os }}
98151
strategy:
99152
fail-fast: false
@@ -121,15 +174,20 @@ jobs:
121174

122175
test:
123176
name: Test package across pythons
124-
needs: build-package
177+
needs:
178+
- pre_job
179+
- build-package
180+
if: needs.pre_job.outputs.should_skip != 'true'
125181
runs-on: ${{ matrix.os }}
126182
strategy:
127183
fail-fast: false
128184
matrix:
129185
os:
130186
- ubuntu-latest
131187
python-version:
132-
${{ fromJson(needs.build-package.outputs.matrix-test-python) }}
188+
${{
189+
fromJson(needs.build-package.outputs.minmax-default-python-versions)
190+
}}
133191
include:
134192
- os: windows-latest
135193
python-version:
@@ -155,7 +213,7 @@ jobs:
155213
shell: bash
156214

157215
- name: Upload coverage data
158-
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
216+
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
159217
with:
160218
name: coverage-data-${{ matrix.os }}-${{ matrix.python-version }}
161219
path: .nox/test-*/tmp/.coverage*
@@ -164,7 +222,10 @@ jobs:
164222

165223
coverage:
166224
name: Combine coverage
167-
needs: test
225+
needs:
226+
- pre_job
227+
- test
228+
if: needs.pre_job.outputs.should_skip != 'true'
168229
runs-on: ubuntu-latest
169230

170231
steps:
@@ -194,47 +255,36 @@ jobs:
194255
$UVX_COMMAND nox -s coverage -- ++coverage report ++coverage-options --fail-under=100
195256
shell: bash
196257
- name: Upload HTML report if check failed.
197-
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
258+
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
198259
with:
199260
name: html-report
200261
path: htmlcov
201262
if: ${{ failure() }}
202263

203264
docs:
265+
needs: pre_job
266+
if: needs.pre_job.outputs.should_skip != 'true'
204267
permissions:
205268
contents: write
206269
uses: ./.github/workflows/docs.yml
207270
with:
208271
deploy: false
209272

210-
pinact:
211-
name: Pin actions
212-
runs-on: ubuntu-latest
213-
permissions:
214-
contents: write
215-
steps:
216-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
217-
with:
218-
persist-credentials: false
219-
220-
- name: Pin actions
221-
uses: suzuki-shunsuke/pinact-action@1081f5ad49ac904b7d977784f338145150a32112 # v1.4.0
222-
with:
223-
skip_push: "true"
224-
225273
# Ensure everything required is passing for branch protection.
226274
required-checks-pass:
227275
if: always()
228276
needs:
277+
- pre_job
229278
- lint
279+
- pinact
230280
- typecheck
231281
- test
232282
- coverage
233-
- pinact
234283
- docs
235284
runs-on: ubuntu-latest
236285
steps:
237286
- name: Decide whether the needed jobs succeeded or failed
238287
uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # v1.2.2
239288
with:
289+
allowed-skips: "lint,pinact,typecheck,test,coverage,docs"
240290
jobs: ${{ toJSON(needs) }}

.github/workflows/copier-update.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ jobs:
1515
update:
1616
name: Update template
1717
runs-on: ubuntu-latest
18+
environment:
19+
name: pull-request
1820
strategy:
1921
fail-fast: true
2022
matrix:

.pre-commit-config.yaml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,13 @@ repos:
6969
- id: taplo-lint
7070
args: ["--no-schema"]
7171
- repo: https://github.com/tox-dev/pyproject-fmt
72-
rev: v2.16.2
72+
rev: v2.18.1
7373
hooks:
7474
- id: pyproject-fmt
7575
files: ^pyproject\.toml$
7676
# ** validate (schema-store)
7777
- repo: https://github.com/henryiii/validate-pyproject-schema-store
78-
rev: 2026.03.02
78+
rev: 2026.03.10
7979
hooks:
8080
- id: validate-pyproject
8181
name: validate-pyproject-schema-store
@@ -109,7 +109,7 @@ repos:
109109

110110
# * Linting
111111
- repo: https://github.com/astral-sh/ruff-pre-commit
112-
rev: v0.15.4
112+
rev: v0.15.5
113113
hooks:
114114
- id: ruff-check
115115
alias: ruff
@@ -129,12 +129,10 @@ repos:
129129
- "--command"
130130
- "ruff format"
131131
additional_dependencies:
132-
- ruff==0.15.4
132+
- ruff==0.15.5
133133

134134
# * Spelling
135135
# ** typos
136-
# Revert to crate-ci/typos if https://github.com/crate-ci/typos/issues/390 is fixed.
137-
# - repo: https://github.com/crate-ci/typos
138136
- repo: https://github.com/adhtruong/mirrors-typos
139137
rev: v1.44.0
140138
hooks:
@@ -153,7 +151,7 @@ repos:
153151
- "--custom-command=prek run pyproject2conda-project --all-files"
154152
# ** uv
155153
- repo: https://github.com/astral-sh/uv-pre-commit
156-
rev: 0.10.7
154+
rev: 0.10.9
157155
hooks:
158156
- id: uv-lock
159157
alias: requirements
@@ -213,7 +211,7 @@ repos:
213211
priority: 0
214212
- repo: https://github.com/zizmorcore/zizmor-pre-commit
215213
# Zizmor version.
216-
rev: v1.22.0
214+
rev: v1.23.1
217215
hooks:
218216
# Run the linter.
219217
- id: zizmor

pyproject.toml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ test-extras = [
103103
typecheck-runner = [ "typecheck-runner>=0.1.0; python_version>'3.9'" ]
104104

105105
# * uv -------------------------------------------------------------------------
106-
107106
[tool.uv]
108107
required-version = ">=0.7.15"
109108
default-groups = [ "dev" ]
@@ -125,7 +124,6 @@ mypy.requires-python = ">=3.14"
125124
nox.requires-python = ">=3.14"
126125

127126
# * Checks ---------------------------------------------------------------------
128-
129127
[tool.repo-review]
130128
ignore = [
131129
"NOX103", # I prefer using "nox.options.sessions"
@@ -156,11 +154,18 @@ expand_tables = [
156154
indent = 4
157155
keep_full_version = true
158156

157+
[tool.typos.default]
158+
# nbqa generated
159+
extend-ignore-re = [ "# %%NBQA-.*" ]
160+
159161
[tool.typos.default.extend-identifiers]
160162
CPY = "CPY"
161163

162-
# * Testing --------------------------------------------------------------------
164+
[tool.typos.type.jupyter]
165+
# only check file name for notebooks. Use nbaq for contents.
166+
check-file = false
163167

168+
# * Testing --------------------------------------------------------------------
164169
[tool.pytest.ini_options]
165170
addopts = [
166171
"--cov-config=pyproject.toml",
@@ -185,10 +190,15 @@ strict_xfail = "true"
185190

186191
[tool.coverage]
187192
run.branch = true
193+
run.source = [
194+
"pyproject2conda",
195+
]
188196
paths.source = [
189197
"src/",
190198
# needed for testing source if not editable install
191199
".nox/**/site-packages/",
200+
"*/.nox/**/site-packages",
201+
"*/src",
192202
]
193203
report.exclude_also = [
194204
"@overload",
@@ -205,7 +215,6 @@ report.omit = [
205215
report.show_missing = true
206216

207217
# * typecheck ---------------------------------------------------------------------
208-
209218
[tool.mypy]
210219
exclude = [
211220
".eggs",
@@ -300,7 +309,6 @@ inputs = [
300309
]
301310

302311
# * Dependency creation --------------------------------------------------------
303-
304312
[tool.pyproject2conda]
305313
user-config = "config/userconfig.toml"
306314
template-python = "requirements/py{py}-{env}"
@@ -359,7 +367,6 @@ skip-package = true
359367
style = "requirements"
360368

361369
# * Other tools ----------------------------------------------------------------
362-
363370
[tool.scriv]
364371
format = "md"
365372
md_header_level = "2"

0 commit comments

Comments
 (0)