Skip to content

Commit e65fce3

Browse files
committed
Merge branch 'main' into create-github-release
2 parents da81f24 + 5f375b7 commit e65fce3

36 files changed

+301
-178
lines changed

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ format: install-dev
6363

6464
lint: install-dev
6565
$(POETRY) run black --diff --extend-exclude test-data/gardenlinux .
66+
$(POETRY) run isort --check-only .
67+
$(POETRY) run pyright
6668

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

poetry.lock

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

pyproject.toml

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description = "Contains tools to work with the features directory of gardenlinux
55
authors = ["Garden Linux Maintainers <[email protected]>"]
66
license = "Apache-2.0"
77
readme = "README.md"
8-
packages = [{include = "gardenlinux", from="src"}]
8+
packages = [{ include = "gardenlinux", from = "src" }]
99

1010
[tool.poetry.dependencies]
1111
python = "^3.13"
@@ -29,6 +29,7 @@ pytest = "^8.4.1"
2929
pytest-cov = "^7.0.0"
3030
isort = "^6.0.1"
3131
requests-mock = "^1.12.1"
32+
pyright = "^1.1.403"
3233

3334
[tool.poetry.group.docs.dependencies]
3435
sphinx-rtd-theme = "^3.0.2"
@@ -44,13 +45,29 @@ gl-s3 = "gardenlinux.s3.__main__:main"
4445
pythonpath = ["src"]
4546
norecursedirs = "test-data"
4647

48+
[tool.isort]
49+
profile = "black"
50+
line_length = 120
51+
known_first_party = ["gardenlinux"]
52+
skip = ["test-data", ".venv", "**/__pycache", ".pytest-cache", "hack"]
53+
54+
[tool.pyright]
55+
typeCheckingMode = "strict"
56+
venvPath = "."
57+
venv = ".venv"
58+
exclude = [
59+
"test-data",
60+
"docs",
61+
"hack",
62+
".venv",
63+
".pytest-cache",
64+
"**/__pycache",
65+
]
66+
4767
[tool.bandit]
4868
skips = ["B101", "B404"] # allow asserts, subprocesses
4969
exclude_dirs = ["tests"]
5070

51-
[tool.isort]
52-
known_first_party = "gardenlinux"
53-
5471
[build-system]
5572
requires = ["poetry-core"]
5673
build-backend = "poetry.core.masonry.api"

pyrightconfig.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
// Pyright is configured in 'strict' mode in pyproject.toml
3+
// This file overrides some reports and tones them down to warnings, if they are not critical.
4+
// It also turns some up to become warnings or errors.
5+
"reportShadowedImports": "warning",
6+
"reportImportCycles": "error",
7+
"reportOptionalMemberAccess": "warning",
8+
"reportOptionalSubscript": "warning",
9+
"reportOptionalContextManager": "warning",
10+
"reportOptionalCall": "warning",
11+
"reportUnusedVariable": "warning",
12+
"reportUnusedImport": "warning",
13+
"reportUnusedFunction": "warning",
14+
"reportUnusedCallResult": "none",
15+
"reportUnusedClass": "warning",
16+
"reportUnnecessaryCast": "warning",
17+
"reportUnnecessaryComparison": "warning",
18+
"reportUnnecessaryIsInstance": "warning",
19+
"reportUnnecessaryContains": "warning",
20+
// Becomes useful after introduction of type annotations
21+
// "reportUnknownMemberType": "warning",
22+
// "reportUnknownParameterType": "warning",
23+
// "reportUnknownArgumentType": "warning",
24+
// "reportUnknownVariableType": "warning",
25+
"reportTypedDictNotRequiredAccess": "error",
26+
"reportDeprecated": "warning",
27+
}

src/gardenlinux/apt/package_repo_info.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
APT repositories
55
"""
66

7-
from apt_repo import APTRepository
87
from typing import Optional
98

9+
from apt_repo import APTRepository
10+
1011

1112
class GardenLinuxRepo(APTRepository):
1213
"""

src/gardenlinux/features/__main__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
from .cname import CName
1818
from .parser import Parser
1919

20-
2120
_ARGS_TYPE_ALLOWED = [
2221
"cname",
2322
"cname_base",

src/gardenlinux/features/cname.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@
44
Canonical name (cname)
55
"""
66

7-
from typing import Optional
87
import re
8+
from typing import Optional
99

1010
from ..constants import ARCHS
11-
1211
from .parser import Parser
1312

1413

src/gardenlinux/features/cname_main.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,20 @@
55
gl-cname main entrypoint
66
"""
77

8-
from functools import reduce
9-
from os.path import basename, dirname
108
import argparse
119
import logging
1210
import re
13-
14-
from .cname import CName
15-
from .parser import Parser
11+
from functools import reduce
12+
from os.path import basename, dirname
1613

1714
from .__main__ import (
1815
get_cname_base,
1916
get_minimal_feature_set,
2017
get_version_and_commit_id_from_files,
2118
sort_subset,
2219
)
20+
from .cname import CName
21+
from .parser import Parser
2322

2423

2524
def main():

src/gardenlinux/features/parser.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@
44
Features parser based on networkx.Digraph
55
"""
66

7-
from glob import glob
8-
from typing import Callable, Optional
97
import logging
10-
import networkx
118
import os
129
import re
1310
import subprocess
11+
from glob import glob
12+
from typing import Callable, Optional
13+
14+
import networkx
1415
import yaml
1516

1617
from ..constants import (
1718
ARCHS,
1819
BARE_FLAVOR_FEATURE_CONTENT,
1920
BARE_FLAVOR_LIBC_FEATURE_CONTENT,
2021
)
21-
2222
from ..logger import LoggerSetup
2323

2424

src/gardenlinux/flavors/__main__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@
55
gl-flavors-parse main entrypoint
66
"""
77

8-
from argparse import ArgumentParser
9-
from pathlib import Path
10-
from tempfile import TemporaryDirectory
118
import json
129
import os
1310
import sys
11+
from argparse import ArgumentParser
12+
from pathlib import Path
13+
from tempfile import TemporaryDirectory
1414

15-
from .parser import Parser
1615
from ..constants import GL_REPOSITORY_URL
1716
from ..git import Repository
17+
from .parser import Parser
1818

1919

2020
def _get_flavors_file_data(flavors_file):

0 commit comments

Comments
 (0)