Skip to main content

Python e-SLOG library. Simplifies the generation of Slovenian e-SLOG electronic documents.

Project description

pyslog - A modern Python library for generating eSLOG invoices

PyPI version License: MIT

[!CAUTION] This library is in its early stages. The current implementation focuses on eSLOG 2.0 Invoices. Other document types and certain niche fields are not yet supported. Please double-check generated XML files against official validators before production use.

Overview

pyslog is designed to provide a clean, Pythonic interface for generating standard-compliant eSLOG 2.0 documents. By separating the complex, segment-based XML logic from simple Pydantic models, we allow developers to focus on their data rather than the intricacies of the eSLOG specification.

Usage

Installation

# Using uv
uv add pyslog

# Using pip
pip install pyslog

Basic Example

from pyslog.eslog2.models import Invoice, BusinessEntity, Item, BusinessProcessType, VATCategoryCode
from pyslog.eslog2.generator import generate_eslog_invoice

# 1. Define the Buyer and Seller
buyer = BusinessEntity(
    name="Buyer Corp",
    address_line_1="Industrial Road 1",
    city="Ljubljana",
    post_code="1000",
    country_code="SI",
    vat_registration_number="SI12345678"
)

seller = BusinessEntity(
    name="Seller Ltd",
    address_line_1="Tech Park 5",
    city="Ljubljana",
    post_code="1000",
    country_code="SI",
    iban="SI5600000000000",
    bic="BANKSI2X",
    vat_registration_number="SI87654321",
    maticna="1234567000"
)

# 2. Define Items
item = Item(
    standard_identifier="1234567890123",
    standard_identifier_identification_scheme_identifier="0088", # EAN
    sellers_item_identifier="SKU-001",
    name="Consulting Services",
    quantity="10",
    quantity_unit_of_measure="HUR", # Hours
    total_monetary_amount="1000.00",
    item_net_price="100.00",
    vat_rate="22",
    vat_category_code=VATCategoryCode.STANDARD_RATE
)

# 3. Create the Invoice
invoice = Invoice(
    invoice_number="INV-2026-001",
    invoice_issue_date="2026-01-13",
    business_process_type=BusinessProcessType.INVOICING_BASED_ON_CONTRACT,
    buyer=buyer,
    seller=seller,
    items=[item],
    sum_of_invoice_line_net_amount="1000.00",
    invoice_total_amount_without_vat="1000.00",
    invoice_total_amount_with_vat="1220.00",
    amount_due_for_payment="1220.00"
)

# 4. Generate XML string
xml_output = generate_eslog_invoice(invoice)

with open("invoice.xml", "w") as f:
    f.write(xml_output)

Roadmap

  • Base eSLOG 2.0 Invoice Model
  • Pydantic integration for type safety
  • Field-level validation (ISO codes, IBAN, etc.)
  • eSLOG 2.0 Order & Order Confirmation
  • eSLOG 2.0 Delivery Note (Dobavnica)
  • Comprehensive documentation site
  • Comprehensive tests

Acknowledgements

Inspired by the early work of python-eracun.

License

MIT License - see LICENSE file for details.

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

pyslog-0.1.0.dev5.tar.gz (15.9 kB view details)

Uploaded Source

Built Distribution

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

pyslog-0.1.0.dev5-py3-none-any.whl (19.8 kB view details)

Uploaded Python 3

File details

Details for the file pyslog-0.1.0.dev5.tar.gz.

File metadata

  • Download URL: pyslog-0.1.0.dev5.tar.gz
  • Upload date:
  • Size: 15.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyslog-0.1.0.dev5.tar.gz
Algorithm Hash digest
SHA256 6306906213a42d880e69f9d6f37fae5b543b66bbb0b4120bfd4c15728fe763f2
MD5 6e0457fe9c9e43e018c0857f939e0385
BLAKE2b-256 8a6b02a57977324a9d1428f5ff05cd2ae4e2473f1e25a431d5ae3887fd5cb8d3

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyslog-0.1.0.dev5.tar.gz:

Publisher: publish.yml on gregorgabrovsek/pyslog

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyslog-0.1.0.dev5-py3-none-any.whl.

File metadata

  • Download URL: pyslog-0.1.0.dev5-py3-none-any.whl
  • Upload date:
  • Size: 19.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyslog-0.1.0.dev5-py3-none-any.whl
Algorithm Hash digest
SHA256 382dafb4219683459e1ce1a1b0bd94eed9a39854d6990f4edacb1e26d19ef033
MD5 065d1e2fcea285cc0f725671a4195852
BLAKE2b-256 a813a25f07a3f1e3683cc640538f72436b1edec10975267c1a209e3c96f1137c

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyslog-0.1.0.dev5-py3-none-any.whl:

Publisher: publish.yml on gregorgabrovsek/pyslog

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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