Metadata-Version: 2.5
Name: tallystick-core
Version: 1.0.0
Summary: Deterministic, local-first e-invoice parsing. Reads UBL, CII, Factur-X, ZUGFeRD, XRechnung and template PDFs into one canonical model.
Project-URL: Homepage, https://tally-stick.com
Project-URL: Documentation, https://tally-stick.com/mcp/setup
Author-email: Tallystick <info@tally-stick.com>
License: MIT
License-File: LICENSE
Keywords: cii,e-invoice,en16931,factur-x,invoice,parser,peppol,ubl,xrechnung,zugferd
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Financial and Insurance Industry
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Office/Business :: Financial :: Accounting
Requires-Python: >=3.10
Requires-Dist: invoice2data>=1.0
Requires-Dist: lxml>=5.0
Requires-Dist: openpyxl>=3.1
Requires-Dist: pdfplumber>=0.11
Requires-Dist: pikepdf>=9.0
Requires-Dist: pypdfium2>=4.30
Requires-Dist: python-dateutil>=2.9
Requires-Dist: pyyaml>=6.0
Provides-Extra: dev
Requires-Dist: pytest>=8.0; extra == 'dev'
Provides-Extra: gui
Requires-Dist: fpdf2>=2.7; extra == 'gui'
Requires-Dist: matplotlib>=3.8; extra == 'gui'
Requires-Dist: pandas>=2.0; extra == 'gui'
Requires-Dist: pyside6>=6.6; extra == 'gui'
Requires-Dist: watchdog>=4.0; extra == 'gui'
Description-Content-Type: text/markdown

# Tallystick

**Deterministic, local-first invoice & e-invoice intelligence.**
Finance-grade document processing that runs 100% on your machine — no cloud,
no API keys, no subscription, no AI hallucinations. Same input, same output,
every time.

> A *tally stick* was the original tamper-proof financial record: a notched
> stick split in two, one half for each party. Verification meant matching the
> halves. Tallystick does the same for your documents — everything must tally.

## What it does

- **E-invoice native** — reads Factur-X / ZUGFeRD (XML embedded in PDF),
  UBL 2.1 and UN/CEFACT CII directly: zero OCR, perfect accuracy. Ready for
  the 2026–2028 global e-invoicing mandates (FR, DE, MY, ID, …).
- **Template extraction** — digital PDF invoices are extracted with
  deterministic per-vendor templates (invoice2data format). Teach a vendor
  once in Teach Studio; every later invoice extracts instantly.
- **Finance-grade validation** — line math, net+tax=gross reconciliation,
  duplicate detection, review queue. Nothing silently wrong.
- **Automation** — watch folder, batch processing, full CLI, local audit trail.
- **Export** — XLSX, CSV, JSON, QBO (QuickBooks) — plus built-in analytics.

## Run

```
python -m venv .venv
.venv\Scripts\python.exe -m pip install -r requirements.txt
.venv\Scripts\python.exe app.py            # desktop app
.venv\Scripts\python.exe cli.py --help     # headless CLI
```

## CLI

```
cli.py process <files-or-dir>     # extract + validate + store
cli.py export --format xlsx --out invoices.xlsx
cli.py watch <dir>                # watch-folder daemon
cli.py stats                      # vendor/month totals
```

## Sample data

```
.venv\Scripts\python.exe sampledata/make_einvoice_samples.py
.venv\Scripts\python.exe sampledata/make_pdf_samples.py
.venv\Scripts\python.exe cli.py process sampledata/out
```

## Architecture

```
engine/einvoice.py   Factur-X/ZUGFeRD/UBL/CII parsers (lxml + pikepdf)
engine/extract.py    invoice2data template extraction (pdfplumber backend)
engine/teach.py      teach-once template drafting (candidates -> YAML)
engine/validate.py   arithmetic + consistency checks
engine/exports.py    XLSX/CSV/JSON/QBO
store.py             SQLite archive + audit trail
ui/                  PySide6 "Counting House" interface
```

All processing is offline. The only optional download is an OCR pack for
scanned documents (planned; scans are detected and flagged today).

## License note

Built on MIT/BSD/Apache dependencies only (pdfplumber, pypdfium2, invoice2data,
pikepdf, lxml, pandas). No AGPL components.
