From 7e7d4f478797331319c57121e3f10f9444aa2525 Mon Sep 17 00:00:00 2001 From: Marcel Jacek Date: Thu, 10 Apr 2025 16:28:35 +0200 Subject: [PATCH 1/2] fix(python): set max version for black linter in pyproject.toml --- .github/workflows/ci.yaml | 2 +- templates/python/pyproject.mustache | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 99fd7fd..50a7257 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -105,7 +105,7 @@ jobs: - name: Install sdk working-directory: ./sdk-repo-updated run: | - pip install poetry==1.8.5 + pip install poetry poetry config virtualenvs.create false python -m venv .venv . .venv/bin/activate diff --git a/templates/python/pyproject.mustache b/templates/python/pyproject.mustache index 589a361..f59a5d5 100644 --- a/templates/python/pyproject.mustache +++ b/templates/python/pyproject.mustache @@ -27,7 +27,7 @@ pydantic = ">=2.9.2" python-dateutil = ">=2.9.0.post0" [tool.poetry.group.dev.dependencies] -black = ">=24.8.0" +black = "<25.0.0" # Upgrading to a newer version requires bigger changes in the python generator. The formatting style in black has changed. pytest = ">=8.3.3" flake8 = [ { version= ">=5.0.3", python="<3.12"}, From 4d49e48ab41eae09658e2b22e8b96321cdf84e67 Mon Sep 17 00:00:00 2001 From: Marcel Jacek Date: Fri, 11 Apr 2025 13:41:28 +0200 Subject: [PATCH 2/2] fix: exclude generated code for linter --- .github/workflows/sdk-pr.yaml | 2 +- templates/python/pyproject.mustache | 15 +++------------ 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/.github/workflows/sdk-pr.yaml b/.github/workflows/sdk-pr.yaml index 858c513..7ce266a 100644 --- a/.github/workflows/sdk-pr.yaml +++ b/.github/workflows/sdk-pr.yaml @@ -74,7 +74,7 @@ jobs: python -m venv .venv . .venv/bin/activate python -m pip install --upgrade pip - pip install poetry==1.8.5 + pip install poetry poetry config virtualenvs.create false (cd ./sdk-repo-updated && make install-dev) scripts/sdk-create-pr.sh "generator-bot-${{ github.run_id }}" "Generated from GitHub run [${{ github.run_id }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})" "git@github.com:stackitcloud/stackit-sdk-python.git" "python" diff --git a/templates/python/pyproject.mustache b/templates/python/pyproject.mustache index f59a5d5..80c6621 100644 --- a/templates/python/pyproject.mustache +++ b/templates/python/pyproject.mustache @@ -27,7 +27,7 @@ pydantic = ">=2.9.2" python-dateutil = ">=2.9.0.post0" [tool.poetry.group.dev.dependencies] -black = "<25.0.0" # Upgrading to a newer version requires bigger changes in the python generator. The formatting style in black has changed. +black = ">=24.8.0" pytest = ">=8.3.3" flake8 = [ { version= ">=5.0.3", python="<3.12"}, @@ -95,14 +95,5 @@ inline-quotes = '"' docstring-quotes = '"""' multiline-quotes = '"""' ban-relative-imports = true -per-file-ignores = """ - # asserts are fine in tests, tests shouldn't be build optimized - ./tests/*: S101, - # F841: some variables get generated but may not be used, depending on the api-spec - # E501: long descriptions/string values might lead to lines that are too long - ./src/stackit/*/models/*: F841,E501 - # F841: some variables get generated but may not be used, depending on the api-spec - # E501: long descriptions/string values might lead to lines that are too long - # B028: stacklevel for deprecation warning is irrelevant - ./src/stackit/*/api/default_api.py: F841,B028,E501 -""" \ No newline at end of file +# Exclude generated code +extend-exclude = [ "src/stackit/*/models/*", "src/stackit/*/api/*", "src/stackit/*/*.py" ] \ No newline at end of file