Metadata-Version: 2.4
Name: larzqr
Version: 0.1.0
Summary: QR code generation from scratch - Reed-Solomon ECC and masking, zero dependencies
Author: larz-scripter
License: MIT
Project-URL: Homepage, https://github.com/larz-scripter/larzqr
Project-URL: Repository, https://github.com/larz-scripter/larzqr
Project-URL: Issues, https://github.com/larz-scripter/larzqr/issues
Keywords: qr,qrcode,reed-solomon,barcode,zero-dependency,pure-python,totp,svg
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# larzqr

**QR codes from scratch — real Reed-Solomon error correction, all eight masks,
zero dependencies.**

Most "pure Python" QR libraries stop at drawing squares. larzqr implements the
*actual standard*: Reed-Solomon ECC over GF(256), the finder / timing /
alignment patterns, BCH-coded format and version information, and penalty-based
mask selection — so the codes it emits are genuinely scannable. No `numpy`, no
`pillow`, no C extension. Just the standard library.

It covers QR versions 1 through 10 in byte mode (up to ~270 bytes at EC level L),
which comfortably fits URLs, Wi-Fi configs, and TOTP provisioning URIs from
[larztotp](https://github.com/larz-scripter/larztotp).

## Install

```bash
pip install larzqr
```

## Use

```python
from larzqr import QR

qr = QR("https://example.com")
print(qr.to_text())              # scannable straight from a terminal

qr = QR("otpauth://totp/App:alice?secret=JBSWY3DPEHPK3PXP&issuer=App",
        error_correction="M")    # L, M, Q, or H
qr.to_svg("login.svg", scale=10) # crisp vector output
qr.matrix                        # the raw list-of-lists 0/1 module grid
qr.version, qr.mask              # picked automatically
```

### Why it's correct, not just plausible

QR generators are easy to get *almost* right and impossible to eyeball. larzqr
is anchored to published constants at every layer:

- **Reed-Solomon** is checked against the standard's worked v1-M example — data
  codewords in, the exact ECC bytes `[196, 35, 39, 119, 235, 215, 231, 226,
  93, 23]` out.
- **Format information** matches the spec table (M/mask0 = `0x5412`,
  L/mask0 = `0x77C4`); **version information** matches the version-7 constant.
- **GF(256)** products are verified against hand-computed values
  (`2 · 128 = 0x1d`).
- Finder patterns, timing patterns, the dark module, and mask selection are all
  tested as structural invariants.

## Tests

```bash
python -m unittest discover -s tests -v   # 29 tests
```

## The Larz stack

One of 60+ pure-Python, zero-dependency libraries at
[github.com/larz-scripter](https://github.com/larz-scripter). Pairs naturally
with [larztotp](https://github.com/larz-scripter/larztotp) (turn a provisioning
URI into a scannable enrollment code) and
[larzhtml](https://github.com/larz-scripter/larzhtml) (drop the SVG straight
into a page).

## License

MIT (c) larz-scripter
