From db19d8208fd071a02a0727333583c214ee14b1ba Mon Sep 17 00:00:00 2001 From: Roman Vlasenko Date: Sun, 25 Aug 2024 02:44:59 +0300 Subject: [PATCH 1/6] Change pre-commit hooks to run mypy, pytest and poetry-export only on commit. Move mypy options to pyproject.toml. --- .pre-commit-config.yaml | 26 ++++++++++---------------- pyproject.toml | 2 ++ 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b2088f2..c8c063f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -13,9 +13,7 @@ repos: rev: 7.1.0 hooks: - id: flake8 - stages: - - commit - - manual + stages: [commit, manual] additional_dependencies: [flake8-bugbear] types: [python] @@ -23,8 +21,7 @@ repos: rev: 23.3.0 hooks: - id: black - stages: - - commit + stages: [commit] types: [python] - id: black @@ -32,35 +29,30 @@ repos: args: - --check - --diff - stages: - - manual + stages: [manual] types: [python] - repo: https://github.com/pycqa/isort rev: 5.12.0 hooks: - id: isort - stages: - - commit + stages: [commit] types: [python] - id: isort name: isort-check args: - --check-only - stages: - - manual + stages: [manual] types: [python] - repo: local hooks: - id: mypy + stages: [commit] + exclude: "^tests/" name: mypy entry: mypy - args: - - --strict - - --no-warn-no-return - exclude: "^tests/" language: system types: [python] require_serial: true @@ -68,18 +60,20 @@ repos: - repo: local hooks: - id: pytest + stages: [commit] name: pytest-no-snap entry: pytest args: ["-m", "not snap"] pass_filenames: false language: system - types: [ python ] + types: [python] require_serial: true - repo: https://github.com/python-poetry/poetry rev: '1.8.3' hooks: - id: poetry-export + stages: [commit] name: poetry-export-server args: - --output=requirements-server.txt diff --git a/pyproject.toml b/pyproject.toml index b29ae6d..33b122d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -67,6 +67,8 @@ line-length = 100 profile = "black" [tool.mypy] +strict = true +warn_no_return = false plugins = [ "pydantic.mypy" ] From 0a67b72b107d7a2f2f21f26d090d99ae7691303e Mon Sep 17 00:00:00 2001 From: Roman Vlasenko Date: Sun, 25 Aug 2024 02:47:07 +0300 Subject: [PATCH 2/6] Use new CI flow --- .github/workflows/ci.yml | 71 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..e0cbf2d --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,71 @@ +name: CI + +on: + workflow_dispatch: + push: + branches: + - "main" + paths-ignore: + - "README.md" + - "CHANGELOG.md" + - "Taskfile.yaml" + pull_request: + paths-ignore: + - "README.md" + - "CHANGELOG.md" + - "Taskfile.yaml" + release: + types: + - published + +env: + POETRY_VERSION: "1.8.3" + +jobs: + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + - uses: pre-commit/action@v3.0.1 + with: + extra_args: "--hook-stage manual" + + test: + name: Test + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ["3.10", "3.11", "3.12"] + needs: [lint] + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Install tox + run: pip install tox-gh>=1.3 + - name: Setup test suite + run: tox -v --notest + - name: Run test suite + run: tox --skip-pkg-install + - name: Upload test coverage + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} + + publish: + name: Publish package + runs-on: ubuntu-latest + needs: [lint, test] + if: ${{ github.event_name == 'release' }} + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + - name: Publish release ${{ github.ref }} + run: | + pip install poetry==${{ env.POETRY_VERSION }} + poetry publish --build --username __token__ --password ${{ secrets.PYPI_TOKEN }} From 24b5bb755da3e9cfa29bbbe1622a253544bab047 Mon Sep 17 00:00:00 2001 From: Roman Vlasenko Date: Sun, 25 Aug 2024 02:54:22 +0300 Subject: [PATCH 3/6] Add tox-gh section to tox.ini --- tox.ini | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tox.ini b/tox.ini index 5a82551..4ce683f 100644 --- a/tox.ini +++ b/tox.ini @@ -17,3 +17,9 @@ pass_env = DISPLAY commands = pytest tests/ + +[gh] +python = + 3.12 = py312 + 3.11 = py311 + 3.10 = py310 From f7aac6f958e5fa73b9f907d3574840853be4331e Mon Sep 17 00:00:00 2001 From: Roman Vlasenko Date: Sun, 25 Aug 2024 02:59:07 +0300 Subject: [PATCH 4/6] Fix clipboard initialization error --- .github/workflows/ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e0cbf2d..450c736 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,12 +40,16 @@ jobs: matrix: python-version: ["3.10", "3.11", "3.12"] needs: [lint] + env: + DISPLAY: :0 steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} + - name: Run virtual X11 server + run: Xvfb :0 -screen 0 800x600x16 & - name: Install tox run: pip install tox-gh>=1.3 - name: Setup test suite From 4a7e35f5eab72abfe72ce642f2d4fe29622804e5 Mon Sep 17 00:00:00 2001 From: Roman Vlasenko Date: Tue, 27 Aug 2024 00:08:44 +0300 Subject: [PATCH 5/6] Revert "Fix clipboard initialization error" This reverts commit f7aac6f958e5fa73b9f907d3574840853be4331e. --- .github/workflows/ci.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 450c736..e0cbf2d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,16 +40,12 @@ jobs: matrix: python-version: ["3.10", "3.11", "3.12"] needs: [lint] - env: - DISPLAY: :0 steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - - name: Run virtual X11 server - run: Xvfb :0 -screen 0 800x600x16 & - name: Install tox run: pip install tox-gh>=1.3 - name: Setup test suite From 4ee9a498ee3e0e3f36914db9227c72b03ed5b8d2 Mon Sep 17 00:00:00 2001 From: Roman Vlasenko Date: Tue, 27 Aug 2024 00:11:23 +0300 Subject: [PATCH 6/6] Use copykitten version that fixes an initialization error --- poetry.lock | 16 ++++++++-------- pyproject.toml | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/poetry.lock b/poetry.lock index 54eb687..e6b8a29 100644 --- a/poetry.lock +++ b/poetry.lock @@ -447,17 +447,17 @@ files = [ [[package]] name = "copykitten" -version = "1.2.0" +version = "1.2.1" description = "A robust, dependency-free way to use the system clipboard in Python." optional = true python-versions = "<3.13,>=3.8" files = [ - {file = "copykitten-1.2.0-cp38-abi3-macosx_10_12_x86_64.whl", hash = "sha256:f683f630c6125a73a67dd902128c32d6fe2fd7d49a4bd01f73c0d5d82a5ab964"}, - {file = "copykitten-1.2.0-cp38-abi3-macosx_11_0_arm64.whl", hash = "sha256:ffbda0331d112c831e2dd1250cedc0551a352c7f98be052a036623d5ed1e7dbd"}, - {file = "copykitten-1.2.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1ba032464aabe26349861ddfccfdb20a4466ffc2e2f100d3a7852905e5600539"}, - {file = "copykitten-1.2.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:175db73dc504575479c82d0d650f02526bec77bf0dac865e8db2e8f4603ea759"}, - {file = "copykitten-1.2.0-cp38-abi3-win_amd64.whl", hash = "sha256:4e5822cc8041b7c81f49202595cf8a1ac67a1cf7e67e9e5e0c8704b559bbd590"}, - {file = "copykitten-1.2.0.tar.gz", hash = "sha256:d9053fc6cfbaa9de621fb3d1090e8d19ae31c94b6964fc8db317d9bdbdc31635"}, + {file = "copykitten-1.2.1-cp38-abi3-macosx_10_12_x86_64.whl", hash = "sha256:35844a0822491ad79f10588e55f4bde6473cfbcacd4ef529570046626a8fea68"}, + {file = "copykitten-1.2.1-cp38-abi3-macosx_11_0_arm64.whl", hash = "sha256:880836a8e2bf7f111fa9b046829d00ee75b314bb7a3b0bc4454604a638ae3f91"}, + {file = "copykitten-1.2.1-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a014f1ba9b6de69e9b7288b7b5e4cce6c39e0ffbe6b49197a427204642e9c67a"}, + {file = "copykitten-1.2.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:537056ffb57370b2b212649e9f6d86b29d8f1d29029f18aea4f2901ac89f95eb"}, + {file = "copykitten-1.2.1-cp38-abi3-win_amd64.whl", hash = "sha256:1e4295ca2b691a5da0fc6349336082e59303951bfcd1453f187eec32a5d6792b"}, + {file = "copykitten-1.2.1.tar.gz", hash = "sha256:924e5c091cf93ab636d56a6e7a138429c91ebc60dcabbf4d165cd8ddb891703a"}, ] [[package]] @@ -2336,4 +2336,4 @@ server = ["aioprometheus", "auth0-python", "blacksheep", "pyjwt", "redis", "uvic [metadata] lock-version = "2.0" python-versions = ">=3.10,<3.13" -content-hash = "6b54349acb0a5319ea689feb43c7a2a0a75cbaf15370659322eeb78ad54e5fc7" +content-hash = "0449b38b18445b501536c1bb218c8fd2a54f4070d3124af798c2c2f610d344a0" diff --git a/pyproject.toml b/pyproject.toml index 33b122d..8fcd0d0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,7 +46,7 @@ async-timeout = { version = "^4.0.3", markers = "python_version < '3.11'" } backports-strenum = { version = "^1.2.8", markers = "python_version < '3.11'" } sentry-sdk = "^2.8.0" aioprometheus = {version = "^23.3.0", optional = true} -copykitten = { version = "^1.2.0", optional = true } +copykitten = { version = "^1.2.1", optional = true } tenacity = { version = "^8.4.1", optional = true } pymitter = "^0.5.1" sentry-offline-transport = { version = "^1.0.0", optional = true }