Standalone CLI for Paperang thermal printers
Project description
paperang-cli
paperang-cli is a standalone command-line tool for working with Paperang thermal printers from Python.
It provides a small, script-friendly interface for discovering a printer, checking its status, and printing text or images with explicit safety gates. JSON output is available for automation and agent-driven workflows.
Current Support
Version 0.1.0 supports:
| Printer | Transport | Status |
|---|---|---|
| Paperang P1 | Bluetooth Low Energy (BLE) | Supported |
Local, cable, and USB data transports are not supported for Paperang P1 in this package.
Real printer communication and physical printing have been tested only on Windows. CI runs compatibility checks on Linux and macOS, but those checks do not prove BLE or printer behavior on those platforms.
Features
- Discover nearby Paperang printers over BLE
- Check battery level, Bluetooth MAC address, and live printer status
- Print short text or wrapped paragraphs
- Print local images with sticker and photo conversion presets
- Compose text and an image into one print job
- Preview every print path with
--dry-run - Emit machine-readable JSON with
--json - Use explicit allow flags before any paper-consuming operation
Image and composed printing are available, but remain experimental until you validate physical output on your printer.
Installation
Python 3.10 or newer is required.
Install the published package from PyPI:
python -m pip install paperang-cli
For local development, clone the repository and install it in editable mode:
git clone https://github.com/wyrtensi/paperang-cli.git
Set-Location "paperang-cli"
python -m pip install -e ".[dev]"
python -m pytest
The package installs two equivalent commands:
paperangpaperang-cli
Use paperang by default. Use paperang-cli if the shorter command conflicts with another executable on your system.
Safe First Run
Start with commands that do not consume paper:
paperang --json config show
paperang --json discover
paperang --json probe
paperang --json battery
Before a real print, run the matching command with --dry-run:
paperang --json print text "Hello from Paperang" --dry-run
After checking the result, explicitly allow paper use:
paperang --json print text "Hello from Paperang" --allow-paper-use
Keep the content, image, layout, conversion mode, font size, and feed options the same between dry-run and the real print.
Printing
Text
paperang --json print text "Shipping label" --dry-run
paperang --json print text "Shipping label" --allow-paper-use
Paragraph
paperang --json print paragraph "A longer wrapped note for the printer." --dry-run
paperang --json print paragraph "A longer wrapped note for the printer." --allow-paper-use
Image
Use --mode sticker for logos, icons, and line art:
paperang --json print image ".\sample.png" --dry-run --mode sticker
paperang --json print image ".\sample.png" --allow-paper-use --mode sticker
Use --mode photo as a starting point for photographs and smoother grayscale content:
paperang --json print image ".\photo.jpg" --dry-run --mode photo
Image quality depends on the source file and printer. A successful dry-run validates conversion and packaging, not the final paper output.
Compose
print compose combines wrapped text and an image in one vertical layout:
paperang --json print compose "Product label" ".\sample.png" --dry-run --mode sticker
paperang --json print compose "Product label" ".\sample.png" --allow-paper-use --mode sticker
Use --layout image-above when the image should be printed before the text:
paperang --json print compose "Product label" ".\sample.png" --dry-run --layout image-above
Compose printing uses the same experimental image conversion pipeline as print image.
Built-In Self-Test
The printer self-test consumes substantially more paper than an ordinary print. Use it only when you explicitly want the printer's built-in diagnostic page:
paperang --json print self-test --dry-run
paperang --json print self-test --allow-large-paper-use
The self-test dry-run only validates the CLI path and warning payload. It does not query hidden hardware state.
Commands
| Command | Purpose |
|---|---|
paperang discover |
Scan for nearby supported printers |
paperang battery |
Query the current battery percentage |
paperang mac |
Query the printer-reported Bluetooth MAC address |
paperang status |
Query live printer information |
paperang probe |
Return a combined readiness summary |
paperang print text |
Print a short text block |
paperang print paragraph |
Print wrapped text |
paperang print image |
Print a local image |
paperang print compose |
Print text and an image as one job |
paperang print self-test |
Print the built-in diagnostic page |
paperang config show |
Show the resolved config and active settings |
paperang config path |
Show the resolved config path |
paperang config init |
Write an example config file |
Run paperang --help or paperang <command> --help for the available options.
Configuration
Inspect the active config:
paperang --json config show
Create an example config:
paperang config init
Configuration is resolved in this order:
--config PATHPAPERANG_CLI_CONFIG- the per-user default config path
- built-in defaults
Default paths:
- Windows:
%APPDATA%\paperang-cli\paperang-cli.config.json - Linux and macOS:
$XDG_CONFIG_HOME/paperang-cli/paperang-cli.config.json, or~/.config/paperang-cli/paperang-cli.config.json
See Configuration for the full schema.
Documentation
- Documentation index
- Installation guide
- Command reference
- Configuration
- Troubleshooting
- Agent contract
- Publishing runbook for agents
Project History And Acknowledgements
This standalone CLI builds on earlier reverse engineering and Paperang P1 control work by:
ihc童鞋@提不起劲BroncoTc
The current paperang-cli package is maintained by wyrtensi.
License
This package is available under the MIT License.
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 paperang_cli-0.1.0.tar.gz.
File metadata
- Download URL: paperang_cli-0.1.0.tar.gz
- Upload date:
- Size: 27.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
58aa3caa3e4409eee66ca14093ac8fbec56cfd09e8bd7b813512c72fbc2067e2
|
|
| MD5 |
8fb87b42847b07976e3cf5520d893c84
|
|
| BLAKE2b-256 |
14c8bcc1c082dce2e4c797eecedaaed0c804094e801fc641a84074002483bbb6
|
Provenance
The following attestation bundles were made for paperang_cli-0.1.0.tar.gz:
Publisher:
pypi-publish.yml on wyrtensi/paperang-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
paperang_cli-0.1.0.tar.gz -
Subject digest:
58aa3caa3e4409eee66ca14093ac8fbec56cfd09e8bd7b813512c72fbc2067e2 - Sigstore transparency entry: 1676989899
- Sigstore integration time:
-
Permalink:
wyrtensi/paperang-cli@fa62e7931fdeaf311bab66bf56d49fdebe618098 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/wyrtensi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@fa62e7931fdeaf311bab66bf56d49fdebe618098 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file paperang_cli-0.1.0-py3-none-any.whl.
File metadata
- Download URL: paperang_cli-0.1.0-py3-none-any.whl
- Upload date:
- Size: 30.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1e7bc71b92ad7db4fc566832f40d1a044db07c6599c40af520f78ef56e012b2f
|
|
| MD5 |
28a50713c61b29cfe99747d6e0de9041
|
|
| BLAKE2b-256 |
17e9abed8086df0b022567e2645d673e426a18d9e07a2ef3b1c057f832fc2e84
|
Provenance
The following attestation bundles were made for paperang_cli-0.1.0-py3-none-any.whl:
Publisher:
pypi-publish.yml on wyrtensi/paperang-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
paperang_cli-0.1.0-py3-none-any.whl -
Subject digest:
1e7bc71b92ad7db4fc566832f40d1a044db07c6599c40af520f78ef56e012b2f - Sigstore transparency entry: 1676989902
- Sigstore integration time:
-
Permalink:
wyrtensi/paperang-cli@fa62e7931fdeaf311bab66bf56d49fdebe618098 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/wyrtensi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@fa62e7931fdeaf311bab66bf56d49fdebe618098 -
Trigger Event:
workflow_dispatch
-
Statement type: