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 opaque handles with getters (no JSON payloads).
  • Errors are raised as typed exceptions mapped from FFI error codes (see FfiErrorKind). Each exception exposes .code, .kind, and .details, a dictionary containing structured validation issues or diagnostics. Unknown codes remain available on a generic FfiError.
  • 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 fatoora import InvoiceBuilder, InvoiceSubType, InvoiceTypeKind, VatCategory

builder = InvoiceBuilder.new(
    invoice_type=InvoiceTypeKind.TAX,
    invoice_subtype=InvoiceSubType.SIMPLIFIED,
)
builder.set_id("INV-1")
builder.set_uuid("123e4567-e89b-12d3-a456-426614174000")
builder.set_issue_datetime("2024-01-01T12:30:00Z")
builder.set_currency("SAR")
builder.set_previous_invoice_hash("hash")
builder.set_invoice_counter(1)
builder.set_payment_means_code("10")
builder.set_vat_category(VatCategory.STANDARD)
builder.set_seller(
    name="Acme Inc",
    country_code="SAU",
    city="Riyadh",
    street="King Fahd",
    building_number="1234",
    postal_code="12222",
    vat_id="399999999900003",
)
builder.add_line_item(
    description="Item",
    quantity="1.0",
    unit_code="PCE",
    unit_price="100.0",
    vat_rate="15.0",
    vat_category=VatCategory.STANDARD,
)
invoice = builder.build()
print(invoice.xml())

set_issue_datetime expects a ZATCA ISO UTC timestamp string (YYYY-MM-DDTHH:MM:SSZ).

Local ZATCA validation

from fatoora import Config, validate_zatca_invoice_from_str

with Config() as config:
    report = validate_zatca_invoice_from_str(
        config, xml, previous_invoice_hash=previous_hash_from_history,
    )
if not report["is_valid"]:
    print(report["stages"])

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.

Metadata

Release files for fatoority 0.5.1

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.5.1
File Actions
fatoority-0.5.1-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details for fatoority-0.5.1-cp313-cp313-win_amd64.whl
fatoority-0.5.1-cp313-cp313-manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.28+ x86-64 Details for fatoority-0.5.1-cp313-cp313-manylinux_2_28_x86_64.whl
fatoority-0.5.1-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details for fatoority-0.5.1-cp313-cp313-macosx_11_0_arm64.whl
fatoority-0.5.1-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details for fatoority-0.5.1-cp312-cp312-win_amd64.whl
fatoority-0.5.1-cp312-cp312-manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ x86-64 Details for fatoority-0.5.1-cp312-cp312-manylinux_2_28_x86_64.whl
fatoority-0.5.1-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details for fatoority-0.5.1-cp312-cp312-macosx_11_0_arm64.whl
fatoority-0.5.1-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details for fatoority-0.5.1-cp311-cp311-win_amd64.whl
fatoority-0.5.1-cp311-cp311-manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.28+ x86-64 Details for fatoority-0.5.1-cp311-cp311-manylinux_2_28_x86_64.whl
fatoority-0.5.1-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details for fatoority-0.5.1-cp311-cp311-macosx_11_0_arm64.whl
fatoority-0.5.1-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details for fatoority-0.5.1-cp310-cp310-win_amd64.whl
fatoority-0.5.1-cp310-cp310-manylinux_2_28_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.28+ x86-64 Details for fatoority-0.5.1-cp310-cp310-manylinux_2_28_x86_64.whl
fatoority-0.5.1-cp310-cp310-macosx_11_0_arm64.whl CPython 3.10 CPython 3.10 macOS 11.0+ ARM64 Details for fatoority-0.5.1-cp310-cp310-macosx_11_0_arm64.whl
fatoority-0.5.1-cp39-cp39-win_amd64.whl CPython 3.9 CPython 3.9 Windows x86-64 Details for fatoority-0.5.1-cp39-cp39-win_amd64.whl
fatoority-0.5.1-cp39-cp39-manylinux_2_28_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.28+ x86-64 Details for fatoority-0.5.1-cp39-cp39-manylinux_2_28_x86_64.whl
fatoority-0.5.1-cp39-cp39-macosx_11_0_arm64.whl CPython 3.9 CPython 3.9 macOS 11.0+ ARM64 Details for fatoority-0.5.1-cp39-cp39-macosx_11_0_arm64.whl

Total release size: 84.3 MB

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

Download URL fatoority-0.5.1-cp313-cp313-win_amd64.whl
Size 5.5 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
ad250bb25546c503972ad3b53f94363e692478ed7c95a7bd2127f9bbb3074a7c
BLAKE2b-256 checksum
How to use checksums
42fa5d0fca8d356b38c23e94e7770673ac49145b03dc337803a1536ff61b3a3a
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 17, 2026.

Transparency log

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

Download URL fatoority-0.5.1-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
fefaa41e71a3a243bdcbf30aeacd83cde02a1d6265b1873fe38c27fbc2c30831
BLAKE2b-256 checksum
How to use checksums
ac7745aef2e4e40e9f56000e5e758e18bb0db0445a15d2daed7a2ca318d234ac
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 17, 2026.

Transparency log

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

Download URL fatoority-0.5.1-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
caee1fdb6e26e1812da8191b4a345ab0ff17c7082d87d918252c519419b715d3
BLAKE2b-256 checksum
How to use checksums
bec23c02e8284e0b37dc51ebdc83cc47364195ebb9034c855cff83a2d284cb85
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 17, 2026.

Transparency log

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

Download URL fatoority-0.5.1-cp312-cp312-win_amd64.whl
Size 5.5 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
64d25b9a800f2cabd6ae1213881d63eb9800475973e9ba3ef70f9ea6a497197c
BLAKE2b-256 checksum
How to use checksums
770c6ee73006e7e2b1dc4e25f6ea59543b97d47edc656fbcdbfb9e04683a8c74
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 17, 2026.

Transparency log

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

Download URL fatoority-0.5.1-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
946ffde5dc8b9b7e42a8ada54d5ec08a792671fb0a504a7c3da48e9a4e9aaf8f
BLAKE2b-256 checksum
How to use checksums
a78a5ff7f12c9ccde49ae6d988900519a62cdde9b7f27cdd61c6fa9f99d5a729
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 17, 2026.

Transparency log

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

Download URL fatoority-0.5.1-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
9735d9d826e171d246edb65cc86231c6132f5d1cc8e6071110bcc76167726bad
BLAKE2b-256 checksum
How to use checksums
70dca10798d07a9f61f5ea7338f20c4b1132846531b09a2d670392be85570f74
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 17, 2026.

Transparency log

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

Download URL fatoority-0.5.1-cp311-cp311-win_amd64.whl
Size 5.5 MB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
555037e1b039173124dcdf2dd0f63482b2c95fca3392a26c4d0914d98749e444
BLAKE2b-256 checksum
How to use checksums
c6e280b13bde6f03a019d88919daad76a905beb2a01a302a5c72039dd250a7c3
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 17, 2026.

Transparency log

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

Download URL fatoority-0.5.1-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
f71757d4176172512d135b8b587e61256ae0bcdf56e2ef64a0dad7ee3a493fe9
BLAKE2b-256 checksum
How to use checksums
5088d4f0db21688dbf9089c7bc632f1f5ef7c673de2afbaab8dc134b13beee75
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 17, 2026.

Transparency log

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

Download URL fatoority-0.5.1-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
fc126794018390bb673cd50db8840fddecc28b52efc38151392235e5bb6cb36f
BLAKE2b-256 checksum
How to use checksums
507ed43f9e7938fabd4ca94b00123cd6ee6d64e3eb0c04b35dbfe58894284753
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 17, 2026.

Transparency log

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

Download URL fatoority-0.5.1-cp310-cp310-win_amd64.whl
Size 5.5 MB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
dd5891449e83391d8499508f567e564e6fc158534e8fa3d8096ca28b09ed0712
BLAKE2b-256 checksum
How to use checksums
57c332238154240c1b7f2ae8280ab11c514e95e5d05268150841d18c7230a079
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 17, 2026.

Transparency log

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

Download URL fatoority-0.5.1-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
fa823fec22023b16c1f44a400ed76f99eeabb56a2d4f70e84a849cfecd8b49dc
BLAKE2b-256 checksum
How to use checksums
d97fd775e9c872b2569fe6aff591d8dde25ebe7bfef5dd387eb778f67cfa1f0e
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 17, 2026.

Transparency log

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

Download URL fatoority-0.5.1-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
9a110ebcb4ba128e613873b66a7efeeacca28b5b2092cce0ddb7b82746ee0717
BLAKE2b-256 checksum
How to use checksums
4a2941f6fcff2b60a70fec2d412c8c9298dc94e50de52964aed4f939623c89d0
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 17, 2026.

Transparency log

Release files / fatoority-0.5.1-cp39-cp39-win_amd64.whl

Download URL fatoority-0.5.1-cp39-cp39-win_amd64.whl
Size 5.5 MB
Tags CPython 3.9 Windows x86-64
SHA-256 checksum
How to use checksums
6b82388d0eeaf30e4e7dabff5c0f3dbd02f1f719e12e3bc2495102e8f69ecf08
BLAKE2b-256 checksum
How to use checksums
433fecce0a112e507f72d49600aafac08b84ff151798be20bf931c9d64bcb295
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 17, 2026.

Transparency log

Release files / fatoority-0.5.1-cp39-cp39-manylinux_2_28_x86_64.whl

Download URL fatoority-0.5.1-cp39-cp39-manylinux_2_28_x86_64.whl
Size 6.0 MB
Tags CPython 3.9 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
c52007bd0d051c56d45ac0b03241ed69343fcc8c5e647350f351776768705f5a
BLAKE2b-256 checksum
How to use checksums
19f7b04473c883514b47142002f0fa175851aacb78991bfd5b1728e16494f1ca
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 17, 2026.

Transparency log

Release files / fatoority-0.5.1-cp39-cp39-macosx_11_0_arm64.whl

Download URL fatoority-0.5.1-cp39-cp39-macosx_11_0_arm64.whl
Size 5.4 MB
Tags CPython 3.9 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
8920e16cb0b9923866a97bf099180464ef9c6b8548ab84d80beca9e69386f543
BLAKE2b-256 checksum
How to use checksums
03b77bcb33e17a0567d0eae9989d2513647e179bee1f4f6defb022162c6eb39d
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 17, 2026.

Transparency log

Security for fatoority 0.5.1

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 15 files in this release have been uploaded with provenance metadata.

Select from 15 files

Attestation for fatoority-0.5.1-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 17, 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