Skip to content

Commit 67604c9

Browse files
committed
Replace pyright with pre-commit
Signed-off-by: Tobias Wolf <wolf@b1-systems.de> On-behalf-of: SAP <tobias.wolf@sap.com>
1 parent b68187e commit 67604c9

23 files changed

+500
-448
lines changed

.pre-commit-config.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
repos:
2+
- repo: https://github.com/astral-sh/ruff-pre-commit
3+
rev: v0.14.5
4+
hooks:
5+
- id: ruff
6+
args: [ --fix ]
7+
- id: ruff-format
8+
- repo: https://github.com/pre-commit/pre-commit-hooks
9+
rev: v6.0.0
10+
hooks:
11+
- id: check-yaml
12+
args: [ --allow-multiple-documents ]
13+
- id: check-json
14+
- id: check-toml
15+
- id: check-merge-conflict
16+
- id: mixed-line-ending
17+
- id: end-of-file-fixer
18+
- id: trailing-whitespace
19+
- repo: https://github.com/pre-commit/mirrors-mypy
20+
rev: 'v1.18.2'
21+
hooks:
22+
- id: mypy
23+
args: [--strict, --ignore-missing-imports, --check-untyped-defs]
24+
additional_dependencies:
25+
- types-PyYAML

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ lint: install-dev
7474
$(POETRY) run isort --check-only .
7575
@echo
7676
@echo "------------------------------------------------------------------------------------------------------------------------"
77-
@echo "--// PYRIGHT //---------------------------------------------------------------------------------------------------------"
77+
@echo "--// PRE-COMMIT //------------------------------------------------------------------------------------------------------"
7878
@echo "------------------------------------------------------------------------------------------------------------------------"
79-
$(POETRY) run pyright
79+
$(POETRY) run pre-commit run --all-files
8080

8181
security: install-dev
8282
@if [ "$(CI)" = "true" ]; then \

docs/index.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,3 @@ Indices and tables
2626
* :ref:`genindex`
2727
* :ref:`modindex`
2828
* :ref:`search`
29-

hack/print_feature_extensions.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33

44
search_and_print_directories() {
55
local pattern="$1"
6-
local base_pattern="${pattern%%.*}"
7-
6+
local base_pattern="${pattern%%.*}"
7+
88
while IFS= read -r file; do
99
dir=$(dirname "$file" | sed 's|^\./||')
10-
10+
1111
suffix="${file##*/}"
12-
suffix="${suffix#"$base_pattern"}"
13-
12+
suffix="${suffix#"$base_pattern"}"
13+
1414
echo "('$dir', '$suffix'),"
1515
done < <(find . -type f -name "$pattern" | sort -u)
1616
}

poetry.lock

Lines changed: 360 additions & 298 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ packages = [{ include = "gardenlinux", from = "src" }]
1010
[tool.poetry.dependencies]
1111
python = ">=3.13"
1212
apt-repo = "^0.5"
13-
boto3 = "^1.40.57"
14-
click = "^8.2.1"
15-
cryptography = "^46.0.1"
13+
boto3 = "^1.40.74"
14+
click = "^8.3.1"
15+
cryptography = "^46.0.3"
1616
jsonschema = "^4.25.1"
1717
networkx = "^3.5"
1818
oras = "^0.2.38"
@@ -23,14 +23,14 @@ gitpython = "^3.1.45"
2323

2424
[tool.poetry.group.dev.dependencies]
2525
bandit = "^1.8.6"
26-
black = "^25.1.0"
27-
moto = "^5.1.12"
28-
python-dotenv = "^1.1.1"
26+
black = "^25.11.0"
27+
moto = "^5.1.16"
28+
pre-commit = "^4.4.0"
29+
python-dotenv = "^1.2.1"
2930
pytest = "^8.4.1"
3031
pytest-cov = "^7.0.0"
3132
isort = "^7.0.0"
3233
requests-mock = "^1.12.1"
33-
pyright = "^1.1.403"
3434

3535
[tool.poetry.group.docs.dependencies]
3636
sphinx-rtd-theme = "^3.0.2"
@@ -53,19 +53,6 @@ line_length = 120
5353
known_first_party = ["gardenlinux"]
5454
skip = ["test-data", ".venv", "**/__pycache", ".pytest-cache", "hack"]
5555

56-
[tool.pyright]
57-
typeCheckingMode = "strict"
58-
venvPath = "."
59-
venv = ".venv"
60-
exclude = [
61-
"test-data",
62-
"docs",
63-
"hack",
64-
".venv",
65-
".pytest-cache",
66-
"**/__pycache",
67-
]
68-
6956
[tool.bandit]
7057
skips = ["B101", "B404"] # allow asserts, subprocesses
7158
exclude_dirs = ["tests"]

pyrightconfig.json

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

src/gardenlinux/features/cname.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from configparser import UNNAMED_SECTION, ConfigParser
99
from os import PathLike, environ
1010
from pathlib import Path
11-
from typing import List, Optional
11+
from typing import Optional
1212

1313
from ..constants import (
1414
ARCHS,

src/gardenlinux/oci/container.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -283,15 +283,15 @@ def push_index_from_directory(
283283

284284
if manifest["digest"] == existing_manifest["digest"]:
285285
self._logger.debug(
286-
f"Skipping manifest with digest {manifest["digest"]} - already exists"
286+
f"Skipping manifest with digest {manifest['digest']} - already exists"
287287
)
288288

289289
continue
290290

291291
index.append_manifest(manifest)
292292

293293
self._logger.info(
294-
f"Index appended locally {manifest["annotations"]["cname"]}"
294+
f"Index appended locally {manifest['annotations']['cname']}"
295295
)
296296

297297
new_entries += 1
@@ -440,7 +440,7 @@ def push_manifest_and_artifacts(
440440
)
441441

442442
self._logger.info(
443-
f"Pushed {artifact["file_name"]}: {layer_dict["digest"]}"
443+
f"Pushed {artifact['file_name']}: {layer_dict['digest']}"
444444
)
445445
finally:
446446
if cleanup_blob and file_path_name.exists():

src/gardenlinux/oci/index.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from .schemas import EmptyIndex
77

88

9-
class Index(dict):
9+
class Index(dict): # type: ignore[type-arg]
1010
"""
1111
OCI image index
1212

0 commit comments

Comments
 (0)