Skip to content

Split usb and ble requirements#21

Merged
stef merged 3 commits into
stef:masterfrom
ricklambrechts:split-requirements
May 20, 2026
Merged

Split usb and ble requirements#21
stef merged 3 commits into
stef:masterfrom
ricklambrechts:split-requirements

Conversation

@ricklambrechts
Copy link
Copy Markdown
Contributor

@ricklambrechts ricklambrechts commented May 19, 2026

There were already checks if the needed package is available:

try:
from ble_serial.bluetooth.ble_client import BLE_client
except ImportError:
BLE_client = None
try:
import pyudev
except ImportError:
pyudev = None

I have moved the packages in setup.py to the extras_require option.

I think this is a breaking change as those dependencies are now not installed by default anymore.

If something needs to be changed, let me know.

@stef
Copy link
Copy Markdown
Owner

stef commented May 19, 2026

thanks for this! the check if these modules are available where intended for the case that pyoprf is installed via distro package managers, not via pip. i do see how this is beneficial to do also for pip installs. i have a question, some pip installs allow to say pip install foo[bar] instead of pip install foo where bar is some variant with more/different deps. would this be possible to do in this case to somehow in setup.py? if so i would prefer a pip install pyoprf[embedded] or [all] variant. would you know how to do this?

@ricklambrechts
Copy link
Copy Markdown
Contributor Author

I am also a bit new to this. In our project we install it through pip and I saw a lot of extra packages installed because of the requirements of these packages, so this is a 'nice to have' cleanup.

I don't have any experience with the extras through distro package managers.

Checking this documentation: https://setuptools.pypa.io/en/latest/userguide/dependency_management.html#optional-dependencies
And checking out other projects using extras: https://github.com/shivendrasoni/vector-cache/blob/main/src/vector_cache/vector_stores/README.md

For the pip part, with this PR it is possible to do pip install "pyoprf[ble]" or pip install "pyoprf[ble,usb]".

We can add an all extra as well. Then I will update the extras_require to extras_require = {"ble": ("ble_serial",), "usb": ("pyudev",), "all": ("ble_serial","pyudev",)},.

@stef
Copy link
Copy Markdown
Owner

stef commented May 20, 2026

wow. that would be super-plus-awesome <3

@ricklambrechts
Copy link
Copy Markdown
Contributor Author

Added the all option.

@sonarqubecloud
Copy link
Copy Markdown

@stef stef merged commit 4468f8d into stef:master May 20, 2026
4 checks passed
@stef
Copy link
Copy Markdown
Owner

stef commented May 20, 2026

much obliged. <3

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.

2 participants