Skip to main content

Fatoority Python bindings

This package wraps Diplomat-generated native bindings with the public fatoora Python API. Install with pip install fatoority and import as fatoora. See Diplomat bindings.

Development (uv)

uv venv
uv pip install .

Build a wheel (uv)

uv build --wheel

Wheels (CI)

  • GitHub Actions uses cibuildwheel to produce platform wheels in dist/ (wheel-only publishing).
  • See .github/workflows/python.yml for the build matrix.

Notes

  • The build step compiles fatoora-ffi with cargo build -p fatoora-ffi --release.
  • The shared library is bundled into the Python package.
  • Building the native extension requires CMake and a C++20 compiler. Nanobind is pinned in the build dependencies. Reinstall the package after native changes.
  • ZATCA API responses are exposed via owned objects with read-only properties (no JSON payloads).
  • Errors are raised as FatooraError subclasses, one per ErrorKind (such as InvalidInputError or NetworkError). Each exception exposes .code, .kind, .message, and .details, a dictionary containing structured validation issues or diagnostics. Unknown codes raise plain FatooraError with .kind set to None.
  • Reinstall the package after changes; the extension loads its bundled shared library.

Examples

python examples/load_lib.py
python examples/invoice_basic.py
python examples/invoice_parse.py

Tests

uv pip install -e .[dev]
SKIP_ZATCA_LIVE_API=1 uv run pytest tests

High-level API

from datetime import datetime, timezone
from uuid import uuid4

from fatoora import (Address, InvoiceBuilder, InvoiceSubType, InvoiceTypeKind,
                     PaymentMeans, VatCategory)

invoice = (
    InvoiceBuilder(
        InvoiceTypeKind.TAX, InvoiceSubType.SIMPLIFIED,
        id="INV-1",
        uuid=uuid4(),
        issue_datetime=datetime.now(timezone.utc),
        currency="SAR",
        previous_invoice_hash="hash",
        invoice_counter=1,
        vat_category=VatCategory.STANDARD,
    )
    .set_seller("Acme Inc", vat_id="399999999900003",
                address=Address("SAU", "Riyadh", "King Fahd", "1234", "12222"))
    .add_payment_means(PaymentMeans("10"))
    .add_line_item(description="Item", quantity="1.0", unit_code="PCE",
                   unit_price="100.0", vat_rate="15.0", vat_category=VatCategory.STANDARD)
    .build()
)
print(invoice.id, invoice.issue_datetime, invoice.totals.payable_amount)
print(invoice.xml)

Header fields can be passed to the constructor or set with the chaining setters. Timestamps accept a timezone-aware datetime or YYYY-MM-DDTHH:MM:SSZ text; UUIDs accept uuid.UUID or text. Invoice data is read through properties (invoice.seller.address.city) and returned as frozen dataclasses (Party, Address, Adjustment, InvoiceLineItem, ...) that can be passed back to a builder: InvoiceBuilder(..., seller=parsed.seller).

Local ZATCA validation

from fatoora import validate_zatca

report = validate_zatca(xml, previous_invoice_hash=previous_hash_from_history)
if not report.is_valid:
    for finding in report.findings:
        print(finding.severity.value, finding.code, finding.message)

validate_zatca returns a frozen ZatcaReport dataclass (report.to_json() gives the JSON report). The report retains warnings and distinguishes rejection from incomplete coverage. Missing predecessor context leaves the report incomplete. Execution failures raise a typed exception with any partial report in error.details["report"]. Standard invoices skip signature/QR checks in this SDK profile. Local integrity does not establish issuer trust or remote acceptance. The wheel embeds runtime schemas and native rules; Java, SDK files and a source checkout are unnecessary.

Upgrading

0.7 removes every name that 0.6 deprecated (Signer, parse_signed_invoice_xml, clearance_status=, ...). See the 0.6 to 0.7 migration guide for each replacement, and the Python reference for older upgrades. The public surface is recorded in tests/public_api.json; regenerate it after an intentional change with python tests/test_public_api.py --update.

Metadata

Release files for fatoority 0.7.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for fatoority 0.7.0
File Actions
fatoority-0.7.0-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details for fatoority-0.7.0-cp313-cp313-win_amd64.whl
fatoority-0.7.0-cp313-cp313-manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.28+ x86-64 Details for fatoority-0.7.0-cp313-cp313-manylinux_2_28_x86_64.whl
fatoority-0.7.0-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details for fatoority-0.7.0-cp313-cp313-macosx_11_0_arm64.whl
fatoority-0.7.0-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details for fatoority-0.7.0-cp312-cp312-win_amd64.whl
fatoority-0.7.0-cp312-cp312-manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ x86-64 Details for fatoority-0.7.0-cp312-cp312-manylinux_2_28_x86_64.whl
fatoority-0.7.0-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details for fatoority-0.7.0-cp312-cp312-macosx_11_0_arm64.whl
fatoority-0.7.0-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details for fatoority-0.7.0-cp311-cp311-win_amd64.whl
fatoority-0.7.0-cp311-cp311-manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.28+ x86-64 Details for fatoority-0.7.0-cp311-cp311-manylinux_2_28_x86_64.whl
fatoority-0.7.0-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details for fatoority-0.7.0-cp311-cp311-macosx_11_0_arm64.whl
fatoority-0.7.0-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details for fatoority-0.7.0-cp310-cp310-win_amd64.whl
fatoority-0.7.0-cp310-cp310-manylinux_2_28_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.28+ x86-64 Details for fatoority-0.7.0-cp310-cp310-manylinux_2_28_x86_64.whl
fatoority-0.7.0-cp310-cp310-macosx_11_0_arm64.whl CPython 3.10 CPython 3.10 macOS 11.0+ ARM64 Details for fatoority-0.7.0-cp310-cp310-macosx_11_0_arm64.whl

Total release size: 67.8 MB

Release files / fatoority-0.7.0-cp313-cp313-win_amd64.whl

Download URL fatoority-0.7.0-cp313-cp313-win_amd64.whl
Size 5.5 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
79edbfae057b525d9f75ffb2166d472b3ec18749e5922870d16669a71c376598
BLAKE2b-256 checksum
How to use checksums
085ac14b822580bbc2b338c4db145766bccc462acce0400558d54fb2dc9ee63d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

Release files / fatoority-0.7.0-cp313-cp313-manylinux_2_28_x86_64.whl

Download URL fatoority-0.7.0-cp313-cp313-manylinux_2_28_x86_64.whl
Size 6.0 MB
Tags CPython 3.13 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
9a37d48544656aebb3c58cfc221eba7d864f364b2d9c650a352d2af021b7c0d6
BLAKE2b-256 checksum
How to use checksums
fd51937fdfe543bf3d873b93adb08738a2d495d8dae81307b20cdbcd4a5c2a7e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

Release files / fatoority-0.7.0-cp313-cp313-macosx_11_0_arm64.whl

Download URL fatoority-0.7.0-cp313-cp313-macosx_11_0_arm64.whl
Size 5.4 MB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
ea27f9b0ff9037e4ca88110c185b4cc30d88b2cb5cec2479a454c007ce24733e
BLAKE2b-256 checksum
How to use checksums
29035e2c81a4bcb47caf24e89141b8e118eb1b1110462b7824a77c2cbe37275d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

Release files / fatoority-0.7.0-cp312-cp312-win_amd64.whl

Download URL fatoority-0.7.0-cp312-cp312-win_amd64.whl
Size 5.5 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
2e076e43851209dfe7f6f9ed23228737957c702ae554bf6d368d278aa6e7c38b
BLAKE2b-256 checksum
How to use checksums
1da5154d014211867eaf08196a38c988adb58d806a30aaf18f9517c365a95a03
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

Release files / fatoority-0.7.0-cp312-cp312-manylinux_2_28_x86_64.whl

Download URL fatoority-0.7.0-cp312-cp312-manylinux_2_28_x86_64.whl
Size 6.0 MB
Tags CPython 3.12 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
f6d90f4a7e2cf6009a16dc4deffe8d4f73cf5d88f1db603371c41bfd4d79a6b9
BLAKE2b-256 checksum
How to use checksums
a9070621e8deef45ca8c13bab8f07a1386c8cecc1fcbe99b3b5c034521bfe274
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

Release files / fatoority-0.7.0-cp312-cp312-macosx_11_0_arm64.whl

Download URL fatoority-0.7.0-cp312-cp312-macosx_11_0_arm64.whl
Size 5.4 MB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
edad265b697aa47d9f4a0102eb7c732291fa0c1fa68ebbd36e830e2b3b813015
BLAKE2b-256 checksum
How to use checksums
885f98dbcf4addc48c50bdd80d060a7db50d550a10ca756ae4a3c43d5ed5728a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

Release files / fatoority-0.7.0-cp311-cp311-win_amd64.whl

Download URL fatoority-0.7.0-cp311-cp311-win_amd64.whl
Size 5.5 MB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
cef608b9b08cb9bb6b4f7282c1d94c03895d16627a3b9bdea40931a843833273
BLAKE2b-256 checksum
How to use checksums
b15b5303f1fbdab83e258823c606ebc9388d40061c76d6d8c7c2a9f75a2506b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

Release files / fatoority-0.7.0-cp311-cp311-manylinux_2_28_x86_64.whl

Download URL fatoority-0.7.0-cp311-cp311-manylinux_2_28_x86_64.whl
Size 6.0 MB
Tags CPython 3.11 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
49c0903e6120238ac03e0651c4808432d41e6ae8f7909faad0621a25bc7e214b
BLAKE2b-256 checksum
How to use checksums
2aba1811776daf213e4181cb4feda97391226b1c105a688ce697add749126ef9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

Release files / fatoority-0.7.0-cp311-cp311-macosx_11_0_arm64.whl

Download URL fatoority-0.7.0-cp311-cp311-macosx_11_0_arm64.whl
Size 5.4 MB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
7fd9102ed15ab137e39880c438b90231a62fa04ce5a8bfdc444808c36d89748a
BLAKE2b-256 checksum
How to use checksums
532b68edbcecff5cea03e61b546533c6a0b4a2382428c920befd5fe3bc330dea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

Release files / fatoority-0.7.0-cp310-cp310-win_amd64.whl

Download URL fatoority-0.7.0-cp310-cp310-win_amd64.whl
Size 5.5 MB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
6f1c21a68b544280283eabf3d2e0b0526905acb309bdbc117fd52f9bde1efdce
BLAKE2b-256 checksum
How to use checksums
86520719897a2a57bc446e78fa9e439a00c47d1d21d31030e5e26c6202a377b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

Release files / fatoority-0.7.0-cp310-cp310-manylinux_2_28_x86_64.whl

Download URL fatoority-0.7.0-cp310-cp310-manylinux_2_28_x86_64.whl
Size 6.0 MB
Tags CPython 3.10 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
ebd8bfad94b032d9ae353f7e550dc08db3856e22ad4c5dc5395199a75f7ccbd6
BLAKE2b-256 checksum
How to use checksums
b25f0a109a91576aa639e223259be18141fb6dc29a45b4ce2c341289fd720aba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

Release files / fatoority-0.7.0-cp310-cp310-macosx_11_0_arm64.whl

Download URL fatoority-0.7.0-cp310-cp310-macosx_11_0_arm64.whl
Size 5.4 MB
Tags CPython 3.10 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
dfc4a96b24d22130ab60888007dedf6e93ecfebf2b6305e96b73498f314f185e
BLAKE2b-256 checksum
How to use checksums
fecb6eef070239918f200a35715ddc902483689a09e1e322ea834c747fa0f90c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

Security for fatoority 0.7.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 12 files in this release have been uploaded with provenance metadata.

Select from 12 files

Attestation for fatoority-0.7.0-cp313-cp313-win_amd64.whl

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page