Python library for Brady label printers (USB, TCP, Bluetooth Classic, BLE)
Project description
pybrady
Python 3.10+ library for communicating with Brady label printers.
Status: pre-alpha. Initial target is the Brady BMP51 over USB. The full framework supports USB, TCP (Wi-Fi / Ethernet), Bluetooth Classic SPP, and BLE across Linux, macOS, and Windows, but only the USB + ESC/BMP path is implemented today.
Supported printers (planned)
| Model | Protocol | Transports | v0.1 |
|---|---|---|---|
| BMP51, BMP53 | ESC/BMP | USB, TCP, Bluetooth Classic | USB only |
| BMP61 | ESC/BMP | USB, TCP | — |
| M610, M710 | ESC/BMP | USB, TCP, BLE | — |
| M611, i5300, S3700, i7500, i4311, C1-30, MJ811 | JSON/PICL | USB, TCP, BLE | — |
| M211, M511, MM100BT | VGL/STX | BLE | — |
Install
pip install 'pybrady[usb]' # USB support (pyusb)
pip install 'pybrady[ble]' # BLE support (bleak)
pip install 'pybrady[all]' # everything
Development
pybrady uses uv for environment management, with ruff for lint/format and pytest for tests.
uv sync --all-extras # create .venv, install package + all optional deps + dev group
uv run pytest # run tests
uv run ruff check # lint
uv run ruff format # format
uv run mypy src # type-check
uv.lock is committed — uv sync produces a reproducible environment across machines. The floor Python version is pinned in .python-version; uv will download it automatically if your system Python doesn't match.
Quick start — CLI
brady-print --list-models # see supported printers
brady-print --text HELLO --dry-run # validate bytes, print nothing
brady-print --text HELLO --dry-run --save out.prn # save raw bytes for replay
brady-print --text HELLO # actually print to a BMP51
Quick start — Python API
import asyncio
from PIL import Image, ImageDraw, ImageFont
from pybrady import BradyPrinter
from pybrady.transport import UsbTransport
async def main():
img = Image.new("1", (600, 200), 1) # 2" x 0.67" @ 300 DPI, white
draw = ImageDraw.Draw(img)
draw.text((20, 20), "HELLO", fill=0) # 0 = black
async with UsbTransport.find_bmp51() as t:
printer = BradyPrinter(t, model="BMP51")
await printer.print(img)
asyncio.run(main())
Permissions (Linux)
The kernel usblp driver claims Brady printers by default. pybrady detaches it automatically at connection time. To avoid running as root:
sudo cp packaging/99-brady.rules /etc/udev/rules.d/
sudo udevadm control --reload
sudo udevadm trigger
Then replug the printer. The rule uses TAG+="uaccess" — systemd-logind grants the active console user ACL access to any Brady USB device, which works out of the box on RHEL/Fedora/Ubuntu/Arch without needing a plugdev or similar group.
License
MPL 2.0. Modifications to pybrady files must be shared back; importing pybrady from proprietary code is fine.
Acknowledgements
Protocol specification based on reverse-engineering of the Brady Express Labels Android app. See /brady_specification.md for the full byte-level spec used to build this library.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pybrady-0.1.2.tar.gz.
File metadata
- Download URL: pybrady-0.1.2.tar.gz
- Upload date:
- Size: 338.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.30 {"installer":{"name":"uv","version":"0.9.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"12","id":"bookworm","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2dff8a747040f80a641d691ac21c40027e6c870cbd0bd788f5f9bca013676cde
|
|
| MD5 |
2d6b8b875da46b9c7138fea24bf459d1
|
|
| BLAKE2b-256 |
c3e6c384f7a0d19f24e74c228866c5f2a284a557c3bb16a6934dd45cf8ad9297
|
File details
Details for the file pybrady-0.1.2-py3-none-any.whl.
File metadata
- Download URL: pybrady-0.1.2-py3-none-any.whl
- Upload date:
- Size: 233.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.30 {"installer":{"name":"uv","version":"0.9.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"12","id":"bookworm","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ffd648770a22591b8ce70fd54276a45e4ddf9cf7502d8cd9e30bcf5c07f24c48
|
|
| MD5 |
c29c2b2e62466bf79f6aa95beeddb28a
|
|
| BLAKE2b-256 |
86b0e76b9700df48a50192be2f54944e684c79635f19388ee447c6049f8e08ec
|