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

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

Total release size: 82.2 MB

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

Download URL fatoority-0.4.4-cp313-cp313-win_amd64.whl
Size 5.4 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
add8ee304dd35cd42408656c15f7349f30a9565bb08ef2170fcd05ff4dc90c31
BLAKE2b-256 checksum
How to use checksums
f29e24e8a9b36fe1558b0e43204ef3f84ab4a1b83654db71c6e191151591e58c
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 17, 2026.

Transparency log

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

Download URL fatoority-0.4.4-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
f6ec97892055a3f0c548db1053b8318889be9ae59b2a8d2afd507053d9fea535
BLAKE2b-256 checksum
How to use checksums
bf9238ca27508f4282fa99fbb941320100385871136d306a750b059bd2aae6e3
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 17, 2026.

Transparency log

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

Download URL fatoority-0.4.4-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
326a94e233e3b70e5bca2e2655a7071019d7cbe23c5ebed0f3ff8933f49eed40
BLAKE2b-256 checksum
How to use checksums
84220be59c81527fa071d6e77022b9a11ea4184528fdd6d4ea3484ca3b613127
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 17, 2026.

Transparency log

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

Download URL fatoority-0.4.4-cp312-cp312-win_amd64.whl
Size 5.4 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
5e28707e39d88ba12956978bb64668ca62767e1bf04a5453399670c296a3e73e
BLAKE2b-256 checksum
How to use checksums
d5d8f40b84cb67158d472e9ace424ffc97418df8108c365edce05d41eb438331
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 17, 2026.

Transparency log

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

Download URL fatoority-0.4.4-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
f5abb645999943ec0cd006566df88241a88a0ff777c4adcc02b27a66f329b93b
BLAKE2b-256 checksum
How to use checksums
1019f4a3c04ffbadca89ca4277706c01f77e309b4299c8ad716d3d5665db67d6
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 17, 2026.

Transparency log

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

Download URL fatoority-0.4.4-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
7051c99e66c5b844ec7367421a8f3412a69a4702fd3ea0ec824a6afe979af8cb
BLAKE2b-256 checksum
How to use checksums
646fff4a15dc0a8dff258790fa8fe15e303eec952491adec49489b9b93a978f4
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 17, 2026.

Transparency log

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

Download URL fatoority-0.4.4-cp311-cp311-win_amd64.whl
Size 5.4 MB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
21d4a32dbf0278f5ac9824efb8b6f10ca5e09ebe8950c3b9fcbfbc7627a25834
BLAKE2b-256 checksum
How to use checksums
baf12fd644a9d4f6e44600efecbdf46bc27f5ce72a383b5289be53aad3c0e085
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 17, 2026.

Transparency log

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

Download URL fatoority-0.4.4-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
33906e359127ab539aaa08c2c104ad5af7790c4436627787ae9671601642b4d4
BLAKE2b-256 checksum
How to use checksums
3f55b6441d8f9a23aae50fc03a04205f3170148d3ffdc2674ee55cde88189329
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 17, 2026.

Transparency log

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

Download URL fatoority-0.4.4-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
a95ab4c86abc57b5276a8f5157b43e2a5e9ecc2f7b5af596db6d8c7ca03633b3
BLAKE2b-256 checksum
How to use checksums
91cab3fd4d78b0b529fc2594fa498c227c8087e87c2f63bca28a1f6cb87705ba
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 17, 2026.

Transparency log

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

Download URL fatoority-0.4.4-cp310-cp310-win_amd64.whl
Size 5.4 MB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
fe78ea9fb5d524e4c53cbb87e3dc3790f4cebb0a1be9867d0080e149452e2a8a
BLAKE2b-256 checksum
How to use checksums
c5e00a3fc9d2c26f527864b70b3c83f1263f44052559b0a129436c19c6e8cda0
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 17, 2026.

Transparency log

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

Download URL fatoority-0.4.4-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
be5b3c59e428c061ded7f4854c06c5cf88a6d672fef414f3da62966536aee6ac
BLAKE2b-256 checksum
How to use checksums
318fa1c39a4cc687b29e395a8bc73235474f064584d5b976e6bd201b41a07412
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 17, 2026.

Transparency log

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

Download URL fatoority-0.4.4-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
ffed9cabe21b3e99e2444e0d49bff612d354d2a52006b6a8c06bc11ce6553da4
BLAKE2b-256 checksum
How to use checksums
38ac0e34dc2d9e277d5422512f2b4b1ffc2c08717d040432adb084a7b75ef801
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 17, 2026.

Transparency log

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

Download URL fatoority-0.4.4-cp39-cp39-win_amd64.whl
Size 5.4 MB
Tags CPython 3.9 Windows x86-64
SHA-256 checksum
How to use checksums
e130a14cf5fbc27b5d44ec05a2ad52b837153cf566e4cc81fc5afc04e6730a0c
BLAKE2b-256 checksum
How to use checksums
ee6968df30807bb73b0d522abb9099ae358dcc7a7813ae8d37af51063727b4ff
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 17, 2026.

Transparency log

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

Download URL fatoority-0.4.4-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
4c41df2059179c44e3a4c69bbc3a203c75f5867ba7ccdd2add4b38882c13b5b0
BLAKE2b-256 checksum
How to use checksums
e69a8dafeacc74f44b89036f85025ad1c22bebf23522bf8dd174c4a4a8bf68ec
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 17, 2026.

Transparency log

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

Download URL fatoority-0.4.4-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
190c1fd1e461e9b6d1120ad42aa91a064c11611a3dd1fa35608fa4a0998ca38f
BLAKE2b-256 checksum
How to use checksums
aa643205665339d17b5999872dd920c7f662552c8b59d58ab0437ebac334e8af
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 17, 2026.

Transparency log

Security for fatoority 0.4.4

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