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.7.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.7.0
File Size Uploaded
xfina-0.7.0.tar.gz 228.3 kB Details

Built distributions (wheels)

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

Total release size: 12.5 MB

Release files / xfina-0.7.0.tar.gz

Download URL xfina-0.7.0.tar.gz
Size 228.3 kB
Tags Source
SHA-256 checksum
How to use checksums
e70a52e38e7a20cc1b15d3d58c28153e84ab150953e1a839cbcbfdb1271ee0e3
BLAKE2b-256 checksum
How to use checksums
ea3e8028ba7a840fbfdf0840d6da5c749fc7a395b51095951ea20efffc888594
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 18, 2026.

Transparency log

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

Download URL xfina-0.7.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
ddc180b6fd4002bf519d768a1e1875fe0a2e52f1bbaa6ea2302440cb533c6779
BLAKE2b-256 checksum
How to use checksums
956f28a612b16e2b40100e048283c72f6abb402cd70163d2e61d753062abee20
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 18, 2026.

Transparency log

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

Download URL xfina-0.7.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
13d4bc07d9e51fcafce95c5f427b65cbad268bad04def514ea6ba54f07b00a7c
BLAKE2b-256 checksum
How to use checksums
3e45fa3306a363d5b331c8cf5c4ed4a6483bca9c60ebd44b1c22407e03f6d334
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 18, 2026.

Transparency log

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

Download URL xfina-0.7.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
96360b41538bd4852135edbcbd06060c9af0850f9faf2d246201989fd05f1cae
BLAKE2b-256 checksum
How to use checksums
80448966e01cb481584123a9574bc6af19f893f2b372b480b7f12c536e2950c7
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 18, 2026.

Transparency log

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

Download URL xfina-0.7.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
b6513ff0a5c27f81668b8ba6eb49c201ac1a913fe6563cc1fa0c4d1f34767e42
BLAKE2b-256 checksum
How to use checksums
6aae734955deca8eca93e4fad9b753f4e909492036f057de84c8caa262c65a9a
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 18, 2026.

Transparency log

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

Download URL xfina-0.7.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
d7f7c9300f319b8a3714011d78c68309da6ae66a7018da7d9ece2f4d05f60555
BLAKE2b-256 checksum
How to use checksums
b284eff55c9d53c583d4cb5446f4dc6c766c1fb4914c42868be92c87e6755b5e
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 18, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.7.0 This release

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