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.

Metadata

Release files for xfina 0.8.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.8.0
File Size Uploaded
xfina-0.8.0.tar.gz 255.7 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for xfina 0.8.0
File
xfina-0.8.0-cp38-abi3-win_amd64.whl CPython 3.8 abi3 Windows x86-64 Details
xfina-0.8.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.8.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.8 abi3 Linux glibc 2.17+ ARM64 Details
xfina-0.8.0-cp38-abi3-macosx_11_0_arm64.whl CPython 3.8 abi3 macOS 11.0+ ARM64 Details
xfina-0.8.0-cp38-abi3-macosx_10_12_x86_64.whl CPython 3.8 abi3 macOS 10.12+ x86-64 Details

Total release size: 12.8 MB

Release files / xfina-0.8.0.tar.gz

Download URL xfina-0.8.0.tar.gz
Size 255.7 kB
Tags Source
SHA-256 checksum
How to use checksums
10841c241b8a57bb064ec8bbf49b15fc30ce8f8da068aa70878564382bb979eb
BLAKE2b-256 checksum
How to use checksums
68672fe9b14ec8c89c5999a37f53805bd4ed66ce1d88ade0ff5d988196d1e03a
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 2, 2026.

Transparency log

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

Download URL xfina-0.8.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
264ba54501e6f88ec65ed4b55ff0a2d51bad649c5afdd33ba35a51a604f57b7c
BLAKE2b-256 checksum
How to use checksums
8a20234a64e6c90d52212d7acc6d19ad854a095bcb7c1ce21e287ab3b16d4e5f
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 2, 2026.

Transparency log

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

Download URL xfina-0.8.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 2.7 MB
Tags CPython 3.8 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
1aebe8eed962b4126d2af09ceab4198364c8c9efacab0295732af94c745d0a89
BLAKE2b-256 checksum
How to use checksums
63319cf8c833094d619b6099887758eb1ad01ba46d7435e89f6c7230a1b91de3
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 2, 2026.

Transparency log

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

Download URL xfina-0.8.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 2.7 MB
Tags CPython 3.8 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
72ee1610d23cc6065afff357521168985c4381a3c7fa50b73076e0c95c9067e5
BLAKE2b-256 checksum
How to use checksums
87819b68d6dea0cbb37852cf70aaae409b7fad058f61497802818ba453cd207f
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 2, 2026.

Transparency log

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

Download URL xfina-0.8.0-cp38-abi3-macosx_11_0_arm64.whl
Size 2.4 MB
Tags CPython 3.8 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
b6f98f611a365043cc2bf92f87c10408f06a0e6d4bb973b75497d3e161ddeb13
BLAKE2b-256 checksum
How to use checksums
9c6dd74e05bd5c2ca2adfbc684ceb7a87475fa06a854a399c4913f5ab335faee
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 2, 2026.

Transparency log

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

Download URL xfina-0.8.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
fdc7f4396071ccbee72c9c2ee5bda3179ed3671552a0232a3bd5708601d0f882
BLAKE2b-256 checksum
How to use checksums
ae3715311e2026b27d9f2bad09bc5bf3c9fd86387c3410278a9d9094aefe8dd7
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 2, 2026.

Transparency log

Release history Release notifications | RSS feed

0.8.1

6 release files

This release

0.8.0 This release

6 release files

0.7.0

6 release files

0.6.1

6 release files

0.6.0

6 release files

0.5.0

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