Skip to content

Add automated PyPI publish workflow#34

Merged
ilouzl merged 11 commits into
developfrom
cursor/automated-pypi-publisher-659a
Jul 12, 2026
Merged

Add automated PyPI publish workflow#34
ilouzl merged 11 commits into
developfrom
cursor/automated-pypi-publisher-659a

Conversation

@ilouzl

@ilouzl ilouzl commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Fixes #22

Summary

Adds tag-triggered GitHub Actions workflow to publish tapsdk to PyPI automatically after CI checks pass.

Changes

  • .github/workflows/publish.yml — On push of v* tags:
    • Runs the same cross-platform lint + pytest matrix as CI
    • Validates tag version matches tapsdk/__version__
    • Builds with python -m build
    • Publishes via PyPI Trusted Publishing (pypa/gh-action-pypi-publish)
  • History.md — Documents the release process and one-time PyPI Trusted Publishing setup
  • setup.py — Removes unused manual UploadCommand / twine upload path

Maintainer setup (one-time, before first release)

  1. On PyPI → tapsdk → Publishing → add Trusted Publisher:
    • Owner: TapWithUs
    • Repository: tap-python-sdk
    • Workflow: publish.yml
    • Environment: pypi
  2. In GitHub repo settings → Environments → create pypi environment

How to release

# After bumping tapsdk/__version__.py and History.md
git tag -a v0.7.1 -m "Release 0.7.1"
git push origin v0.7.1

Follow-up

Track packaging modernization in #35.

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.
ilouzl and others added 10 commits July 5, 2026 13:12
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>
@ilouzl ilouzl marked this pull request as ready for review July 9, 2026 10:55
@ilouzl ilouzl merged commit 87df110 into develop Jul 12, 2026
10 of 18 checks passed
@ilouzl ilouzl deleted the cursor/automated-pypi-publisher-659a branch July 12, 2026 07:59
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