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.0.tar.gz (338.3 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.0-py3-none-any.whl (233.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pybrady-0.1.0.tar.gz
  • Upload date:
  • Size: 338.3 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.0.tar.gz
Algorithm Hash digest
SHA256 c37ab37349e734c9cbea80409225545868ce42db4465f380095c9372dbeb8d81
MD5 f30d5af0878430622e4d47463451be65
BLAKE2b-256 e66dcd2532dc8926a04b974f1e8f54647d1ec1f5337baa90beb28a0f571dd7e8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pybrady-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 233.1 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b02708bceba8eae4f072a86be7c561c405e83e4fa9a6b73700decc80b4ce245e
MD5 6d93c5f274991cdb1882fc2b2dbe3299
BLAKE2b-256 5a4e33bdf8ff45fd6f286bf39fcad3d629cc4dc4978d4c32813181300c23e08b

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