Add automated PyPI publish workflow#34
Merged
Merged
Conversation
Add a tag-triggered GitHub Actions workflow that runs the CI test matrix, validates the tag against tapsdk.__version__, builds with python -m build, and publishes via PyPI Trusted Publishing. Document the release process in History.md and remove the unused manual UploadCommand from setup.py.
4 tasks
Stub bleak_winrt modules when simulating Windows so tap.py can import without platform-specific dependencies. Clear tapsdk modules between platform iterations to avoid stale reload state.
Use real bleak_winrt when it is installed instead of replacing it with incomplete stubs. Install winrt stubs in conftest only when the package is unavailable, and restore tapsdk modules after the platform test.
Each OS runner already exercises its own tap.py branch, so drop platform simulation and the bleak_winrt stub machinery.
Remove the separate cross-platform test file and assert TapClient via a lazy import in test_parsers instead, so tap.py is not imported at test collection time before pytest hooks run. Only install bleak/CoreBluetooth stubs on macOS CI runners; Windows and Linux use real bleak/winrt packages. Quote pip extras in workflows for Windows shell compatibility.
Keep the simplified lazy-import platform test, but revert conftest to stub bleak on non-Windows CI runners as before.
Keep the simplified single-platform test, but import tap.py the same way as the previously passing CI fix: clear cached tapsdk modules and load with platform-specific stubs instead of a module-level import.
test_parsers already imports tapsdk.parsers, which loads tap.py on each CI runner. The separate cross-platform test only caused Windows CI import-state issues without adding coverage.
Importing tapsdk.parsers no longer eagerly loads tap.py, which avoided Windows CI import-state issues during test collection. Add back a minimal current-platform TapClient smoke test.
Windows import of tap.py needs bleak_winrt, which is unavailable with bleak 3.x on the CI runners (tracked by #21). Skip the import smoke test on Windows and drop the reload/stub machinery; Linux and macOS still exercise the tap.py import path via conftest bleak stubs.
Guard the platform-specific BLE binding imports (bleak_winrt on Windows, CoreBluetooth internals on macOS) with try/except so importing tapsdk.tap never raises when the backend package is unavailable. This is what broke Windows CI: modern bleak (3.x) no longer ships bleak_winrt (see #21), so the module-level import failed at test collection. Because the module is now importable everywhere, drop the Windows skip on the TapClient import smoke test so it exercises all runners. The Windows BLE runtime path stays broken pending #21, but the failure is now deferred to actual use instead of import time. Co-authored-by: Cursor <cursoragent@cursor.com>
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.
Fixes #22
Summary
Adds tag-triggered GitHub Actions workflow to publish
tapsdkto PyPI automatically after CI checks pass.Changes
.github/workflows/publish.yml— On push ofv*tags:tapsdk/__version__python -m buildpypa/gh-action-pypi-publish)History.md— Documents the release process and one-time PyPI Trusted Publishing setupsetup.py— Removes unused manualUploadCommand/twine uploadpathMaintainer setup (one-time, before first release)
TapWithUstap-python-sdkpublish.ymlpypipypienvironmentHow to release
Follow-up
Track packaging modernization in #35.