Skip to main content

Python library for generating KuDE PDF from SIFEN XML (Paraguay)

Project description

pykude

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

Inspired by BrazilFiscalReport.

Installation

pip install pykude[all]

Quick Start

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

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

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)

from pykude.kude_ticket import KudeTicket

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

CLI

# 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

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)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pykude-0.1.0.tar.gz (23.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pykude-0.1.0-py3-none-any.whl (28.2 kB view details)

Uploaded Python 3

File details

Details for the file pykude-0.1.0.tar.gz.

File metadata

  • Download URL: pykude-0.1.0.tar.gz
  • Upload date:
  • Size: 23.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for pykude-0.1.0.tar.gz
Algorithm Hash digest
SHA256 652bd0e4b82f17cea7b1726092f78d8d36814f0f8bd5a3b47bf38b0d26fbc559
MD5 d2a8e765582bb9726e2dd9f44ce12c78
BLAKE2b-256 42e900d93d7e92e45d194d4da3b8419ef4e0c2c071aa21218599377dbfbeae2f

See more details on using hashes here.

File details

Details for the file pykude-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pykude-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 28.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for pykude-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 db1c6bfbe0e3f245ca7ab5914e14de154049c15b5313e014696cb3418e7895db
MD5 a8525e6381d8ac38871f74f19e5c3321
BLAKE2b-256 f0ffad639b2bfb7c78d774e261c21917242ade156332bae20a6c085b8cf39305

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page