Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,23 @@ pyoprf offers Python bindings for the liboprf library, allowing integration of O
pip install pyoprf
```

If you need optional transport dependencies:

- `ble` installs `ble_serial`
- `usb` installs `pyudev`
- `all` installs both `ble_serial` and `pyudev`

```bash
# Bluetooth support
pip install "pyoprf[ble]"

# USB support
pip install "pyoprf[usb]"

# All optional transports
pip install "pyoprf[all]"
```

### Installing from source

```bash
Expand Down
4 changes: 4 additions & 0 deletions python/pyoprf/multiplexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ def close(self):

class BLEPeer:
def __init__(self, name, addr, server_pk, client_sk, device="hci0", timeout=5):
if BLE_client is None:
raise ImportError("BLE support requires optional dependency 'ble_serial'. Install pyoprf with the 'ble' extra, e.g. 'pip install pyoprf[ble]'.")
self.name = name
self.address = addr # the MAC address of the device
self.server_pk = server_pk
Expand Down Expand Up @@ -278,6 +280,8 @@ async def read_raw(self,size):

class USBPeer:
def __init__(self, name, serno, server_pk, client_sk, timeout=5):
if pyudev is None:
raise ImportError("USB support requires optional dependency 'pyudev'. Install pyoprf with the 'usb' extra, e.g. 'pip install pyoprf[usb]'.")
self.name = name
self.serno = serno # the serial number of the usb device
self.server_pk = server_pk
Expand Down
5 changes: 3 additions & 2 deletions python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ def read(fname):
license = "LGPLv3",
author = 'Stefan Marsiske',
author_email = 'toprf@ctrlc.hu',
url = 'https://github.com/stef/liboprf/python',
url = 'https://github.com/stef/liboprf/tree/master/python',
long_description=read('README.md'),
long_description_content_type="text/markdown",
packages=find_packages(),
install_requires = ("pysodium", "SecureString", "pyserial", "pyudev", "ble_serial", "pyserial-asyncio"),
install_requires = ("pysodium", "SecureString", "pyserial", "pyserial-asyncio"),
extras_require = {"ble": ("ble_serial",), "usb": ("pyudev",), "all": ("ble_serial", "pyudev")},
classifiers = ["Development Status :: 4 - Beta",
"License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)",
"Topic :: Security :: Cryptography",
Expand Down
Loading