Skip to main content

Xfina Logo

Xfina (Python Bindings)

Crates.io PyPI npm

Xfina is a blazingly fast library for parsing Indian financial statements (Bank Accounts, Credit Cards, Mutual Funds) and international brokers (IBKR), written in Rust and exposed to Python via PyO3.

It converts raw PDFs, Excel files, and CSVs into structured, ReBIT-compliant JSON dictionaries in milliseconds.

Installation

pip install xfina

Quick Start

The Python bindings expose the same entry point as the Rust core. To keep the core parsing logic as pure functions without side-effects (like file I/O), the library requires raw bytes to be passed in rather than file paths.

Parsing a Credit Card Statement

import xfina

with open("statement.xls", "rb") as fh:
    data = fh.read()

# Hand over the bytes; the format is worked out from the content.
statement = xfina.parse(data, filename="statement.xls")

statement["format"]       # "ba-hdfc"
statement["category"]     # "bank_account"
statement["institution"]  # "HDFC Bank"
statement["detection"]    # how it was identified, plus the file's metadata
statement["validation"]   # the two-level validation report
statement["data"]         # the account, in the requested schema

# ReBIT output, or a pinned format that skips detection:
xfina.parse(data, schema="rebit")
xfina.parse(data, **{"as": "ba-hdfc"})

Failures raise xfina.XfinaParseError, which is where this differs from the JS binding: exceptions are the idiom here, so the same information arrives as attributes rather than in an error envelope.

try:
    xfina.parse(data, filename=name)
except xfina.XfinaParseError as e:
    if e.kind == "password_required":
        prompt_for_password(e.format)   # the format the filename suggested

The four functions

Function Purpose
parse(bytes, password=None, filename=None, modified_timestamp=None, **{"as": None}, schema=None) Identify and parse a statement.
detect(bytes, password=None, filename=None, modified_timestamp=None) Identify a statement without parsing it.
formats() Every format this build knows, with id, category, institution, containers and enabled.
version() The version of the parsers actually running.

Release files for xfina 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for xfina 0.5.0
File Size Uploaded
xfina-0.5.0.tar.gz 218.8 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for xfina 0.5.0
File
xfina-0.5.0-cp38-abi3-win_amd64.whl CPython 3.8 abi3 Windows x86-64 Details
xfina-0.5.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.8 abi3 Linux glibc 2.17+ x86-64 Details
xfina-0.5.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.8 abi3 Linux glibc 2.17+ ARM64 Details
xfina-0.5.0-cp38-abi3-macosx_11_0_arm64.whl CPython 3.8 abi3 macOS 11.0+ ARM64 Details
xfina-0.5.0-cp38-abi3-macosx_10_12_x86_64.whl CPython 3.8 abi3 macOS 10.12+ x86-64 Details

Total release size: 12.4 MB

Release files / xfina-0.5.0.tar.gz

Download URL xfina-0.5.0.tar.gz
Size 218.8 kB
Tags Source
SHA-256 checksum
How to use checksums
12ebbc533f6c1570e35f3902691fecd1e138441aa91f27855f40206c3b81bb76
BLAKE2b-256 checksum
How to use checksums
727e9e1ccebfe1d19f528d685b74505609aaf0d398adb190459c57ffd3aca431
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 Sep 11, 2026.

Transparency log

Release files / xfina-0.5.0-cp38-abi3-win_amd64.whl

Download URL xfina-0.5.0-cp38-abi3-win_amd64.whl
Size 2.3 MB
Tags CPython 3.8 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
a877b529e7a0e62ccd6d70cb307f6bc9d65986e0835aedd07342da27496fce78
BLAKE2b-256 checksum
How to use checksums
261868fd40ae4fc897e7e26790418d45f4b97b06defe9cb544714a48541839e5
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 Sep 11, 2026.

Transparency log

Release files / xfina-0.5.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL xfina-0.5.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 2.6 MB
Tags CPython 3.8 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
0cfed650d90675a00b6e3cf769489c98c80d6430b5104ff33568bc5a13b84e28
BLAKE2b-256 checksum
How to use checksums
ace4d39d35a72137b807215ece4eec0c9e225b3c00f35dcc94c7c5f687ae5302
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 Sep 11, 2026.

Transparency log

Release files / xfina-0.5.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL xfina-0.5.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 2.6 MB
Tags CPython 3.8 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
49584a2ca0bf20b8e8bfbd4dd5cac746977b7dfb79b54886c9850319a76b20f2
BLAKE2b-256 checksum
How to use checksums
6f8d598d0f600bac5b06e9ebf87a832fca7c93b6da75a7db7ef09240926d86c1
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 Sep 11, 2026.

Transparency log

Release files / xfina-0.5.0-cp38-abi3-macosx_11_0_arm64.whl

Download URL xfina-0.5.0-cp38-abi3-macosx_11_0_arm64.whl
Size 2.3 MB
Tags CPython 3.8 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
79555fe922be11a5f533860fec1cb18a0837cea625030b87f18e339b42e522ea
BLAKE2b-256 checksum
How to use checksums
fae60c9e23dd1c29d1316e2854c8d5b941c14ba6cededf02ca56f19cbeeee647
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 Sep 11, 2026.

Transparency log

Release files / xfina-0.5.0-cp38-abi3-macosx_10_12_x86_64.whl

Download URL xfina-0.5.0-cp38-abi3-macosx_10_12_x86_64.whl
Size 2.4 MB
Tags CPython 3.8 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
5c04b3f505f640b7cd5a5eb685124ae08b549be1951e17ad409684995b73ebfd
BLAKE2b-256 checksum
How to use checksums
563e06f9c5051204c8189524b6595d8358ec51d909c91f8902fd787e44d9bce4
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 Sep 11, 2026.

Transparency log

Release history Release notifications | RSS feed

0.7.0

6 release files

0.6.1

6 release files

0.6.0

6 release files

This release

0.5.0 This release

6 release files

0.4.1

6 release files

0.4.0

5 release files

0.3.0

1 release file

0.2.4

1 release file

0.2.3

1 release file

0.2.2

1 release file

0.2.1

1 release file

0.1.4

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1.0

1 release file

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