Metadata-Version: 2.4
Name: larzbarcode
Version: 0.1.0
Summary: EAN-13 and Code 128 barcodes as SVG - zero dependencies
Author: larz-scripter
License: MIT
Project-URL: Homepage, https://github.com/larz-scripter/larzbarcode
Project-URL: Repository, https://github.com/larz-scripter/larzbarcode
Project-URL: Issues, https://github.com/larz-scripter/larzbarcode/issues
Keywords: barcode,ean13,code128,svg,retail,upc,zero-dependency,pure-python
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

# larzbarcode

**EAN-13 and Code 128 barcodes as SVG — zero dependencies.**

Encode retail **EAN-13** product codes and general-purpose **Code 128** (ASCII)
into a module bitmap and a crisp SVG, with correct check digits and the standard
patterns. No image library. Pairs naturally with
[larzqr](https://github.com/larz-scripter/larzqr) when you need 2D codes too.

## Install

```bash
pip install larzbarcode
```

## Use

```python
from larzbarcode import ean13, code128, ean13_check_digit

ean13("400638133393").to_svg("product.svg")   # 12 digits -> check digit appended
ean13("4006381333931")                         # or pass 13 (verified)
code128("SHIP-42").to_svg("label.svg")

ean13_check_digit("978014300723")              # 4
ean13("4006381333931").modules                 # the 0/1 bar pattern (95 modules)
```

## Why it's correct

- **EAN-13 check digits** are verified against known real codes, and the output
  is the fixed 95-module structure with correct guard bars (`101 … 01010 … 101`).
- **Code 128** uses the standard 107-pattern table (validated internally — every
  pattern's bar/space widths sum to 11, the stop to 13) with the weighted
  mod-103 checksum.

## Tests

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

## The Larz stack

One of 60+ pure-Python, zero-dependency libraries at
[github.com/larz-scripter](https://github.com/larz-scripter). The 1D companion to
[larzqr](https://github.com/larz-scripter/larzqr) (QR codes).

## License

MIT (c) larz-scripter
