Skip to main content

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

pybrady-0.1.1.tar.gz (338.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pybrady-0.1.1-py3-none-any.whl (233.5 kB view details)

Uploaded Python 3

File details

Details for the file pybrady-0.1.1.tar.gz.

File metadata

  • Download URL: pybrady-0.1.1.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

Hashes for pybrady-0.1.1.tar.gz
Algorithm Hash digest
SHA256 80fc54aaf66b26dde5fda81da11964b9a72de3b6aa3fe547876ed2cf398f4585
MD5 5a2154f5b5f86e9a5b733ee2cace7dc0
BLAKE2b-256 2a56c93248f06d07436d9adcb2537bb4bb618f397b47928dd6521bb09e9eb3bb

See more details on using hashes here.

File details

Details for the file pybrady-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: pybrady-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 233.5 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

Hashes for pybrady-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1c8a61e53ba65714164425b9ea053d5b8db1911e7316ebd827e654bffd53c7ed
MD5 d91ac74ef6b12580cbccb9564f126bb0
BLAKE2b-256 21afe722d97591d9297f42c1b342342e8ec148d122ce8cac1cea3ea75d6ac743

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page