Skip to content

BREAKING: ble and serial dependencies are optional#102

Merged
JPHutchins merged 2 commits intomainfrom
BREAKING/transports-optional
Mar 4, 2026
Merged

BREAKING: ble and serial dependencies are optional#102
JPHutchins merged 2 commits intomainfrom
BREAKING/transports-optional

Conversation

@JPHutchins
Copy link
Collaborator

Use [ble], [serial], or [all] to enable the transports that are required.

Existing projects are encouraged to use [all] to minimize migration friction.

This is needed for downstream applications, particularly those deployed on embedded linux, that may not want to bring in dependency trees that they are not using, particularly those that would have heavy OS dependencies, like BLE.

Existing projects can migrate safely by changing smpclient -> smpclient[all].

UDP transport support is builtin to python so it is always available.

FYI @otavio this may open the door to slimming (but complicating) the nix builds. That said, we don't intend to release an smpmgr that doesn't have all transports enabled.

Use [ble], [serial], or [all] to enable the transports that
are required.

Existing projects are encouraged to use [all] to minimize
migration friction.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR makes BLE (bleak) and serial (pyserial) transport dependencies optional extras, enabling downstream consumers (e.g., embedded Linux deployments) to avoid pulling in unused/OS-heavy dependency trees while keeping UDP transport always available.

Changes:

  • Moves bleak and pyserial from required deps to [project.optional-dependencies] (ble, serial, all).
  • Adds import-time guards in BLE/serial transport modules to raise a clearer error when the relevant extra isn’t installed.
  • Updates documentation, lockfile metadata, and CI to validate import behavior across extra combinations.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
pyproject.toml Makes BLE/serial optional extras and adds an all aggregate extra; ensures dev env pulls in all transports.
uv.lock Reflects new optional dependency layout and extras metadata; updates dev requirements to include smpclient[all].
src/smpclient/transport/serial.py Wraps pyserial import with a clearer “install extra” error for missing serial support.
src/smpclient/transport/ble.py Wraps bleak import with a clearer “install extra” error for missing BLE support.
src/smpclient/__init__.py Documents that transports are optional extras and UDP is always available.
README.md Adds installation guidance for selecting transports via extras.
.github/workflows/test.yaml Adds CI matrix to verify expected import pass/fail behavior with different extras installed.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@JPHutchins JPHutchins merged commit 20c261e into main Mar 4, 2026
26 checks passed
@JPHutchins JPHutchins deleted the BREAKING/transports-optional branch March 4, 2026 20:19
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.

9 participants