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.4.3

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

Total release size: 82.2 MB

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

Download URL fatoority-0.4.3-cp313-cp313-win_amd64.whl
Size 5.4 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
69a30a28c4b2fdcf781b4435ed1ea1be25aec76d08ba9e3a741258ab9a24380d
BLAKE2b-256 checksum
How to use checksums
f0c8530e0c115a671cc2959c099395b4917cb29e95393e1d765e27b8380c4f78
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 15, 2026.

Transparency log

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

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

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 Oct 15, 2026.

Transparency log

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

Download URL fatoority-0.4.3-cp313-cp313-macosx_11_0_arm64.whl
Size 5.3 MB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
c8c72378f8340d3ff0605ae22b25c5922b298d85a055b8d01f8efc4763c2d0da
BLAKE2b-256 checksum
How to use checksums
6e8f0cb0f739013313023b37d6836156b9851bc775a08d109ab42d2715de1c6f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 15, 2026.

Transparency log

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

Download URL fatoority-0.4.3-cp312-cp312-win_amd64.whl
Size 5.4 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
325bde7be739898f8f3eb1c6464c8c153d735189bbcbdd67cc0cb5cbdcb9a65b
BLAKE2b-256 checksum
How to use checksums
2d6c0ac62d6a22a301a4cb1fd15f7c9632ca228cd6670ce2672ce49acc0838ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 15, 2026.

Transparency log

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

Download URL fatoority-0.4.3-cp312-cp312-manylinux_2_28_x86_64.whl
Size 5.8 MB
Tags CPython 3.12 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
2d5e3fe22bf1cc3a2a355e50fc01ed2dc584629eb97647b5f738f71cd4643db7
BLAKE2b-256 checksum
How to use checksums
99b2955b8268b57f5d65c1710c99ec4439650726feaa4efb8875ceb2ee0d7200
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 15, 2026.

Transparency log

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

Download URL fatoority-0.4.3-cp312-cp312-macosx_11_0_arm64.whl
Size 5.3 MB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
c7a315498e99527b04e1361d84a09d72a6d0c852a9a57c8b68ccad2313119b74
BLAKE2b-256 checksum
How to use checksums
49445c16532d67cf15001c74597010b4d261b99b3d8dde3480b5c9737f710578
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 15, 2026.

Transparency log

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

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

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 Oct 15, 2026.

Transparency log

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

Download URL fatoority-0.4.3-cp311-cp311-manylinux_2_28_x86_64.whl
Size 5.8 MB
Tags CPython 3.11 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
2a89fb2a9483711958db742b8d473da683ac96cebb952d3ff28912a6cec5564a
BLAKE2b-256 checksum
How to use checksums
1da495ad5869206a3ea054ffcf0f3e7c2a6a8525a7cb1aaee5558bbd220842de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 15, 2026.

Transparency log

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

Download URL fatoority-0.4.3-cp311-cp311-macosx_11_0_arm64.whl
Size 5.3 MB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
ffa62abb73a332cd0bccee250afc00765687b8cad313a8a631966e6e4a87a7b1
BLAKE2b-256 checksum
How to use checksums
c1c75063e26176ce0aa52b9056d3d51a2daa3bf223acce6d3581ce2e756a16db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 15, 2026.

Transparency log

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

Download URL fatoority-0.4.3-cp310-cp310-win_amd64.whl
Size 5.4 MB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
27da1069376abb9572bf64995090037d0a6ba23cbd5b3f4478060ab3fdf70855
BLAKE2b-256 checksum
How to use checksums
8fa822bcc9b253ea5264fe01e99585aa2cbce8a83c48172b9f19e4ac1b93689d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 15, 2026.

Transparency log

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

Download URL fatoority-0.4.3-cp310-cp310-manylinux_2_28_x86_64.whl
Size 5.8 MB
Tags CPython 3.10 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
0e79047e75d365639bf70ff012f357a19f69f06a7e292da22d287d7f8667b4fa
BLAKE2b-256 checksum
How to use checksums
66736f5c17e3d9b8bd8ef91970a45c1e9f4e4f9bf0d4fed0135872214d3eb191
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 15, 2026.

Transparency log

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

Download URL fatoority-0.4.3-cp310-cp310-macosx_11_0_arm64.whl
Size 5.3 MB
Tags CPython 3.10 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
1f5ac3c426eb94f06b74d46fdf9618659e0f284c5acfc17c291507a32f7bd4b7
BLAKE2b-256 checksum
How to use checksums
59efdeb67eae91f444f8c63f31c30c04ac9b21b3e3576274ccd510661876f755
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 15, 2026.

Transparency log

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

Download URL fatoority-0.4.3-cp39-cp39-win_amd64.whl
Size 5.4 MB
Tags CPython 3.9 Windows x86-64
SHA-256 checksum
How to use checksums
7117bb7072eba46a55beac379fe4c4904b8653fcd8d6d93f20106cec98bc7d3e
BLAKE2b-256 checksum
How to use checksums
2f181eb4ed81bb77ffc3bd7f13a389986ab4a6b986a97653384ab0676b3497bc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 15, 2026.

Transparency log

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

Download URL fatoority-0.4.3-cp39-cp39-manylinux_2_28_x86_64.whl
Size 5.8 MB
Tags CPython 3.9 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
b0a20c3b56ae61315f86e53b40a271a42ec4010979e1c6e48c97e124a38a046a
BLAKE2b-256 checksum
How to use checksums
79dc1fe071fe913e188581dd6bff794763303b60bd7af1da8f8ac0218b36175c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 15, 2026.

Transparency log

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

Download URL fatoority-0.4.3-cp39-cp39-macosx_11_0_arm64.whl
Size 5.3 MB
Tags CPython 3.9 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
f649799a6688173509b982427b2101eae90b040bfc7b35d160d39f20e4d4efc5
BLAKE2b-256 checksum
How to use checksums
3aa6c1f67be7be57f095b6d48f8fb9006b674e1016e5cfe437330174d739b9d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 15, 2026.

Transparency log

Security for fatoority 0.4.3

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.4.3-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 Oct 15, 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