Metadata-Version: 2.4
Name: pykude
Version: 0.1.0
Summary: Python library for generating KuDE PDF from SIFEN XML (Paraguay)
Author-email: mileo <mileo@kmee.com.br>
License-Expression: MIT
Project-URL: Homepage, https://github.com/KMEE/pykude
Project-URL: Source, https://github.com/KMEE/pykude
Keywords: sifen,kude,factura-electronica,paraguay,ekuatia,pdf,documento-electronico,set,fiscal
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
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 :: Office/Business :: Financial
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: fpdf2>=2.7.0
Requires-Dist: lxml
Requires-Dist: python-barcode
Requires-Dist: phonenumbers
Provides-Extra: qrcode
Requires-Dist: qrcode[pil]; extra == "qrcode"
Provides-Extra: cli
Requires-Dist: click; extra == "cli"
Requires-Dist: PyYAML; extra == "cli"
Provides-Extra: all
Requires-Dist: qrcode[pil]; extra == "all"
Requires-Dist: click; extra == "all"
Requires-Dist: PyYAML; extra == "all"
Provides-Extra: test
Requires-Dist: pytest; extra == "test"
Requires-Dist: pytest-cov; extra == "test"
Requires-Dist: qrcode[pil]; extra == "test"
Dynamic: license-file

# pykude

Python library for generating **KuDE** (Kuatia Documento Electrónico) PDF representations from SIFEN XML documents (Paraguay electronic invoicing system).

Inspired by [BrazilFiscalReport](https://github.com/Engenere/BrazilFiscalReport).

## Installation

```bash
pip install pykude[all]
```

## Quick Start

```python
from pykude import KudeFe

with open("factura.xml", "r", encoding="utf-8") as f:
    xml = f.read()

kude = KudeFe(xml=xml)
kude.output("kude_factura.pdf")
```

## Auto-detect Document Type

```python
from pykude import auto_kude

kude = auto_kude(xml=xml_content)
kude.output("kude.pdf")
```

## Supported Document Types

| KuDE Type | Class | Description |
|-----------|-------|-------------|
| Factura Electrónica (FE) | `KudeFe` | Electronic Invoice |
| Nota de Crédito (NCE) | `KudeNce` | Credit Note |
| Nota de Débito (NDE) | `KudeNde` | Debit Note |
| Autofactura (AFE) | `KudeAfe` | Self-Invoice |
| Nota de Remisión (NRE) | `KudeNre` | Remission Note |
| Comprobante de Retención (CRE) | `KudeCre` | Withholding Certificate |

## Configuration

```python
from pykude.kude_fe import KudeFe, KudeFeConfig, Margins

config = KudeFeConfig(
    logo="path/to/logo.png",
    margins=Margins(top=8, right=8, bottom=8, left=8),
)

kude = KudeFe(xml=xml_content, config=config)
kude.output("kude.pdf")
```

## Ticket Format (80mm thermal printer)

```python
from pykude.kude_ticket import KudeTicket

kude = KudeTicket(xml=xml_content)
kude.output("ticket.pdf")
```

## CLI

```bash
# Generate KuDE from XML
pfr kude-fe factura.xml -o kude.pdf

# With logo
pfr kude-fe factura.xml --logo logo.png -o kude.pdf

# Ticket format
pfr kude-fe factura.xml --format ticket -o ticket.pdf
```

## Development

```bash
git clone https://github.com/KMEE/pykude.git
cd pykude
pip install -e ".[all,test]"
pytest
```

## License

MIT License - Copyright (c) 2024-2026 KMEE

## Author

mileo (mileo@kmee.com.br)
