Python bindings for the fatoora ZATCA SDK
Project description
fatoora Python bindings
This package wraps the fatoora-ffi shared library via cffi.
Development (uv)
uv venv
uv pip install -e .
Build a wheel (uv)
uv build --wheel
Wheels (CI)
- GitHub Actions uses
cibuildwheelto produce platform wheels indist/(wheel-only publishing). - See
.github/workflows/python-wheels.ymlfor the build matrix.
Notes
- The build step compiles
fatoora-ffiwithcargo build -p fatoora-ffi --release. - The shared library is bundled into the Python package.
- For local dev without install, set
FATOORA_FFI_PATHor build and use the repotarget/output. - If a
fatoora_ffi.hheader is present (fromFATOORA_CBINDGEN=1 cargo build -p fatoora-ffi), the Python wrapper will load its declarations automatically. You can override the header withFATOORA_FFI_HEADER=/path/to/fatoora_ffi.h.
Examples
python examples/load_lib.py
python examples/invoice_basic.py
python examples/invoice_parse.py
Tests
uv pip install -e .[dev]
uv run pytest tests
High-level API
from datetime import datetime, timezone
from fatoora import InvoiceBuilder, InvoiceSubType, InvoiceTypeKind, VatCategory
builder = InvoiceBuilder.new(
invoice_type=InvoiceTypeKind.TAX,
invoice_subtype=InvoiceSubType.SIMPLIFIED,
invoice_id="INV-1",
uuid="123e4567-e89b-12d3-a456-426614174000",
issue_datetime=datetime.now(timezone.utc),
currency_code="SAR",
previous_invoice_hash="hash",
invoice_counter=1,
payment_means_code="10",
vat_category=VatCategory.STANDARD,
seller_name="Acme Inc",
seller_country_code="SAU",
seller_city="Riyadh",
seller_street="King Fahd",
seller_building_number="1234",
seller_postal_code="12222",
seller_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())
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fatoora_rs-0.1.0-py3-none-any.whl.
File metadata
- Download URL: fatoora_rs-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.4 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Void","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
24bae4d10558876af32869075d2bd387f24d7b3a42e3e4f4d92578a82143760e
|
|
| MD5 |
27741766a1e0d0f2cb2815ce8636526d
|
|
| BLAKE2b-256 |
f531a59e5d3767b58a2fb97d67f97d55e7a69c1ecca2f98f49661d7bf9064ce7
|