From aaaf1cc61d3f871b692850c8c8b602bd76610271 Mon Sep 17 00:00:00 2001 From: Oliver Kurz Date: Wed, 3 Dec 2025 13:00:08 +0100 Subject: [PATCH 1/4] feat(pyproject.toml): Add dependencies for more checks --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 32c661e3..982ba0e1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,6 +27,7 @@ packages = [] [project.optional-dependencies] dev = [ + "ty", "pytest", "pytest-cov", "pytest-mock", From 76f1ea14696a151287ae313be90a2a90486ab998 Mon Sep 17 00:00:00 2001 From: Oliver Kurz Date: Sun, 30 Nov 2025 22:15:36 +0100 Subject: [PATCH 2/4] feat(Makefile): Add Python "tidy" and "test-with-coverage" --- Makefile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 0b77034e..73745169 100644 --- a/Makefile +++ b/Makefile @@ -34,6 +34,7 @@ test-unit: test-bash test-python test-bash: $(BPAN) "${PROVE}" -r $(if $v,-v )$(test) +.PHONY: test-python test-python: py.test tests @@ -58,8 +59,10 @@ test-yaml: @which yamllint >/dev/null 2>&1 || echo "Command 'yamllint' not found, can not execute YAML syntax checks" yamllint --strict $$(git ls-files "*.yml" "*.yaml" ":!external/") +.PHONY: checkstyle-python checkstyle-python: check-ruff check-conventions check-ty check-ruff: + @which ruff >/dev/null 2>&1 || echo "Command 'ruff' not found, can not execute python style checks" @if [ -n "$(PY_FILES)" ]; then ruff format --check $(PY_FILES) && ruff check $(PY_FILES); fi @@ -85,11 +88,14 @@ test-gitlint: ## Run commit message checks using gitlint BASE=$$(git merge-base --independent $$BASES | head -n 1); \ gitlint --commits "$$BASE..HEAD" +.PHONY: test-with-coverage +test-with-coverage: + pytest --cov=src/os-autoinst-scripts tests/ + .PHONY: tidy tidy: ## Format code and fix linting issues ruff format $(PY_FILES) ruff check --fix $(PY_FILES) - update-deps: tools/update-deps --cpanfile cpanfile --specfile dist/rpm/os-autoinst-scripts-deps.spec From d968e8ca44a1500036b86b368758c8a5d1049a72 Mon Sep 17 00:00:00 2001 From: Oliver Kurz Date: Wed, 3 Dec 2025 12:59:55 +0100 Subject: [PATCH 3/4] feat(pyproject.toml): Add config for proper python package paths --- pyproject.toml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 982ba0e1..2e600f83 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -51,6 +51,13 @@ fail_under = 100 show_missing = true skip_covered = true +[tool.setuptools] +include-package-data = true +zip-safe = false + +[tool.setuptools.packages] +find = {} + [tool.ruff] line-length = 120 preview = true @@ -160,3 +167,9 @@ unresolved-import = "ignore" [tool.ty.terminal] error-on-warning = true + +[tool.pyright] +include = ["src", "tests", "*.py"] + +[tool.pytest.ini_options] +pythonpath = "src" From 1bbda3ac8b2f4dda7be9d8e2f0bc354a5a0445d3 Mon Sep 17 00:00:00 2001 From: Oliver Kurz Date: Wed, 3 Dec 2025 14:44:20 +0100 Subject: [PATCH 4/4] feat(ci): Simplify deps setup with uv --- .github/workflows/ci.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 78d641b0..b4ad679a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ jobs: - uses: astral-sh/setup-uv@v7 with: enable-cache: true - - name: Setup enviroment + - name: Setup environment run: uv sync --extra dev - run: | sudo apt-get install cpanminus html-xml-utils xmlstarlet @@ -36,8 +36,9 @@ jobs: - uses: astral-sh/setup-uv@v7 with: enable-cache: true + - name: Setup environment + run: uv sync --extra dev - name: Static checks run: | git config --global --add safe.directory . - uv sync --extra dev uv run make checkstyle