From 78f26faebe74f4e20b860d21e09bf093e33c734c Mon Sep 17 00:00:00 2001 From: Jakub Kadlcik Date: Sun, 4 Aug 2024 12:18:04 +0200 Subject: [PATCH 01/35] github: add mypy workflow This will run mypy only on changed files --- .github/workflows/mypy.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/mypy.yml diff --git a/.github/workflows/mypy.yml b/.github/workflows/mypy.yml new file mode 100644 index 000000000..ed8d2101a --- /dev/null +++ b/.github/workflows/mypy.yml @@ -0,0 +1,23 @@ +name: "mypy check" +on: [pull_request] + +jobs: + + static-type-check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v3 + with: + python-version: '3.x' + - run: pip install mypy + - name: Get Python changed files + id: changed-py-files + uses: tj-actions/changed-files@v23 + with: + files: | + *.py + **/*.py + - name: Run if any of the listed files above is changed + if: steps.changed-py-files.outputs.any_changed == 'true' + run: mypy ${{ steps.changed-py-files.outputs.all_changed_files }} From 2f74938998e954a2df625a4df1d8cf8d128ee2bb Mon Sep 17 00:00:00 2001 From: Jakub Kadlcik Date: Sun, 4 Aug 2024 12:22:22 +0200 Subject: [PATCH 02/35] wip --- cli/copr_cli/main.py | 1 + 1 file changed, 1 insertion(+) diff --git a/cli/copr_cli/main.py b/cli/copr_cli/main.py index 1a070a5aa..6c3451a56 100644 --- a/cli/copr_cli/main.py +++ b/cli/copr_cli/main.py @@ -62,6 +62,7 @@ None: "default", } +# foo try: input = raw_input except NameError: From 46888d666d67d7a14a80ecf9d0c88cad333e541d Mon Sep 17 00:00:00 2001 From: Jakub Kadlcik Date: Sun, 4 Aug 2024 12:27:29 +0200 Subject: [PATCH 03/35] wip --- .github/workflows/mypy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/mypy.yml b/.github/workflows/mypy.yml index ed8d2101a..0bf250b9c 100644 --- a/.github/workflows/mypy.yml +++ b/.github/workflows/mypy.yml @@ -20,4 +20,4 @@ jobs: **/*.py - name: Run if any of the listed files above is changed if: steps.changed-py-files.outputs.any_changed == 'true' - run: mypy ${{ steps.changed-py-files.outputs.all_changed_files }} + run: mypy ${{ steps.changed-py-files.outputs.all_changed_files}} --install-types From 1f55a49371ad86bc5f868be518a2d012a92f3ebf Mon Sep 17 00:00:00 2001 From: Jakub Kadlcik Date: Sun, 4 Aug 2024 12:27:59 +0200 Subject: [PATCH 04/35] wip --- .github/workflows/mypy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/mypy.yml b/.github/workflows/mypy.yml index 0bf250b9c..674c9f771 100644 --- a/.github/workflows/mypy.yml +++ b/.github/workflows/mypy.yml @@ -20,4 +20,4 @@ jobs: **/*.py - name: Run if any of the listed files above is changed if: steps.changed-py-files.outputs.any_changed == 'true' - run: mypy ${{ steps.changed-py-files.outputs.all_changed_files}} --install-types + run: mypy ${{ steps.changed-py-files.outputs.all_changed_files}} --install-types --non-interactive From 72bca8fdffb68019a3b094bb14d81a1d9fc0f7cc Mon Sep 17 00:00:00 2001 From: Jakub Kadlcik Date: Sun, 4 Aug 2024 12:32:22 +0200 Subject: [PATCH 05/35] wip --- .github/workflows/mypy-action.yml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .github/workflows/mypy-action.yml diff --git a/.github/workflows/mypy-action.yml b/.github/workflows/mypy-action.yml new file mode 100644 index 000000000..9ff4755a1 --- /dev/null +++ b/.github/workflows/mypy-action.yml @@ -0,0 +1,2 @@ +- name: Mypy action + uses: sasanquaneuf/mypy-github-action@releases/v1.3 From 2dd9214cda8b11f57de5eb9d96b767651a45004b Mon Sep 17 00:00:00 2001 From: Jakub Kadlcik Date: Sun, 4 Aug 2024 12:34:52 +0200 Subject: [PATCH 06/35] wip --- .github/workflows/mypy-action.yml | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/.github/workflows/mypy-action.yml b/.github/workflows/mypy-action.yml index 9ff4755a1..dbcf62b13 100644 --- a/.github/workflows/mypy-action.yml +++ b/.github/workflows/mypy-action.yml @@ -1,2 +1,26 @@ -- name: Mypy action - uses: sasanquaneuf/mypy-github-action@releases/v1.3 +name: Mypi action + +on: + push: + paths: + - '*.py' + +jobs: + mypy: + runs-on: ubuntu-latest + steps: + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: 3.7.4 + architecture: x64 + - name: Checkout + uses: actions/checkout@v3 + - name: Install mypy + run: pip install mypy + - name: Run mypy + uses: sasanquaneuf/mypy-github-action@releases/v1 + with: + checkName: 'mypy' # NOTE: this needs to be the same as the job name + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From f542e050cf78a29d2d9a3b8372431bb377fb08c6 Mon Sep 17 00:00:00 2001 From: Jakub Kadlcik Date: Sun, 4 Aug 2024 12:36:06 +0200 Subject: [PATCH 07/35] wip --- .github/workflows/mypy-action.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/mypy-action.yml b/.github/workflows/mypy-action.yml index dbcf62b13..9f0f36469 100644 --- a/.github/workflows/mypy-action.yml +++ b/.github/workflows/mypy-action.yml @@ -1,9 +1,10 @@ name: Mypi action -on: - push: - paths: - - '*.py' +on: [pull_request] +# on: + # push: + # paths: + # - '*.py' jobs: mypy: From 9ad5143df866dad05f81018e1fa90d12b8d8f72c Mon Sep 17 00:00:00 2001 From: Jakub Kadlcik Date: Sun, 4 Aug 2024 12:37:09 +0200 Subject: [PATCH 08/35] wip --- .github/workflows/mypy-action.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/mypy-action.yml b/.github/workflows/mypy-action.yml index 9f0f36469..52e9de65b 100644 --- a/.github/workflows/mypy-action.yml +++ b/.github/workflows/mypy-action.yml @@ -13,8 +13,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v4 with: - python-version: 3.7.4 - architecture: x64 + python-version: 3.x - name: Checkout uses: actions/checkout@v3 - name: Install mypy From 4ebddbe054921a41d28b7d30275de1a47c0fec24 Mon Sep 17 00:00:00 2001 From: Jakub Kadlcik Date: Sun, 4 Aug 2024 12:41:03 +0200 Subject: [PATCH 09/35] wip --- .github/workflows/mypy-action.yml | 33 ++++++++++++------------------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/.github/workflows/mypy-action.yml b/.github/workflows/mypy-action.yml index 52e9de65b..16415db8a 100644 --- a/.github/workflows/mypy-action.yml +++ b/.github/workflows/mypy-action.yml @@ -1,26 +1,19 @@ -name: Mypi action - +name: reviewdog on: [pull_request] -# on: - # push: - # paths: - # - '*.py' - jobs: mypy: + name: runner / mypy runs-on: ubuntu-latest steps: - - name: Setup Python - uses: actions/setup-python@v4 + - uses: actions/checkout@v4 + - uses: tsuyoshicho/action-mypy@v4 with: - python-version: 3.x - - name: Checkout - uses: actions/checkout@v3 - - name: Install mypy - run: pip install mypy - - name: Run mypy - uses: sasanquaneuf/mypy-github-action@releases/v1 - with: - checkName: 'mypy' # NOTE: this needs to be the same as the job name - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + github_token: ${{ secrets.github_token }} + # Change reviewdog reporter if you need [github-pr-check,github-check,github-pr-review]. + reporter: github-pr-review + # Change reporter level if you need. + # GitHub Status Check won't become failure with warning. + level: warning + # Change the current directory to run mypy command. + # mypy command reads setup.cfg or other settings file in this path. + workdir: . From 4e6b194b480debad43cd9922da7b50e6bcf1459f Mon Sep 17 00:00:00 2001 From: Jakub Kadlcik Date: Sun, 4 Aug 2024 12:42:48 +0200 Subject: [PATCH 10/35] wip --- .github/workflows/mypy-action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/mypy-action.yml b/.github/workflows/mypy-action.yml index 16415db8a..09be1abde 100644 --- a/.github/workflows/mypy-action.yml +++ b/.github/workflows/mypy-action.yml @@ -5,6 +5,7 @@ jobs: name: runner / mypy runs-on: ubuntu-latest steps: + - run: pip install mypy - uses: actions/checkout@v4 - uses: tsuyoshicho/action-mypy@v4 with: From 3a7ad2e7c6cefccecc443e6bef8e07335532a50c Mon Sep 17 00:00:00 2001 From: Jakub Kadlcik Date: Sun, 4 Aug 2024 12:46:19 +0200 Subject: [PATCH 11/35] wip --- .github/workflows/mypy.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/mypy.yml b/.github/workflows/mypy.yml index 674c9f771..e7ff9e15e 100644 --- a/.github/workflows/mypy.yml +++ b/.github/workflows/mypy.yml @@ -5,6 +5,7 @@ jobs: static-type-check: runs-on: ubuntu-latest + allow-failure: true steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v3 From 838b4f6a54024df5ed085183710158abc31acd26 Mon Sep 17 00:00:00 2001 From: Jakub Kadlcik Date: Sun, 4 Aug 2024 12:51:59 +0200 Subject: [PATCH 12/35] wip --- .github/workflows/mypy.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/mypy.yml b/.github/workflows/mypy.yml index e7ff9e15e..93ee4eef0 100644 --- a/.github/workflows/mypy.yml +++ b/.github/workflows/mypy.yml @@ -5,7 +5,6 @@ jobs: static-type-check: runs-on: ubuntu-latest - allow-failure: true steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v3 @@ -22,3 +21,7 @@ jobs: - name: Run if any of the listed files above is changed if: steps.changed-py-files.outputs.any_changed == 'true' run: mypy ${{ steps.changed-py-files.outputs.all_changed_files}} --install-types --non-interactive + + - name: Set warning if previous step failed + if: failure() + run: echo "::warning::The previous step failed but we are continuing." From 3e0cbc576d3f9db31de2959bc7701cea91858afd Mon Sep 17 00:00:00 2001 From: Jakub Kadlcik Date: Sun, 4 Aug 2024 12:52:31 +0200 Subject: [PATCH 13/35] wip --- .github/workflows/mypy-action.yml | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100644 .github/workflows/mypy-action.yml diff --git a/.github/workflows/mypy-action.yml b/.github/workflows/mypy-action.yml deleted file mode 100644 index 09be1abde..000000000 --- a/.github/workflows/mypy-action.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: reviewdog -on: [pull_request] -jobs: - mypy: - name: runner / mypy - runs-on: ubuntu-latest - steps: - - run: pip install mypy - - uses: actions/checkout@v4 - - uses: tsuyoshicho/action-mypy@v4 - with: - github_token: ${{ secrets.github_token }} - # Change reviewdog reporter if you need [github-pr-check,github-check,github-pr-review]. - reporter: github-pr-review - # Change reporter level if you need. - # GitHub Status Check won't become failure with warning. - level: warning - # Change the current directory to run mypy command. - # mypy command reads setup.cfg or other settings file in this path. - workdir: . From 197e36a62ee3fe4c18e9c009250daf3d835f5590 Mon Sep 17 00:00:00 2001 From: Jakub Kadlcik Date: Sun, 4 Aug 2024 12:54:14 +0200 Subject: [PATCH 14/35] wip --- .github/workflows/mypy.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/mypy.yml b/.github/workflows/mypy.yml index 93ee4eef0..10761e02a 100644 --- a/.github/workflows/mypy.yml +++ b/.github/workflows/mypy.yml @@ -18,9 +18,11 @@ jobs: files: | *.py **/*.py + - name: Run if any of the listed files above is changed if: steps.changed-py-files.outputs.any_changed == 'true' run: mypy ${{ steps.changed-py-files.outputs.all_changed_files}} --install-types --non-interactive + continue-on-error: true - name: Set warning if previous step failed if: failure() From e7a397bbb5e4422576d7fa2bb22e2a52f47fd273 Mon Sep 17 00:00:00 2001 From: Jakub Kadlcik Date: Sun, 4 Aug 2024 12:57:32 +0200 Subject: [PATCH 15/35] wip --- .github/workflows/mypy.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/mypy.yml b/.github/workflows/mypy.yml index 10761e02a..5e8acd678 100644 --- a/.github/workflows/mypy.yml +++ b/.github/workflows/mypy.yml @@ -26,4 +26,5 @@ jobs: - name: Set warning if previous step failed if: failure() - run: echo "::warning::The previous step failed but we are continuing." + # run: echo "::warning::The previous step failed but we are continuing." + run: echo "::warning file=app.py,line=10,col=5::Code formatting issues detected" From 205805328fd2794515bc3f527982a6be250d2136 Mon Sep 17 00:00:00 2001 From: Jakub Kadlcik Date: Sun, 4 Aug 2024 12:59:08 +0200 Subject: [PATCH 16/35] wip --- .github/workflows/mypy.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/mypy.yml b/.github/workflows/mypy.yml index 5e8acd678..f1b4a6f4e 100644 --- a/.github/workflows/mypy.yml +++ b/.github/workflows/mypy.yml @@ -22,7 +22,6 @@ jobs: - name: Run if any of the listed files above is changed if: steps.changed-py-files.outputs.any_changed == 'true' run: mypy ${{ steps.changed-py-files.outputs.all_changed_files}} --install-types --non-interactive - continue-on-error: true - name: Set warning if previous step failed if: failure() From a6097f23dfe457a7a4ad3c88e5c3d491790204f5 Mon Sep 17 00:00:00 2001 From: Jakub Kadlcik Date: Sun, 4 Aug 2024 13:04:43 +0200 Subject: [PATCH 17/35] wip --- .pre-commit-config.yaml | 82 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 000000000..2be4139ad --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,82 @@ +# HOWTO: https://pre-commit.com/#usage +# pip3 install pre-commit +# pre-commit install -t pre-commit -t pre-push + +repos: + # - repo: https://github.com/psf/black + # rev: 23.11.0 + # hooks: + # - id: black + # - repo: https://github.com/pre-commit/mirrors-prettier + # rev: v3.1.0 + # hooks: + # - id: prettier + # exclude: tests_recording/test_data/ + # - repo: https://github.com/pre-commit/pre-commit-hooks + # rev: v4.5.0 + # hooks: + # - id: check-added-large-files + # exclude: tests_recording/test_data/test_api/ + # - id: check-ast + # - id: check-builtin-literals + # - id: check-docstring-first + # - id: check-executables-have-shebangs + # exclude: (files/bash-completion/packit|tests/data/) + # - id: check-merge-conflict + # - id: check-symlinks + # - id: check-yaml + # - id: detect-private-key + # exclude: tests/integration/conftest.py + # - id: end-of-file-fixer + # exclude: ^(tests/data/patches|tests/.+\.patch) + # - id: mixed-line-ending + # - id: trailing-whitespace + # exclude: ^(tests/data/patches|tests/.+\.patch) + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.1.6 + hooks: + - id: ruff + args: [--fix, --exit-non-zero-on-fix] + - repo: https://github.com/pre-commit/mirrors-mypy + rev: v1.7.1 + hooks: + - id: mypy + args: [--no-strict-optional, --ignore-missing-imports] + additional_dependencies: + [ + types-click, + types-pkg_resources, + types-requests, + types-tabulate, + types-Deprecated, + types-PyYAML, + types-cachetools, + ] + # - repo: https://github.com/teemtee/tmt.git + # rev: 1.29.0 + # hooks: + # - id: tmt-lint + # - repo: https://github.com/packit/pre-commit-hooks + # rev: v1.2.0 + # hooks: + # - id: validate-config # passes when packit not installed (e.g. in CI) + # - id: check-rebase + # args: + # - https://github.com/packit/packit.git + # stages: [manual, push] + # - repo: https://github.com/python-jsonschema/check-jsonschema + # rev: 0.28.0 + # hooks: + # - id: check-github-workflows + # args: ["--verbose"] + # - repo: https://github.com/Lucas-C/pre-commit-hooks + # rev: v1.5.5 + # hooks: + # - id: insert-license + # files: \.py$ + # exclude: (tests/data/|tests_recording/test_data/) + # args: + # - --license-filepath + # - LICENSE_HEADER.txt + # - --comment-style + # - "#" From 484dda61b32f9973cf11c07fb5fb0573de25016e Mon Sep 17 00:00:00 2001 From: Jakub Kadlcik Date: Sun, 4 Aug 2024 13:06:17 +0200 Subject: [PATCH 18/35] wip --- .github/workflows/pre-commit.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .github/workflows/pre-commit.yml diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 000000000..24636caf3 --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,16 @@ +name: pre-commit + +on: + pull_request: + push: + branches: [main] + +jobs: + pre-commit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: 3.x + - uses: pre-commit/action@v3.0.1 From 7a1f7c538b27ad7abe717e8b8c70f8fe19b5af39 Mon Sep 17 00:00:00 2001 From: Jakub Kadlcik Date: Sun, 4 Aug 2024 13:19:25 +0200 Subject: [PATCH 19/35] wip --- .pre-commit-config.yaml | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2be4139ad..f101057b9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -32,25 +32,28 @@ repos: # - id: mixed-line-ending # - id: trailing-whitespace # exclude: ^(tests/data/patches|tests/.+\.patch) - - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.1.6 - hooks: - - id: ruff - args: [--fix, --exit-non-zero-on-fix] + # - repo: https://github.com/astral-sh/ruff-pre-commit + # rev: v0.1.6 + # hooks: + # - id: ruff + # args: [--fix, --exit-non-zero-on-fix] - repo: https://github.com/pre-commit/mirrors-mypy rev: v1.7.1 hooks: - id: mypy - args: [--no-strict-optional, --ignore-missing-imports] + args: [--no-strict-optional, --ignore-missing-imports, cli] additional_dependencies: [ - types-click, - types-pkg_resources, + types-six, types-requests, - types-tabulate, - types-Deprecated, - types-PyYAML, - types-cachetools, + types-setuptools, + # types-click, + # types-pkg_resources, + # types-requests, + # types-tabulate, + # types-Deprecated, + # types-PyYAML, + # types-cachetools, ] # - repo: https://github.com/teemtee/tmt.git # rev: 1.29.0 From f3bf3dac6f2c5b4f11b1e58951da42a6d4b14328 Mon Sep 17 00:00:00 2001 From: Jakub Kadlcik Date: Sun, 4 Aug 2024 13:20:25 +0200 Subject: [PATCH 20/35] wip --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f101057b9..a042dff14 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -41,7 +41,7 @@ repos: rev: v1.7.1 hooks: - id: mypy - args: [--no-strict-optional, --ignore-missing-imports, cli] + args: [--no-strict-optional, --ignore-missing-imports] additional_dependencies: [ types-six, From c7902f5a50bfc2319bb2e20ed6ec86f153249b6f Mon Sep 17 00:00:00 2001 From: Jakub Kadlcik Date: Sun, 4 Aug 2024 13:30:51 +0200 Subject: [PATCH 21/35] wip --- cli/copr_cli/main.py | 1 + 1 file changed, 1 insertion(+) diff --git a/cli/copr_cli/main.py b/cli/copr_cli/main.py index 6c3451a56..5a18fff3b 100644 --- a/cli/copr_cli/main.py +++ b/cli/copr_cli/main.py @@ -62,6 +62,7 @@ None: "default", } +# bar # foo try: input = raw_input From 4653e7910348917c39142f6f9e243d34c752d9ca Mon Sep 17 00:00:00 2001 From: Jakub Kadlcik Date: Sun, 4 Aug 2024 13:39:47 +0200 Subject: [PATCH 22/35] wip --- .github/workflows/pre-commit.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 24636caf3..ace3f0c86 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -14,3 +14,5 @@ jobs: with: python-version: 3.x - uses: pre-commit/action@v3.0.1 + with: + extra_args: --from-ref origin/HEAD --to-ref HEAD From 478e88535e4c7393712dca7bf96175751bc784db Mon Sep 17 00:00:00 2001 From: Jakub Kadlcik Date: Sun, 4 Aug 2024 13:40:43 +0200 Subject: [PATCH 23/35] wip --- .github/workflows/pre-commit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index ace3f0c86..a5fee0008 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -15,4 +15,4 @@ jobs: python-version: 3.x - uses: pre-commit/action@v3.0.1 with: - extra_args: --from-ref origin/HEAD --to-ref HEAD + extra_args: --from-ref origin/HEAD --to-ref HEAD From d026c39b8f5ab573e73d74a56aa10e29115d8fec Mon Sep 17 00:00:00 2001 From: Jakub Kadlcik Date: Sun, 4 Aug 2024 13:45:29 +0200 Subject: [PATCH 24/35] wip --- .github/workflows/pre-commit.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index a5fee0008..c46a64f5d 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -15,4 +15,5 @@ jobs: python-version: 3.x - uses: pre-commit/action@v3.0.1 with: - extra_args: --from-ref origin/HEAD --to-ref HEAD + # extra_args: --from-ref origin/HEAD --to-ref HEAD + extra_args: --from-ref main --to-ref HEAD From 6ecc7e8c131b1555615fbb96577f94dad3bea206 Mon Sep 17 00:00:00 2001 From: Jakub Kadlcik Date: Sun, 4 Aug 2024 14:21:41 +0200 Subject: [PATCH 25/35] wip --- .github/workflows/pre-commit.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index c46a64f5d..e74924cc4 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -16,4 +16,6 @@ jobs: - uses: pre-commit/action@v3.0.1 with: # extra_args: --from-ref origin/HEAD --to-ref HEAD - extra_args: --from-ref main --to-ref HEAD + # extra_args: --from-ref main --to-ref HEAD + # extra_args: --from-ref main + extra_args: --from-ref origin/main --to-ref HEAD From fe984e2bdf618b56a25e0bf96be5677316a427d3 Mon Sep 17 00:00:00 2001 From: Jakub Kadlcik Date: Sun, 4 Aug 2024 14:30:29 +0200 Subject: [PATCH 26/35] wip --- .github/workflows/pre-commit.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index e74924cc4..23d1f89a1 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -13,9 +13,13 @@ jobs: - uses: actions/setup-python@v5 with: python-version: 3.x + + - name: foo + run: git fetch origin + - uses: pre-commit/action@v3.0.1 with: # extra_args: --from-ref origin/HEAD --to-ref HEAD # extra_args: --from-ref main --to-ref HEAD # extra_args: --from-ref main - extra_args: --from-ref origin/main --to-ref HEAD + extra_args: --from-ref origin/HEAD --to-ref HEAD From 8821bd3d4d8127c55e6bdbfb04d2e69b058d11d3 Mon Sep 17 00:00:00 2001 From: Jakub Kadlcik Date: Sun, 4 Aug 2024 14:33:32 +0200 Subject: [PATCH 27/35] wip --- .github/workflows/pre-commit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 23d1f89a1..57f0983df 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -22,4 +22,4 @@ jobs: # extra_args: --from-ref origin/HEAD --to-ref HEAD # extra_args: --from-ref main --to-ref HEAD # extra_args: --from-ref main - extra_args: --from-ref origin/HEAD --to-ref HEAD + extra_args: --from-ref origin/main --to-ref HEAD From 743f58ce722303548a7b9e80ad5dea88200805bc Mon Sep 17 00:00:00 2001 From: Jakub Kadlcik Date: Sun, 4 Aug 2024 14:38:21 +0200 Subject: [PATCH 28/35] wip --- .github/workflows/pre-commit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 57f0983df..f3d8d8b5f 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -14,7 +14,7 @@ jobs: with: python-version: 3.x - - name: foo + - name: Fetch repository run: git fetch origin - uses: pre-commit/action@v3.0.1 From 03ca1718ed72b8edb6d6a5a15b845a48c0540947 Mon Sep 17 00:00:00 2001 From: Jakub Kadlcik Date: Sun, 4 Aug 2024 14:46:21 +0200 Subject: [PATCH 29/35] wip --- .pre-commit-config.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a042dff14..73b008543 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -41,7 +41,12 @@ repos: rev: v1.7.1 hooks: - id: mypy - args: [--no-strict-optional, --ignore-missing-imports] + args: + [ + --no-strict-optional, + --ignore-missing-imports, + --explicit-package-bases, + ] additional_dependencies: [ types-six, From 77329837c499a2210d31b2f8980ee3f8a5968def Mon Sep 17 00:00:00 2001 From: Jakub Kadlcik Date: Sun, 4 Aug 2024 14:46:29 +0200 Subject: [PATCH 30/35] fix --- cli/copr_cli/main.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/cli/copr_cli/main.py b/cli/copr_cli/main.py index 5a18fff3b..81a176eab 100644 --- a/cli/copr_cli/main.py +++ b/cli/copr_cli/main.py @@ -62,13 +62,6 @@ None: "default", } -# bar -# foo -try: - input = raw_input -except NameError: - pass - class FrontendOutdatedCliException(Exception): """ From 07fc0086c31ab010d89a01c765e622fd8672c579 Mon Sep 17 00:00:00 2001 From: Jakub Kadlcik Date: Sun, 4 Aug 2024 14:52:00 +0200 Subject: [PATCH 31/35] fix --- cli/copr_cli/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cli/copr_cli/main.py b/cli/copr_cli/main.py index 81a176eab..c071045f2 100644 --- a/cli/copr_cli/main.py +++ b/cli/copr_cli/main.py @@ -25,7 +25,7 @@ try: import argcomplete except ImportError: - argcomplete = None + pass import copr.exceptions as copr_exceptions from copr.v3 import ( @@ -1895,7 +1895,7 @@ def __call__(self, parser, args, argument, option_string=None): # package monitoring cli_monitor_parser(subparsers) - if argcomplete: + if "argcomplete" in sys.modules: argcomplete.autocomplete(parser) return parser From 2db877d4848b4a0bc1d4cd0407dcaa822deb0458 Mon Sep 17 00:00:00 2001 From: Jakub Kadlcik Date: Sun, 4 Aug 2024 15:48:31 +0200 Subject: [PATCH 32/35] fix --- python/copr/v3/auth/base.py | 2 +- python/copr/v3/pagination.py | 2 +- python/docs/conf.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/python/copr/v3/auth/base.py b/python/copr/v3/auth/base.py index 2f3e45480..2b62a0ab1 100644 --- a/python/copr/v3/auth/base.py +++ b/python/copr/v3/auth/base.py @@ -11,7 +11,7 @@ try: from urllib.parse import urlparse except ImportError: - from urlparse import urlparse + from urlparse import urlparse # type: ignore [no-redef] class BaseAuth(object): diff --git a/python/copr/v3/pagination.py b/python/copr/v3/pagination.py index a145d8220..9032d45ad 100644 --- a/python/copr/v3/pagination.py +++ b/python/copr/v3/pagination.py @@ -5,7 +5,7 @@ try: import urlparse - from urllib import urlencode + from urllib import urlencode # type: ignore [attr-defined] except ImportError: import urllib.parse as urlparse from urllib.parse import urlencode diff --git a/python/docs/conf.py b/python/docs/conf.py index ed82976ac..6555687e6 100644 --- a/python/docs/conf.py +++ b/python/docs/conf.py @@ -185,7 +185,7 @@ # -- Options for LaTeX output -------------------------------------------------- -latex_elements = { +latex_elements : dict = { # The paper size ('letterpaper' or 'a4paper'). #'papersize': 'letterpaper', From 8a9ae998a8aa11021cf3b2ed5e4c896393dd61cb Mon Sep 17 00:00:00 2001 From: Jakub Kadlcik Date: Sun, 4 Aug 2024 16:00:07 +0200 Subject: [PATCH 33/35] fix --- keygen/docs/conf.py | 2 +- keygen/run/dev_run.py | 29 ----------------------------- 2 files changed, 1 insertion(+), 30 deletions(-) delete mode 100755 keygen/run/dev_run.py diff --git a/keygen/docs/conf.py b/keygen/docs/conf.py index a8212326c..48128f796 100644 --- a/keygen/docs/conf.py +++ b/keygen/docs/conf.py @@ -174,7 +174,7 @@ # -- Options for LaTeX output -------------------------------------------------- -latex_elements = { +latex_elements : dict = { # The paper size ('letterpaper' or 'a4paper'). #'papersize': 'letterpaper', diff --git a/keygen/run/dev_run.py b/keygen/run/dev_run.py deleted file mode 100755 index 3f75e4efe..000000000 --- a/keygen/run/dev_run.py +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/python3 - -import sys -sys.path.append("../src/") - -import os -import glob -os.environ["COPR_KEYGEN_CONFIG"] = glob.glob("./run/dev_run.conf") - -for d in [ - "/tmp/copr-keygen/var/lib/copr-keygen/phrases/", - "/tmp/copr-keygen/var/lib/copr-keygen/gnupg", - "/tmp/copr-keygen/var/log/copr-keygen" -]: - if not os.path.exists(d): - os.makedirs(d) - -from copr_keygen import app - -import logging - -logging.basicConfig( - level=logging.DEBUG, - format= '[%(asctime)s] {%(pathname)s:%(lineno)d} %(levelname)s - %(message)s', - datefmt='%H:%M:%S' -) - -if __name__ == '__main__': - app.run() From 3f18779af66f091d51b157bdf8f800506254f9c5 Mon Sep 17 00:00:00 2001 From: Jakub Kadlcik Date: Sun, 4 Aug 2024 16:22:23 +0200 Subject: [PATCH 34/35] fix --- .mypy.ini | 1 + .pre-commit-config.yaml | 1 + keygen/docs/conf.py | 2 +- python/docs/conf.py | 2 +- rpmbuild/copr_rpmbuild/providers/__init__.py | 4 ---- rpmbuild/tests/test_base.py | 2 +- rpmbuild/tests/test_distgit.py | 2 +- rpmbuild/tests/test_main.py | 2 +- rpmbuild/tests/test_mock.py | 2 +- rpmbuild/tests/test_pypi.py | 2 +- rpmbuild/tests/test_rubygems.py | 2 +- rpmbuild/tests/test_scm.py | 2 +- rpmbuild/tests/test_spec.py | 2 +- 13 files changed, 12 insertions(+), 14 deletions(-) diff --git a/.mypy.ini b/.mypy.ini index 976ba0294..f882692d0 100644 --- a/.mypy.ini +++ b/.mypy.ini @@ -1,2 +1,3 @@ [mypy] ignore_missing_imports = True +allow_untyped_globals = True diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 73b008543..4748f8417 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -52,6 +52,7 @@ repos: types-six, types-requests, types-setuptools, + types-mock, # types-click, # types-pkg_resources, # types-requests, diff --git a/keygen/docs/conf.py b/keygen/docs/conf.py index 48128f796..a8212326c 100644 --- a/keygen/docs/conf.py +++ b/keygen/docs/conf.py @@ -174,7 +174,7 @@ # -- Options for LaTeX output -------------------------------------------------- -latex_elements : dict = { +latex_elements = { # The paper size ('letterpaper' or 'a4paper'). #'papersize': 'letterpaper', diff --git a/python/docs/conf.py b/python/docs/conf.py index 6555687e6..ed82976ac 100644 --- a/python/docs/conf.py +++ b/python/docs/conf.py @@ -185,7 +185,7 @@ # -- Options for LaTeX output -------------------------------------------------- -latex_elements : dict = { +latex_elements = { # The paper size ('letterpaper' or 'a4paper'). #'papersize': 'letterpaper', diff --git a/rpmbuild/copr_rpmbuild/providers/__init__.py b/rpmbuild/copr_rpmbuild/providers/__init__.py index 4178bd9c3..9bb294cc4 100644 --- a/rpmbuild/copr_rpmbuild/providers/__init__.py +++ b/rpmbuild/copr_rpmbuild/providers/__init__.py @@ -8,10 +8,6 @@ from .distgit import DistGitProvider -__all__ = [RubyGemsProvider, PyPIProvider, - UrlProvider, ScmProvider] - - def factory(source_type): try: return { diff --git a/rpmbuild/tests/test_base.py b/rpmbuild/tests/test_base.py index 5ecbd1e60..a8ca9903e 100644 --- a/rpmbuild/tests/test_base.py +++ b/rpmbuild/tests/test_base.py @@ -10,7 +10,7 @@ builtins = 'builtins' except ImportError: # Python 2 version depends on mock - import mock + import mock # type: ignore [no-redef] builtins = '__builtin__' class TestProvider(TestCase): diff --git a/rpmbuild/tests/test_distgit.py b/rpmbuild/tests/test_distgit.py index 08fa6c987..c9d128b5c 100644 --- a/rpmbuild/tests/test_distgit.py +++ b/rpmbuild/tests/test_distgit.py @@ -18,7 +18,7 @@ from unittest import mock except ImportError: # Python 2 version depends on mock - import mock + import mock # type: ignore [no-redef] from tests import TestCase diff --git a/rpmbuild/tests/test_main.py b/rpmbuild/tests/test_main.py index 17f2e1d37..9214d23cb 100644 --- a/rpmbuild/tests/test_main.py +++ b/rpmbuild/tests/test_main.py @@ -12,7 +12,7 @@ from unittest import mock except ImportError: # Python 2 version depends on mock - import mock + import mock # type: ignore [no-redef] class TestTmpCleanup(TestCase): diff --git a/rpmbuild/tests/test_mock.py b/rpmbuild/tests/test_mock.py index 9b6cc7a98..522d92943 100644 --- a/rpmbuild/tests/test_mock.py +++ b/rpmbuild/tests/test_mock.py @@ -14,7 +14,7 @@ builtins = 'builtins' except ImportError: # Python 2 version depends on mock - import mock + import mock # type: ignore [no-redef] builtins = '__builtin__' @pytest.yield_fixture diff --git a/rpmbuild/tests/test_pypi.py b/rpmbuild/tests/test_pypi.py index 34443bfe9..0477d8b72 100644 --- a/rpmbuild/tests/test_pypi.py +++ b/rpmbuild/tests/test_pypi.py @@ -6,7 +6,7 @@ builtins = 'builtins' except ImportError: # Python 2 version depends on mock - import mock + import mock # type: ignore [no-redef] builtins = '__builtin__' diff --git a/rpmbuild/tests/test_rubygems.py b/rpmbuild/tests/test_rubygems.py index 495bd2ca6..0f280b410 100644 --- a/rpmbuild/tests/test_rubygems.py +++ b/rpmbuild/tests/test_rubygems.py @@ -9,7 +9,7 @@ builtins = 'builtins' except ImportError: # Python 2 version depends on mock - import mock + import mock # type: ignore [no-redef] builtins = '__builtin__' diff --git a/rpmbuild/tests/test_scm.py b/rpmbuild/tests/test_scm.py index 801d42202..15a7c7588 100644 --- a/rpmbuild/tests/test_scm.py +++ b/rpmbuild/tests/test_scm.py @@ -13,7 +13,7 @@ builtins = 'builtins' except ImportError: # Python 2 version depends on mock - import mock + import mock # type: ignore [no-redef] builtins = '__builtin__' RPKG_CONF_JINJA = """ diff --git a/rpmbuild/tests/test_spec.py b/rpmbuild/tests/test_spec.py index e74983700..cb6269c96 100644 --- a/rpmbuild/tests/test_spec.py +++ b/rpmbuild/tests/test_spec.py @@ -23,7 +23,7 @@ def example_com_match(url, request): builtins = 'builtins' except ImportError: # Python 2 version depends on mock - import mock + import mock # type: ignore [no-redef] builtins = '__builtin__' From 14e20026d6eb436ede6f0c354811437fdf7364e0 Mon Sep 17 00:00:00 2001 From: Jakub Kadlcik Date: Sun, 4 Aug 2024 16:34:27 +0200 Subject: [PATCH 35/35] wip --- .pre-commit-config.yaml | 2 ++ frontend/coprs_frontend/coprs/__init__.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4748f8417..39fcbf2a2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -53,6 +53,8 @@ repos: types-requests, types-setuptools, types-mock, + types-decorator, + types-pytz, # types-click, # types-pkg_resources, # types-requests, diff --git a/frontend/coprs_frontend/coprs/__init__.py b/frontend/coprs_frontend/coprs/__init__.py index d6b8f5ae4..848567bcb 100644 --- a/frontend/coprs_frontend/coprs/__init__.py +++ b/frontend/coprs_frontend/coprs/__init__.py @@ -19,7 +19,7 @@ from coprs.redis_session import RedisSessionInterface from coprs.request import get_request_class -app = flask.Flask(__name__) +app : flask.Flask = flask.Flask(__name__) if "COPRS_ENVIRON_PRODUCTION" in os.environ: app.config.from_object("coprs.config.ProductionConfig") elif "COPRS_ENVIRON_UNITTEST" in os.environ: @@ -42,7 +42,7 @@ session = Session(app) # Set `future=True` to ensure compatibility between SQLAlchemy 1.x and 2.0 -db = SQLAlchemy(app, engine_options={"future": True}) +db : SQLAlchemy = SQLAlchemy(app, engine_options={"future": True}) @contextmanager def db_session_scope():