Skip to content

Commit 9e70805

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 9e70805

31 files changed

Lines changed: 593 additions & 520 deletions

‎.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/apt/debsource.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class Debsrc:
2121
Apache License, Version 2.0
2222
"""
2323

24-
def __init__(self, deb_source, deb_version):
24+
def __init__(self, deb_source: str, deb_version: str):
2525
"""
2626
Constructor __init__(Debsrc)
2727
@@ -31,8 +31,8 @@ def __init__(self, deb_source, deb_version):
3131
:since: 0.7.0
3232
"""
3333

34-
self.deb_source: str = deb_source
35-
self.deb_version: str = deb_version
34+
self.deb_source = deb_source
35+
self.deb_version = deb_version
3636

3737
def __repr__(self) -> str:
3838
"""

‎src/gardenlinux/apt/package_repo_info.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from apt_repo import APTRepository
1010

1111

12-
class GardenLinuxRepo(APTRepository):
12+
class GardenLinuxRepo(APTRepository): # type: ignore[misc]
1313
"""
1414
Class to reflect APT based GardenLinux repositories.
1515

‎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,

0 commit comments

Comments
 (0)