Skip to content

Fix/ruff linting#122

Open
RaulSMS wants to merge 96 commits into
juergenH87:masterfrom
RaulSMS:fix/ruff-linting
Open

Fix/ruff linting#122
RaulSMS wants to merge 96 commits into
juergenH87:masterfrom
RaulSMS:fix/ruff-linting

Conversation

@RaulSMS

@RaulSMS RaulSMS commented Jun 18, 2026

Copy link
Copy Markdown

Fix RaulSMS#18

And also fix the ruff check . warnings:

:~/python-can-j1939 $ ruff check .
All checks passed!

RaulSMS and others added 30 commits May 20, 2026 12:54
To support agentic development
Extend the DTC class and Dm1 sender/receiver to handle SAE J1939-73 SPN
conversion methods 1, 2, 3, and 4 (previously only CM 4 / CM-bit-clear
was supported and other methods were logged as errors on receive). TX
takes an optional per-DTC 'cm' key (default 4); RX disambiguates the
CM-bit-set case via a new Dm1(rx_cm_bit_set=...) constructor arg.
Add support for all four DM1 SPN conversion methods
* feat: remove numpy

* test: add coverage for j1939_22 logic

* test: clean up docs and remove constant

* feat: use constants instead of hardcoded numbers
With the two-thread model introduced in this branch, the protocol thread
iterates _snd_buffer in async_job_thread concurrently with send_pgn being
called from a user/timer thread. The check-then-write on _snd_buffer was
unprotected, creating a live race (RuntimeError: dictionary changed size
during iteration on CPython).

j1939_22.py already wraps its send_pgn buffer writes with _buffer_lock;
this commit brings j1939_21.py to the same standard.

CAN I/O (_send_tp_bam / _send_tp_rts) is intentionally kept outside the
lock to avoid holding it during I/O.
Two new tests in test_threading.py covering the race condition fixed in
the previous commit:

- test_send_pgn_concurrent_no_crash: 4 threads hammer send_pgn while the
  protocol thread is running; verifies no RuntimeError or crash.
- test_send_pgn_j1939_21_buffer_lock_no_race: two threads race to send to
  the same src/dst pair simultaneously; verifies the check-then-write is
  atomic (exactly one succeeds, one is rejected).
#11)

python-can v4.2.0 renamed the Bus() kwarg from 'bustype' to 'interface'
and scheduled 'bustype' for removal in v5.0. Update all examples and the
connect() docstring, and bump the minimum version requirement in setup.py.

Fixes #9.
- Remove test_helpers/__init__.py so find_packages() no longer picks it
  up; feeder.py stays in test_helpers/ as the contributor prefers.
- Move conftest.py to the repo root so pytest auto-discovers the feeder
  fixture — no more explicit `from test_helpers.conftest import feeder`
  in every test file.
- Add test_helpers to find_packages(exclude=...) as an explicit guard.
- Drop the now-redundant explicit fixture imports from all test files.

Fixes the issue documented in reviews/issue-test-folder-structure.md.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…12)

Covers issue #8 — device_address_preferred=0 is falsy in Python, so a
bare truthiness check silently skipped the bypass, leaving the CA in
State.NONE. The fix (is not None guard) was already applied; this test
pins the behaviour so it cannot regress.
…ments

General threading and other misc. improvements
RaulSMS and others added 30 commits June 22, 2026 12:32
Since this is a beta release of the fork it is a common practice to reset the version
feat: migrate packaging to pyproject.toml for PyPI publication as pyt…
helps with
pip install -e ".[test,lint]"
Add Pyright type checking for the core j1939 library folder
during the merge commit 4d1baec to update this branch to latest master I overlooked some already fixed errors.
Add Scorecard workflow for supply-chain security
Generates SLSA (Supply-chain Levels for Software Artifacts) provenance for GitHub releases. This proves to users (and OpenSSF Scorecard) that the release artifacts were securely built inside your GitHub Actions workflow and haven't been tampered with.
Configure Dependabot for GitHub Actions and pip
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 5.3.0 to 6.3.0.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](actions/setup-python@v5.3.0...v6.3.0)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-version: 6.3.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
…/setup-python-6.3.0

chore(deps): bump actions/setup-python from 5.3.0 to 6.3.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add linting checks for CI

3 participants