Skip to content

Add packaging, CI, publishing workflow and a byte-level test suite - #1

Merged
DAB-LABS merged 1 commit into
masterfrom
scaffold-and-oracle
Sep 4, 2026
Merged

Add packaging, CI, publishing workflow and a byte-level test suite#1
DAB-LABS merged 1 commit into
masterfrom
scaffold-and-oracle

Conversation

@DAB-LABS

@DAB-LABS DAB-LABS commented Sep 4, 2026

Copy link
Copy Markdown
Owner

Context

First change on the fork. Sets up the repository so later work (the async port, the tick fix, new devices) lands with a real test gate and a real release path. No library behavior changes.

Proposed change

  • Packaging moves to pyproject.toml as the python-broadlink distribution; the import name stays broadlink. Python 3.13 or newer. setup.py and the stale requirements.txt pin are removed.
  • CI runs ruff check and pytest on Python 3.13 and 3.14, builds the sdist and wheel, and checks the wheel imports in a clean environment.
  • publish.yml publishes to PyPI on v* tags using trusted publishing (no API token stored anywhere) and refuses a tag that does not match the package version.
  • tests/oracle: a harness that replaces send_packet on a device instance, records the exact (packet_type, payload) every public method sends, answers with canned responses encrypted under the device's own session key, and captures the decoded result. 155 cases across every device class are frozen in fixtures.json. A coverage test fails if a class grows a public method without a case. The harness accepts awaitables so the same cases will drive the asynchronous port later.
  • tests/test_transport.py: send_packet wire bytes, padding, counter wrap, retry and timeout, short and corrupted responses, auth() handshake and session key install, scan/discover/hello packet layout and reply parsing, gendevice mapping, the product table having no duplicate ids, setup() packet layout, and the error code table.
  • tests/test_helpers.py: pulse packing at the current 32.84 tick (pinned on purpose; it changes with the tick fix), CRC16, and the protocol datetime.
  • README fork notice, CHANGELOG.md, MANIFEST.in, .gitignore.

The only edits to library code are three import blocks reordered for ruff.

Type of change

  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • The code change is tested and works locally (pytest).
  • ruff check . passes.
  • New device support was verified on real hardware, or the PR says it was not. (No device changes.)
  • CHANGELOG.md has an entry under Unreleased.

Move packaging to pyproject.toml as the python-broadlink distribution
(import name unchanged), require Python 3.13 or newer, and replace the
flake8 workflow with ruff and pytest on 3.13 and 3.14 plus an sdist and
wheel build. Add a trusted-publishing workflow for version tags.

Add tests/oracle: a harness that records the exact request bytes every
public method of every device class sends and the result it decodes
from canned responses, frozen in fixtures.json (155 cases), plus
transport tests for send_packet framing, checksums, auth, discovery,
gendevice and setup, and tests for the pure helpers. No library
behavior changes; three import blocks were reordered for ruff.

Add a README note explaining the fork and a CHANGELOG.
@DAB-LABS
DAB-LABS merged commit ace240a into master Sep 4, 2026
3 checks passed
@DAB-LABS DAB-LABS mentioned this pull request Sep 4, 2026
5 tasks
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.

1 participant