QR codes in your terminal: Unicode half-block rendering, Rich integration, wallet-URI helpers
Project description
cuere
QR codes in your terminal — the way Claude Code CLI draws its remote-connection codes: Unicode half-blocks, low error correction so the code stays small, a proper quiet zone. Plus a Rich renderable and helpers for crypto-wallet URIs.
█▀▀▀▀▀█ ▄▀ ▄▀ █▀▀▀▀▀█
█ ███ █ ▄▀ ▄ █ ███ █
█ ▀▀▀ █ ▄▄█▀█ █ ▀▀▀ █
▀▀▀▀▀▀▀ ▀ █▄█ ▀▀▀▀▀▀▀
█▀█▀▀▄▀▀▀▀ █▀ █ █▄█▄
▄▄▄▄▄▀▄▀▀█▀ ▀ ▄█▀ ▀
▀▀ ▀▀ ██▀█▄█▄ ▀▄▀▄▄
█▀▀▀▀▀█ ▀▄█▄█▄█▀ ▄▀ █
█ ███ █ █ ▄ █ █ █
█ ▀▀▀ █ █ ▄▀ ▀ ▄█ █ ▄
▀▀▀▀▀▀▀ ▀ ▀ ▀ ▀ ▀
Install
uv add cuere # or: pip install cuere
Use
from cuere import render, show, fits
payload = "wc:7f6e504b...@2?relay-protocol=irn&symKey=587d..."
show(payload) # prints to stdout
text = render("HELLO", mode="block", invert=True) # returns a str
if not fits(payload): # does it fit the terminal?
...
With Rich (centering, panels, layouts):
from rich.console import Console
from rich.panel import Panel
from cuere.rich import QRCode
Console().print(Panel(QRCode("bitcoin:BC1Q..."), title="scan to pay"), justify="center")
Wallet URIs — optimize_uri() uppercases a fully lowercase bitcoin: or
lightning: URI (bech32 is case-insensitive per BIP-173) so it encodes in QR
alphanumeric mode, yielding a smaller code. Other schemes (e.g. ethereum:,
whose EIP-55 checksums are case-significant), mixed-case URIs, and URIs with
non-alphanumeric query parts are returned unchanged:
from cuere import optimize_uri
optimize_uri("bitcoin:bc1q...") # -> "BITCOIN:BC1Q..."
Need the raw module grid (to render it yourself or inspect it)? Encode to a
QRMatrix:
from cuere import QRMatrix
m = QRMatrix.encode("HELLO", error="L", border=4)
m.modules # tuple[tuple[bool, ...], ...] — True is a dark module
m.size # side length, quiet zone included
CLI:
cuere "wc:...your walletconnect uri..."
echo "some payload" | cuere
cuere --input payload.txt # read the payload from a file
cuere 12345 --micro # compact Micro QR for a tiny payload
cuere HELLO --mode ansi --invert --border 2 --error M
Rendering modes
| mode | one module is | width of a v2 code | notes |
|---|---|---|---|
half (default) |
½ character (▀▄█) |
33 cols | survives copy-paste; inherits terminal colors |
ansi |
½ character, forced black-on-white | 33 cols | theme-proof; falls back to half when piped or NO_COLOR is set |
block |
2 characters (██) |
66 cols | most font-robust, twice as wide |
The block-drawing glyphs (█▀▄) are East-Asian Ambiguous width: a terminal
configured to render those double-width will widen the output, so the column
counts above assume standard single-width rendering.
Scanning notes
- On dark terminals the default mode shows an inverted code (light modules
on dark). Modern phone cameras handle this; for a stubborn scanner pass
invert=True/--invert, or usemode="ansi"for spec-correct polarity. - Error correction defaults to
L: screens don't get dirty or torn, and lower correction means a smaller code that fits your terminal. - The quiet zone (4 modules) is part of the output on purpose — don't strip the "blank" margins.
Development
uv sync # editable install via meson-python
uv run pytest # 100% branch coverage enforced
uv run ruff check && uv run mypy src/ tests/ && uv run ty check && uv run basedpyright
uv run pre-commit install --install-hooks
Build-system notes (meson-python):
- Every shipped file must be listed in
src/cuere/meson.build— meson does not glob.tests/test_packaging.pyfails if the list drifts. - The version lives only in the root
meson.build. - sdists are produced from committed files (
meson dist); commit beforeuv build.
License
CC0-1.0 — public domain.
Project details
Release history Release notifications | RSS feed
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 cuere-0.1.0.tar.gz.
File metadata
- Download URL: cuere-0.1.0.tar.gz
- Upload date:
- Size: 89.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 |
7c60a5463855893cebef42ec8e52b77963874e42ab5aee58a2bb6046223474ca
|
|
| MD5 |
beeda9ae3374247390efc1564b83e122
|
|
| BLAKE2b-256 |
2dfb43d2561751c81ee0fa42608f581443b51713b54ca8219c80abd7776735a7
|
Provenance
The following attestation bundles were made for cuere-0.1.0.tar.gz:
Publisher:
release.yml on IvanAnishchuk/cuere
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cuere-0.1.0.tar.gz -
Subject digest:
7c60a5463855893cebef42ec8e52b77963874e42ab5aee58a2bb6046223474ca - Sigstore transparency entry: 1809002384
- Sigstore integration time:
-
Permalink:
IvanAnishchuk/cuere@6fe193ce1374de304ce6575f7fcecd63aff78281 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/IvanAnishchuk
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@6fe193ce1374de304ce6575f7fcecd63aff78281 -
Trigger Event:
push
-
Statement type:
File details
Details for the file cuere-0.1.0-py3-none-any.whl.
File metadata
- Download URL: cuere-0.1.0-py3-none-any.whl
- Upload date:
- Size: 16.2 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 |
6aa0e8173f031645a2222b1c328c5d02ad28903a8836a29a6f970cc9195cbe29
|
|
| MD5 |
359c0e22b0be8c7b07456df1c8cea56c
|
|
| BLAKE2b-256 |
3eef091dbb11d49c6d9b33aa4d12992927f160a1c986267bcb39bec3399b9367
|
Provenance
The following attestation bundles were made for cuere-0.1.0-py3-none-any.whl:
Publisher:
release.yml on IvanAnishchuk/cuere
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cuere-0.1.0-py3-none-any.whl -
Subject digest:
6aa0e8173f031645a2222b1c328c5d02ad28903a8836a29a6f970cc9195cbe29 - Sigstore transparency entry: 1809002423
- Sigstore integration time:
-
Permalink:
IvanAnishchuk/cuere@6fe193ce1374de304ce6575f7fcecd63aff78281 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/IvanAnishchuk
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@6fe193ce1374de304ce6575f7fcecd63aff78281 -
Trigger Event:
push
-
Statement type: