Skip to main content

Español

purrint logo

Thermal Bluetooth Printer Driver and CLI for Python

Documentation PyPI version Python versions Build Status License: MIT Type Annotated


purrint is an independent, clean-room Python library and command-line interface for communicating with low-cost Bluetooth Low Energy thermal printers (commonly marketed as pocket or cat printers: MX10, MX06, GB01-style, MXW01, and over 100 compatible models). It operates directly via BLE without vendor apps, accounts, or cloud services.

Installation

pip install purrint

To enable QR code generation, install with the optional qr extra:

pip install "purrint[qr]"

Quickstart

import purrint

with purrint.connect_sync() as printer:
    printer.print_image("photo.jpg")
    printer.print_text("Hello from Python!", size=36, align="center")

Features

Capability Description
Discovery Scan for nearby devices, identify models by BLE advertised names, or probe protocols on unknown clones.
Image Processing Automatic EXIF orientation, 90-degree landscape rotation, brightness/contrast/gamma controls, 6 dithering algorithms, and 16-level grayscale support on V5X hardware.
Text Rendering System or custom TrueType fonts, word wrapping, alignment (left/center/right), bold, underline, monospace, and inverted styles.
Receipt Composition QR code rendering with captions, solid/dashed/dotted line separators, and stackable raster components.
Thermal Regulation Preset densities (1 to 7) mapped per model, raw energy/intensity overrides, and configurable print speed.
Hardware Telemetry Status monitoring for out-of-paper conditions, open cover, head temperature, battery level, firmware version, and serial number.
Print Verification Physical print-head progress estimation and flow control to wait until paper feeding completes.
Paper Management Feed in dots or millimeters, retraction, print cancellation, and multi-copy printing with cooling intervals.
Virtual Simulator Built-in software simulator (connect_simulated) for testing pipelines without physical hardware.
Interfaces Full asyncio API, blocking synchronous API (connect_sync), and a CLI tool (purrint).

Command-Line Interface

The package installs the purrint command:

# Discover printers in range
purrint scan

# List all 107 recognized hardware model names
purrint models

# Query hardware state and firmware details
purrint info

# Print one or multiple images
purrint image photo.jpg holiday/*.jpg

# Print images with custom dither and contrast
purrint image photo.jpg --dither atkinson --density 5 --contrast 15

# Print text with formatting
purrint text "Shopping list:\n- Milk\n- Eggs" --size 30 --bold

# Print QR code with caption
purrint qr https://example.com --caption "Scan to visit"

# Advance paper feed
purrint feed 100

# Render to an image preview without physical hardware
purrint text "Test receipt" --simulate preview.png

Use -p <NAME_OR_MAC> to select a target device, and -v or -vv for verbose transport logging.

Python API

Asynchronous API

import asyncio
import purrint

async def main():
    async with await purrint.connect("MX10") as printer:
        print(f"Firmware: {printer.info.firmware}, Status: {printer.status}")

        await printer.print_image(
            "photo.jpg",
            density=5,            # Thermal density: 1 (lightest) .. 7 (darkest)
            dither="floyd",       # floyd | atkinson | bayer | halftone | threshold
            rotate="auto",        # Automatically rotate landscape photos
            contrast=10,
            copies=2,
            cooldown=5,           # Rest interval in seconds between copies
            on_progress=lambda p: print(f"{p.phase}: {p.current_line}/{p.lines}"),
        )

        await printer.print_text("Thank you for your purchase!", size=36, bold=True, align="center")
        await printer.print_qr("https://example.com", caption="Visit Website")
        await printer.feed_mm(10)

asyncio.run(main())

Synchronous API

For scripts that do not run an event loop:

import purrint

# Context manager automatically connects and disconnects
with purrint.connect_sync() as printer:
    printer.print_image("photo.jpg", gray=True)
    status = printer.refresh_status()
    print("Status:", status)

# Direct one-shot helper
purrint.quick_print("photo.jpg")
purrint.quick_print(None, text="Order #1048", size=32)

Layout and Custom Receipts

Combine multiple elements into a single contiguous print job:

from purrint import render_text, render_qr, render_separator, stack

ticket = stack([
    render_text("COFFEE SHOP", size=48, bold=True, align="center"),
    render_separator(style="dashed"),
    render_text("Espresso ........ 2.50\nCroissant ....... 1.80", mono=True),
    render_separator(style="solid"),
    render_qr("https://example.com/receipt/1048", size=200),
])

await printer.print_raster(ticket)

Exception Handling

All library exceptions inherit from purrint.PurrintError:

import purrint

try:
    with purrint.connect_sync() as printer:
        printer.print_text("Sample")
except purrint.OutOfPaperError:
    print("Error: Printer is out of paper.")
except purrint.OverheatError:
    print("Error: Thermal head is cooling down.")
except purrint.PrinterNotFoundError:
    print("Error: No printer found. Ensure device is powered on and Bluetooth is active.")

Supported Hardware

Printers are identified by their advertised BLE broadcast name. Case and trailing random suffixes (e.g. MX10-8A3F) are handled automatically.

  • V5G Protocol Family (50 Models):
    MX01, MX02, MX03, MX05, MX06, MINI PRINTER, JL-BR22, MX07, MX08, MX09, URBANWORX KIDS CAMERA, CYLO BT PRINTER, MXTP-100, AZ-P2108X, MX10, MX11, MX12, PD01, MINISO-M1, LP212, XO POPPY, MX13, BQ01, BQ02, EWTTO ET-Z0499, BQ05, BQ06, BQ07, BQ7A, BQ7B, BQ08, BQ95, BQ96, MXW009, MXW010, EWTTO ET-N3689, EWTTO ET-N3687, MXPC-100, GV-MA211, KP-IM606, BQ95B, BQ03, BQ95C, BQ06B, X6, K06, BQ17, IM.17, C18, MINISO-M12.

  • V5X Protocol Family / MXW01 Mainboard (57 Models):
    MXW01, X1, X2, C17, MXW-W5, MXW01-1, Portable Printer, Instant Print Plus, REKA, HDMDT-00, JK01, BH03, BHSZY, PD03, FLYINGTIGER097, LP215, KERUI, AI01, M8HZ, HZ-M8, Q15, M13, Q15A, Q15B, Q15C, Q15D, Q15E, Q15Z, STICKERMATE, Q17, MXW13, MXW18, ADQ19, QD01, JME13, JME15, LP28AI, BQTLY, STERENIA-PRINT, LEAPOM, IHEARTYARD, ELECOUTEK, Q25SZY, TCM747736, P4, RS6301985, M13SZY, TK914, TK894, D20, Q20, Q16SZY, OHELLAATP01, Q5, Q6, JME05, Q10.

Verification Status

Category Details
Verified on Hardware MX10 (V5G, firmware 1.0.11): Device discovery, telemetry, text printing, raster images, QR codes, feed operations, and completion synchronization tested on Windows 10.
Verified via Simulator V5X / MXW01: Protocol implementation (dot and 4-bit grayscale rasterization, intensity control, head telemetry) verified byte-for-byte against captured traces and protocol specifications.
Firmware Dependent Reverse feeding (retract), open-cover sensor reporting, and battery percentages on V5G devices depend on individual firmware revisions.

Platform and Connection Notes

  • Single Host Requirement: Bluetooth Low Energy printers accept only one active connection at a time. Disconnect mobile applications or phone Bluetooth before connecting from a desktop.
  • Windows 10/11: Native support without manual pairing.
  • Linux: Requires BlueZ 5.55+ and appropriate permissions (user in bluetooth group).
  • macOS: Grant Bluetooth permissions to the host terminal or application.
  • Hardware Specs: Standard roll width is 57 mm. Print head contains 384 dots (48 mm effective width) at 203 DPI (8 dots/mm).

Development

git clone https://github.com/raidenmaister/purrint.git
cd purrint
python -m venv .venv
# Windows: .venv\Scripts\activate | Unix: source .venv/bin/activate
pip install -e ".[dev]"
pytest

License

This project is licensed under the terms of the MIT License.

All brand names, trademarks, and model numbers are the property of their respective owners and are referenced solely for hardware compatibility purposes.

Metadata

Release files for purrint 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for purrint 0.1.1
File Size Uploaded Provenance Actions
purrint-0.1.1.tar.gz 52.4 kB With provenance Details for purrint-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for purrint 0.1.1
File Interpreter ABI Platform Actions
purrint-0.1.1-py3-none-any.whl Python 3 none any Details for purrint-0.1.1-py3-none-any.whl

Total release size: 103.2 kB

Release files / purrint-0.1.1.tar.gz

Download URL purrint-0.1.1.tar.gz
Size 52.4 kB
Tags Source
SHA-256 checksum
How to use checksums
88e29c0fbb67d55696bc23fbeec23c2d3f64b6d6f148df15f5cb0f3640ca21a3
BLAKE2b-256 checksum
How to use checksums
3c7478ae95aeca6573d9caeb8a6459ab61a6c38de664c1190ecc9b91314e1f6f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

Release files / purrint-0.1.1-py3-none-any.whl

Download URL purrint-0.1.1-py3-none-any.whl
Size 50.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
87cefd77475d692f12299e3c978b3687e1cf8dc05ba7679ca7cf155a5743d652
BLAKE2b-256 checksum
How to use checksums
727611db22d78257d308b3d720e682753fa6c8d462378ba665986c3a4224aacf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

Security for purrint 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for purrint-0.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page