8000 Add type annotations for spin utils · scientific-python/spin@f3861bc · GitHub
[go: up one dir, main page]

Skip to content

Commit f3861bc

Browse files
committed
Add type annotations for spin utils
With this in place, we can progressively add more type annotations. Closes #177
1 parent 0157ef5 commit f3861bc

File tree

5 files changed

+18
-4
lines changed

5 files changed

+18
-4
lines changed

.pre-commit-config.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,8 @@ repos:
4040
hooks:
4141
- id: ruff
4242
args: [--fix, --exit-non-zero-on-fix]
43+
44+
- repo: https://github.com/pre-commit/mirrors-mypy
45+
rev: e5ea6670624c24f8321f6328ef3176dbba76db46 # forzen: v1.10.0
46+
hooks:
47+
- id: mypy

example_pkg/doc/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# -- General configuration ---------------------------------------------------
1414
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
1515

16-
extensions = []
16+
extensions: list[str] = []
1717

1818
templates_path = ["_templates"]
1919
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ filterwarnings = [
5454
[tool.ruff]
5555
line-length = 88
5656
target-version = "py38"
57+
58+
[tool.ruff.lint]
5759
select = [
5860
"C",
5961
"E",

spin/cmds/meson.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ def _get_configured_command(command_name):
361361
)
362362
@click.option(
363363
"--gcov-format",
364-
type=click.Choice(GcovReportFormat),
364+
type=click.Choice([e.name for e in GcovReportFormat]),
365365
default="html",
366366
help=f"Format of the gcov report. Can be one of {', '.join(e.value for e in GcovReportFormat)}.",
367367
)

spin/cmds/util.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,15 @@
77

88

99
def run(
10-
cmd, cwd=None, replace=False, sys_exit=True, output=True, echo=True, *args, **kwargs
11-
):
10+
cmd: list[str],
11+
cwd: str | None = None,
12+
replace: bool = False,
13+
sys_exit: bool = True,
14+
output: bool = True,
15+
echo: bool = True,
16+
*args,
17+
**kwargs,
18+
) -> subprocess.CompletedProcess:
1219
"""Run a shell command.
1320
1421
Parameters

0 commit comments

Comments
 (0)
0