Skip to content

Commit a047a68

Browse files
committed
cruft and poetry update
1 parent 9036509 commit a047a68

File tree

7 files changed

+888
-687
lines changed

7 files changed

+888
-687
lines changed

.cruft.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"template": "https://github.com/statisticsnorway/ssb-pypitemplate.git",
3-
"commit": "9e3c49f6680d4c400567c39d70b768f0a322c95e",
4-
"checkout": "2025.7.18",
3+
"commit": "1b94f545381a9ce08e205e7451d7a4f07eaef142",
4+
"checkout": null,
55
"context": {
66
"cookiecutter": {
77
"project_name": "ssb-vaskify",
@@ -26,7 +26,7 @@
2626
"trim_blocks": true
2727
},
2828
"_template": "https://github.com/statisticsnorway/ssb-pypitemplate.git",
29-
"_commit": "9e3c49f6680d4c400567c39d70b768f0a322c95e"
29+
"_commit": "1b94f545381a9ce08e205e7451d7a4f07eaef142"
3030
}
3131
},
3232
"directory": null

.darglint

Lines changed: 0 additions & 2 deletions
This file was deleted.

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ jobs:
8989
subprocess.run(cmd, shell=True)
9090
9191
- name: Restore pre-commit cache
92-
uses: actions/cache@v4
92+
uses: actions/cache@v5
9393
if: matrix.session == 'pre-commit'
9494
with:
9595
path: ~/.cache/pre-commit

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ repos:
5757
entry: check-ast
5858
language: system
5959
types: [python]
60-
- id: darglint
61-
name: darglint
62-
entry: darglint
60+
- id: pydoclint
61+
name: pydoclint
62+
entry: pydoclint
6363
language: system
6464
types: [python]
6565
- id: ruff

noxfile.py

Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import shlex
55
import shutil
66
import sys
7+
import tempfile
78
from pathlib import Path
89
from textwrap import dedent
910

@@ -25,7 +26,7 @@
2526
package = "vaskify"
2627
python_versions = ["3.11", "3.12", "3.13"]
2728
python_versions_for_test = python_versions + ["3.10"]
28-
nox.needs_version = ">= 2021.6.6"
29+
nox.needs_version = ">= 2025.2.9"
2930
nox.options.sessions = (
3031
"pre-commit",
3132
"mypy",
@@ -36,6 +37,26 @@
3637
)
3738

3839

40+
def install_poetry_groups(session: Session, *groups: str) -> None:
41+
"""Install dependencies from poetry groups, pinned to poetry.lock
42+
43+
Using this as a workaround until this PR is merged in:
44+
https://github.com/cjolowicz/nox-poetry/pull/1080
45+
"""
46+
with tempfile.TemporaryDirectory() as tempdir:
47+
requirements_path = os.path.join(tempdir, "requirements.txt")
48+
session.run(
49+
"poetry",
50+
"export",
51+
*[f"--only={group}" for group in groups],
52+
"--format=requirements.txt",
53+
"--without-hashes",
54+
f"--output={requirements_path}",
55+
external=True,
56+
)
57+
session.install("-r", requirements_path)
58+
59+
3960
def activate_virtualenv_in_precommit_hooks(session: Session) -> None:
4061
"""Activate virtualenv in hooks installed by pre-commit.
4162
@@ -128,13 +149,7 @@ def precommit(session: Session) -> None:
128149
"--hook-stage=manual",
129150
"--show-diff-on-failure",
130151
]
131-
session.install(
132-
"pre-commit",
133-
"pre-commit-hooks",
134-
"darglint",
135-
"ruff",
136-
"black",
137-
)
152+
install_poetry_groups(session, "lint")
138153
session.run("pre-commit", *args)
139154
if args and args[0] == "install":
140155
activate_virtualenv_in_precommit_hooks(session)
@@ -145,7 +160,7 @@ def mypy(session: Session) -> None:
145160
"""Type-check using mypy."""
146161
args = session.posargs or ["src", "tests"]
147162
session.install(".")
148-
session.install("mypy", "pytest")
163+
install_poetry_groups(session, "dev")
149164
session.run("mypy", *args)
150165
if not session.posargs:
151166
session.run("mypy", f"--python-executable={sys.executable}", "noxfile.py")
@@ -155,7 +170,7 @@ def mypy(session: Session) -> None:
155170
def tests(session: Session) -> None:
156171
"""Run the test suite."""
157172
session.install(".")
158-
session.install("coverage[toml]", "pytest", "pygments")
173+
install_poetry_groups(session, "dev")
159174
try:
160175
session.run(
161176
"coverage",
@@ -176,9 +191,7 @@ def tests(session: Session) -> None:
176191
def coverage(session: Session) -> None:
177192
"""Produce the coverage report."""
178193
args = session.posargs or ["report", "--skip-empty"]
179-
180-
session.install("coverage[toml]")
181-
194+
install_poetry_groups(session, "dev")
182195
if not session.posargs and any(Path().glob(".coverage.*")):
183196
session.run("coverage", "combine")
184197

@@ -189,7 +202,7 @@ def coverage(session: Session) -> None:
189202
def typeguard(session: Session) -> None:
190203
"""Runtime type checking using Typeguard."""
191204
session.install(".")
192-
session.install("pytest", "typeguard", "pygments")
205+
install_poetry_groups(session, "dev")
193206
session.run("pytest", f"--typeguard-packages={package}", *session.posargs)
194207

195208

@@ -204,7 +217,7 @@ def xdoctest(session: Session) -> None:
204217
args.append("--colored=1")
205218

206219
session.install(".")
207-
session.install("xdoctest[colors]")
220+
install_poetry_groups(session, "dev")
208221
session.run("python", "-m", "xdoctest", *args)
209222

210223

@@ -216,9 +229,7 @@ def docs_build(session: Session) -> None:
216229
args.insert(0, "--color")
217230

218231
session.install(".")
219-
session.install(
220-
"sphinx", "sphinx-autodoc-typehints", "sphinx-click", "furo", "myst-parser"
221-
)
232+
install_poetry_groups(session, "doc")
222233

223234
build_dir = Path("docs", "_build")
224235
if build_dir.exists():
@@ -232,14 +243,7 @@ def docs(session: Session) -> None:
232243
"""Build and serve the documentation with live reloading on file changes."""
233244
args = session.posargs or ["--open-browser", "docs", "docs/_build"]
234245
session.install(".")
235-
session.install(
236-
"sphinx",
237-
"sphinx-autobuild",
238-
"sphinx-autodoc-typehints",
239-
"sphinx-click",
240-
"furo",
241-
"myst-parser",
242-
)
246+
install_poetry_groups(session, "doc")
243247

244248
build_dir = Path("docs", "_build")
245249
if build_dir.exists():

0 commit comments

Comments
 (0)