From d974788718ff009e38908bf91f4ac297b034568c Mon Sep 17 00:00:00 2001 From: Tom Schraitle Date: Tue, 16 Jul 2024 13:50:25 +0200 Subject: [PATCH 1/4] Ignore venv*/.venv* --- .gitignore | 2 +- setup.cfg | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index dead3352..256de715 100644 --- a/.gitignore +++ b/.gitignore @@ -108,7 +108,7 @@ celerybeat.pid # Environments .env -.venv +.venv* env/ venv/ ENV/ diff --git a/setup.cfg b/setup.cfg index 0ee8564c..790f260c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -76,7 +76,8 @@ extend-exclude = .env build docs - venv + venv* + .venv* conftest.py src/semver/__init__.py tasks.py From 4cb269d952c256108f3e06c210ccbfc0e0032e2b Mon Sep 17 00:00:00 2001 From: Tom Schraitle Date: Tue, 16 Jul 2024 13:55:49 +0200 Subject: [PATCH 2/4] GHA: Change Python and CodeQL Python workflow: * Exclude 3.7 on macos-latest * Use actions/checkout@v4 (migrated from @v3) * Enable Python 3.12, use action/setup-python@v5 * Use newer syntax of "tox run ..." CodeQL workflow: * Update to latest version @v3 * Not be triggered in master, but in release/* branches --- .github/workflows/codeql-analysis.yml | 10 +++++----- .github/workflows/python-testing.yml | 22 +++++++++++++--------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index f310a7e3..61d1a1f6 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -13,7 +13,7 @@ name: "CodeQL" on: push: - branches: [ master, maint/v2 ] + branches: [ maint/v2, release/* ] pull_request: # The branches below must be a subset of the branches above branches: [ master ] @@ -35,11 +35,11 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v2 + uses: github/codeql-action/init@v3 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -50,7 +50,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@v2 + uses: github/codeql-action/autobuild@v3 # â„šī¸ Command-line programs to run using the OS shell. # 📚 https://git.io/JvXDl @@ -64,4 +64,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + uses: github/codeql-action/analyze@v3 diff --git a/.github/workflows/python-testing.yml b/.github/workflows/python-testing.yml index bbbe2a42..db555cc0 100644 --- a/.github/workflows/python-testing.yml +++ b/.github/workflows/python-testing.yml @@ -35,7 +35,7 @@ jobs: can_run: ${{ steps.check_files.outputs.can_run }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 @@ -77,9 +77,9 @@ jobs: if: ${{ needs.check-files.outputs.can_run == '1' }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: 3.8 cache: 'pip' @@ -89,11 +89,12 @@ jobs: pip install tox tox-gh-actions - name: Check run: | - tox -e checks + tox run -e checks tests: needs: check runs-on: ${{ matrix.os }} + continue-on-error: true strategy: max-parallel: 5 fail-fast: true @@ -103,14 +104,17 @@ jobs: "3.9", "3.10", "3.11", - # "3.12-dev" + "3.12", ] - os: [ubuntu-latest, "macos-latest"] + os: ["ubuntu-latest", "macos-latest"] + exclude: + - os: "macos-latest" + python-version: "3.7" steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} for ${{ matrix.os }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} cache: 'pip' @@ -120,4 +124,4 @@ jobs: pip install tox tox-gh-actions - name: Test with tox run: | - tox + tox run From dec7f63f11c8349d0f2aa6ef647ff6dd6c9fe86c Mon Sep 17 00:00:00 2001 From: Tom Schraitle Date: Tue, 16 Jul 2024 14:02:27 +0200 Subject: [PATCH 3/4] Change flake8 config to be compatible with black As suggested by https://black.readthedocs.io/en/stable/guides/using_black_with_other_tools.html#labels-why-pycodestyle-warnings --- setup.cfg | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/setup.cfg b/setup.cfg index 790f260c..7f1878c2 100644 --- a/setup.cfg +++ b/setup.cfg @@ -70,7 +70,7 @@ addopts = [flake8] max-line-length = 88 -ignore = F821,W503 +extend-ignore = E203,E701 extend-exclude = .eggs .env @@ -84,7 +84,8 @@ extend-exclude = [pycodestyle] count = False -# ignore = E226,E302,E41 +ignore = E203,E701 +# E226,E302,E41 max-line-length = 88 statistics = True exclude = From 97676c838129bfeff1439b47775ad1025f817b55 Mon Sep 17 00:00:00 2001 From: Tom Schraitle Date: Tue, 16 Jul 2024 14:03:38 +0200 Subject: [PATCH 4/4] Format with black --- src/semver/__main__.py | 1 + src/semver/_deprecated.py | 1 + tests/test_semver.py | 3 +-- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/semver/__main__.py b/src/semver/__main__.py index 6cb11f09..c6adb834 100644 --- a/src/semver/__main__.py +++ b/src/semver/__main__.py @@ -9,6 +9,7 @@ $ python3 semver-3*-py3-none-any.whl/semver -h """ + import os.path import sys from typing import List, Optional diff --git a/src/semver/_deprecated.py b/src/semver/_deprecated.py index efbdf439..df11bb02 100644 --- a/src/semver/_deprecated.py +++ b/src/semver/_deprecated.py @@ -3,6 +3,7 @@ .. autofunction: deprecated """ + import inspect import warnings from functools import partial, wraps diff --git a/tests/test_semver.py b/tests/test_semver.py index 782d5c79..9978b940 100644 --- a/tests/test_semver.py +++ b/tests/test_semver.py @@ -131,7 +131,6 @@ def test_should_fail_with_incompatible_type_for_compatible_match(wrongtype): def test_should_succeed_with_compatible_subclass_for_is_compatible(): - class CustomVersion(Version): - ... + class CustomVersion(Version): ... assert CustomVersion(1, 0, 0).is_compatible(Version(1, 0, 0))