Add packaging, CI, publishing workflow and a byte-level test suite - #1
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
pyproject.tomlas thepython-broadlinkdistribution; the import name staysbroadlink. Python 3.13 or newer.setup.pyand the stalerequirements.txtpin are removed.ruff checkandpyteston Python 3.13 and 3.14, builds the sdist and wheel, and checks the wheel imports in a clean environment.publish.ymlpublishes to PyPI onv*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 replacessend_packeton 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 infixtures.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_packetwire bytes, padding, counter wrap, retry and timeout, short and corrupted responses,auth()handshake and session key install,scan/discover/hellopacket layout and reply parsing,gendevicemapping, 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.CHANGELOG.md,MANIFEST.in,.gitignore.The only edits to library code are three import blocks reordered for ruff.
Type of change
Additional information
pulses_to_datatick constant (32.84) disagrees with protocol.md (2^-15 s), compressing externally-sourced IR by about 7% mjg59/python-broadlink#839, Fix 839 tick constant mjg59/python-broadlink#841Checklist
pytest).ruff check .passes.CHANGELOG.mdhas an entry under Unreleased.