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

Total release size: 84.8 MB

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

Download URL fatoority-0.5.0-cp313-cp313-win_amd64.whl
Size 5.5 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
4ec786b24a1599a423711f3d2b21eb47f5cf2d65c5cc0d5aa4c2701cd0c4ae10
BLAKE2b-256 checksum
How to use checksums
44bfe85e3d1159ccbf21f4e99f80778fd183b7db3e2e624fbb9973a7f199ae9c
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 19, 2026.

Transparency log

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

Download URL fatoority-0.5.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
e6a9d2500bd9a7a2cd350ba32fd67ba9e91fa17bb8b4500e3b870842d51a74f5
BLAKE2b-256 checksum
How to use checksums
7f3751b182d58584a2de6fe067423e7ddc8c13a646e65707ed8575fbc7a1ea79
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 19, 2026.

Transparency log

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

Download URL fatoority-0.5.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
4f2c24f5c1991adc3f08609569909812a5b513e1516975f503483d3cebb34b9a
BLAKE2b-256 checksum
How to use checksums
3922ab54731376910a0a6aad08203777fa4ce6273c23e2d071c86e5b407fea12
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 19, 2026.

Transparency log

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

Download URL fatoority-0.5.0-cp312-cp312-win_amd64.whl
Size 5.5 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
f3c03780857c70dc13e9c5c41aaf5e713d51d34594f8f644c5e3c9f2d04633bf
BLAKE2b-256 checksum
How to use checksums
08eaa676e13dab5cb8308bb5ec06a4006685016b8c2abb8ebd0e22b3c74089dd
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 19, 2026.

Transparency log

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

Download URL fatoority-0.5.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
ad97de9f3c73d39ddbd09c67761b263835e28e4a926cf19d2230de41044a6be7
BLAKE2b-256 checksum
How to use checksums
0aeb403650d54fbdffa3405740867e0365bb77f9620cb1db3ecbd31a244bacca
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 19, 2026.

Transparency log

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

Download URL fatoority-0.5.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
47601e3f1c1a7e565b51f5da7d7c9697abaf44532f5d73362a5b5f4ff015a7ce
BLAKE2b-256 checksum
How to use checksums
c331ba79b7c03be7ca83a0b9040cbdb3f9690f58d842db6ea8720dca273eb0c6
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 19, 2026.

Transparency log

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

Download URL fatoority-0.5.0-cp311-cp311-win_amd64.whl
Size 5.5 MB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
44ec4bd32c12d7ab21c93d02c85d42753458f3092abe6fce116c6ff2caacc245
BLAKE2b-256 checksum
How to use checksums
8198c44b8f2ea279b6ad278196a0ca5768221d02ede1b10dd425b9a7348bd586
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 19, 2026.

Transparency log

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

Download URL fatoority-0.5.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
74ffa80c2b458a9598f16a8d128a3753f8406668d45a8a23ca731063f669a354
BLAKE2b-256 checksum
How to use checksums
ad7382605eb061e8bb513f18d0bf5b5ae4e56d39cb7def304d1de2886c05a2bf
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 19, 2026.

Transparency log

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

Download URL fatoority-0.5.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
db230be22b1b52df84318b58e269fad1227008c5568eaaed200a4d13c8be9fa5
BLAKE2b-256 checksum
How to use checksums
f931bffb616e66bcdc760398a8532780e480cae6645348a7f749e8fd43cfa220
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 19, 2026.

Transparency log

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

Download URL fatoority-0.5.0-cp310-cp310-win_amd64.whl
Size 5.5 MB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
0a242c53579d9c84a6dfcd30240ff14d3a720bfe5e3124df23d177c1d98a4713
BLAKE2b-256 checksum
How to use checksums
681981e9008e2b7710bd26b5f48bf0f767648a1076dd8e29796304c1c539ea05
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 19, 2026.

Transparency log

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

Download URL fatoority-0.5.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
6557cac4d6fe4596ec437fa04e6544927090e765feee89b12b6acb5b93f1f1bc
BLAKE2b-256 checksum
How to use checksums
3f752d6d2145383674241c43621cfba82b47d536f045549276c0c3f26ff6f60c
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 19, 2026.

Transparency log

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

Download URL fatoority-0.5.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
d2bbc98da71058afe1e6f1145eac555040cea3848d6a8241087328f06eeaeb7d
BLAKE2b-256 checksum
How to use checksums
7a2fe09db876def534a2dc6b23da3b96ab322a06c3cae1ec29d0a223406a4a53
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 19, 2026.

Transparency log

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

Download URL fatoority-0.5.0-cp39-cp39-win_amd64.whl
Size 5.5 MB
Tags CPython 3.9 Windows x86-64
SHA-256 checksum
How to use checksums
05eadc347b16be69a06d6ba1c008da7b469944b84485c22e5ccb44c555212e09
BLAKE2b-256 checksum
How to use checksums
ebe96bb49113838f62bd86a14f2bab08d8d8010bd7c0b09af8a606fb64e77de9
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 19, 2026.

Transparency log

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

Download URL fatoority-0.5.0-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
4a1495885204528be30af469e0ad245143781477980ca96fb4795469acdcb27d
BLAKE2b-256 checksum
How to use checksums
fec9b53b2ae7387845182effb566ae9cc7ff47958326f13d63ec43e3891228d5
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 19, 2026.

Transparency log

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

Download URL fatoority-0.5.0-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
699d7cc422cd44ecad25a29e2f0a12584f770b8fe66507f5f988e6f3d168400b
BLAKE2b-256 checksum
How to use checksums
783565a2a4a93428432ade6f39a7c94abae75939bcc585517779ba0b66cd83de
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 19, 2026.

Transparency log

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

Select from 15 files

Attestation for fatoority-0.5.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 Oct 19, 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