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.3.tar.gz (341.2 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.3-py3-none-any.whl (234.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pybrady-0.1.3.tar.gz
  • Upload date:
  • Size: 341.2 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.3.tar.gz
Algorithm Hash digest
SHA256 da769af1ec1b42e49b5ff5eb2720ff2c9002ba84bbb6a3610e86552063c08671
MD5 daf0a9ae83b67ded56b33ab42ea23fd4
BLAKE2b-256 ce90a19f3599687d523815c986984b5a14359f99a5c187cf2d241fb0a21c395e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pybrady-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 234.0 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 0657f9844ee9d73465eaa6f578f787dbc4be90d3e4c2a1fb569c180b21aa5037
MD5 698e92cde7e32be593dbdda6f1f2ba4f
BLAKE2b-256 413d5d42bd755f818e45fb9119422fc33a30e7bc14e3b8532d65b7264c9d7c9e

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