From 56a81b4593320025a97876617726df294ce52ba6 Mon Sep 17 00:00:00 2001 From: RaulSMS Date: Thu, 18 Jun 2026 16:53:57 +0200 Subject: [PATCH 1/5] fix: declare Python 3.10 as minimum version and expand CI matrix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add python_requires=">=3.10" to setup.py to accurately reflect the use of structural pattern matching (PEP 622) and union type annotations (PEP 604) already present in the codebase. Expand CI to test against Python 3.10–3.13 on all platforms, add a ruff lint job to catch future syntax regressions, and document the requirement in the README. --- .github/workflows/CI.yml | 25 ++++++++++++++++++++----- README.rst | 2 ++ setup.cfg | 5 ++++- setup.py | 5 +++++ 4 files changed, 31 insertions(+), 6 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 6860df8..6725736 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -22,21 +22,36 @@ on: # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: - # This workflow contains a single job called "test" + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: '3.10' + + - name: Install ruff + run: pip install ruff + + - name: Check syntax compatibility (target Python 3.10) + run: ruff check --select=E999 . + test: # The type of runner that the job will run on runs-on: ${{ matrix.os }} strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] + python-version: ['3.10', '3.11', '3.12', '3.13'] steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/setup-python@v4 + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 with: - python-version: '3.10' - - - uses: actions/checkout@v2 + python-version: ${{ matrix.python-version }} - name: install dependencies run: pip3 install -e .[test] diff --git a/README.rst b/README.rst index f8a0118..6bfcff3 100644 --- a/README.rst +++ b/README.rst @@ -80,6 +80,8 @@ Features Installation ------------ +Requires **Python 3.10 or later** and python-can_ >= 4.2.0. + Install can-j1939 with pip:: $ pip install can-j1939 diff --git a/setup.cfg b/setup.cfg index 7c2b287..6978275 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,2 +1,5 @@ [bdist_wheel] -universal = 1 \ No newline at end of file +universal = 1 + +[ruff] +target-version = "py310" \ No newline at end of file diff --git a/setup.py b/setup.py index bb12623..0bf4eab 100644 --- a/setup.py +++ b/setup.py @@ -18,10 +18,15 @@ long_description_content_type='text/x-rst', license="MIT", platforms=["any"], + python_requires=">=3.10", classifiers=[ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", "Intended Audience :: Developers", "Topic :: Scientific/Engineering" ], From 7f27675a464e1342f76f46382aef88a846987089 Mon Sep 17 00:00:00 2001 From: RaulSMS Date: Thu, 18 Jun 2026 17:00:38 +0200 Subject: [PATCH 2/5] fix: replace removed ruff E999 rule with python compileall ruff removed the E999 rule; use python -m compileall instead to check for syntax errors against the installed Python version. --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 6725736..cbd9f25 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -35,7 +35,7 @@ jobs: run: pip install ruff - name: Check syntax compatibility (target Python 3.10) - run: ruff check --select=E999 . + run: python -m compileall -q j1939/ test/ test_helpers/ test: # The type of runner that the job will run on From 5be4ea093e361a0126e4029bebbda6ebfe6a35eb Mon Sep 17 00:00:00 2001 From: RaulSMS Date: Thu, 18 Jun 2026 17:10:07 +0200 Subject: [PATCH 3/5] fix: use vermin to enforce Python 3.10 minimum version in CI Replace the removed ruff E999 rule with vermin, which statically detects the minimum Python version a codebase requires and fails if any file uses syntax or stdlib features beyond the declared floor. Also remove the ruff config from setup.cfg for now. --- .github/workflows/CI.yml | 8 ++++---- setup.cfg | 5 +---- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index cbd9f25..0407d11 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -31,11 +31,11 @@ jobs: with: python-version: '3.10' - - name: Install ruff - run: pip install ruff + - name: Install vermin + run: pip install vermin - - name: Check syntax compatibility (target Python 3.10) - run: python -m compileall -q j1939/ test/ test_helpers/ + - name: Check minimum Python version (must not exceed 3.10) + run: vermin --target=3.10- --backport enum j1939/ test: # The type of runner that the job will run on diff --git a/setup.cfg b/setup.cfg index 6978275..7c2b287 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,2 @@ [bdist_wheel] -universal = 1 - -[ruff] -target-version = "py310" \ No newline at end of file +universal = 1 \ No newline at end of file From e287d448797a12e7026a4aed46911c7b48b891a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Sainz-Maza=20Serna?= Date: Fri, 19 Jun 2026 10:25:43 +0200 Subject: [PATCH 4/5] fix(test): replace fixed sleep with deadline-bounded poll in test_addr_claim_fixed_reduced_time The 100 ms margin (sleep 0.3 s after start(0.2)) was insufficient on loaded macOS CI runners, causing a spurious failure. Switch to the same poll-until-empty + hard deadline pattern used by the other address-claim tests so the assertion fires as soon as the TX message is consumed. --- test/test_ca.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/test_ca.py b/test/test_ca.py index d590848..3abb803 100644 --- a/test/test_ca.py +++ b/test/test_ca.py @@ -68,12 +68,12 @@ def test_addr_claim_fixed_reduced_time(feeder): ) new_ca = feeder.ecu.add_ca(name=name, device_address=128) new_ca.start(0.2) - - # wait until all messages are processed asynchronously - # rounded up to account for scheduling delays - time.sleep(0.3) - # assert that the expected message was sent + # wait until the address claim message is processed, with a 2s timeout + deadline = time.monotonic() + 2.0 + while len(feeder.can_messages) > 0 and time.monotonic() < deadline: + time.sleep(0.050) + assert len(feeder.can_messages) == 0 From 07b6e3b61764523811bef4c46bc8b8db0a03d9f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Sainz-Maza=20Serna?= Date: Fri, 19 Jun 2026 10:43:00 +0200 Subject: [PATCH 5/5] ci: pin actions/checkout and actions/setup-python to Node 24-compatible versions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bump actions/checkout@v4 → v4.2.2 and actions/setup-python@v5 → v5.3.0, both of which declare node24 as their runtime and silence the deprecation warning introduced when GitHub runners defaulted to Node.js 24 in June 2026. https://github.blog/changelog/2025-09-19-deprecation-of-node-20-on-github-actions-runners/ --- .github/workflows/CI.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 0407d11..4f07170 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -25,9 +25,9 @@ jobs: lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v4.2.2 - - uses: actions/setup-python@v5 + - uses: actions/setup-python@v5.3.0 with: python-version: '3.10' @@ -47,9 +47,9 @@ jobs: steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v4 + - uses: actions/checkout@v4.2.2 - - uses: actions/setup-python@v5 + - uses: actions/setup-python@v5.3.0 with: python-version: ${{ matrix.python-version }}