Skip to main content

cadeft

Python Upstream parity Apache 2 License

cadeft is a dependency-free Python library for reading and writing Electronic Funds Transfer (EFT) files following the Payments Canada 005 specification.

It is a Python port of moov-io/cadeft (Go), originally developed by Moov.IO with major contributions from Synctera. See Attribution.

Installation

pip install cadeft

Requires Python 3.10+.

Reading EFT files

cadeft.Reader reads a whole file and returns a cadeft.File:

import cadeft

with open("eft_file.txt", encoding="utf-8") as f:
    eft_file = cadeft.Reader(f).read_file()

for txn in eft_file.txns:
    print(txn)

cadeft.FileStreamer yields one transaction per scan_txn() call, so parse errors can be handled per transaction. EndOfFile signals completion and ParseError a malformed record:

with open("eft_file.txt", encoding="utf-8") as f:
    streamer = cadeft.FileStreamer(f)
    while True:
        try:
            txn = streamer.scan_txn()
        except cadeft.EndOfFile:
            break
        except cadeft.ParseError as err:
            print("parse error:", err)
            continue
        txn.validate()

FileStreamer keeps parser state and is not thread-safe; call scan_txn() from a single thread and hand the resulting transactions to workers.

Writing EFT files

from datetime import date
import cadeft

header = cadeft.NewFileHeader("123456789", 1, date.today(), 610, "CAD")
txn = cadeft.NewCredit(
    "450", 420, date.today(), "123456789", "12345", "222222222222222",
    "payor name", "payee name", "payor long name", "987654321", "54321",
    cadeft.WithCrossRefNo("0000100000024"),
)

eft_file = cadeft.NewFile(header, [txn])
eft_file.validate()  # raises cadeft.ValidationError if the file breaks the 005 spec
print(eft_file.create())

Command line

python -m cadeft --mode parse --file eft_file.txt            # EFT -> JSON
python -m cadeft --mode build --validate --file input.json   # JSON -> EFT

Testing

python -m unittest discover -s tests

tests/test_parity.py checks this package against the original Go implementation at a pinned upstream commit (GO_REFERENCE_COMMIT), which it clones automatically; it needs git and go and is skipped otherwise. Set CADEFT_GO_REF_COMMIT to test another upstream commit.

CI (upstream-parity.yml) replays every upstream moov-io/cadeft commit quarterly (and on pull requests and manual dispatch), and publishes a pass/fail table per commit in the run summary. The release workflow attaches that report to each GitHub release.

Releasing

Update the version in pyproject.toml and CHANGELOG.md, then push a tag (git tag v0.2.0 && git push origin v0.2.0). The release workflow runs the parity suite, builds the package, creates the GitHub release, and publishes to PyPI via trusted publishing (configure the pypi environment).

Project status

cadeft is currently being developed for use in multiple production environments. The library was developed in large part by Synctera. Please star the project if you are interested in its progress. Let us know if you encounter any bugs/unclear documentation or have feature suggestions by opening up an issue or pull request. Thanks!

Attribution

This project is a derivative work of moov-io/cadeft, Copyright 2023 Moov.IO, licensed under the Apache License 2.0. The Go sources were re-implemented in Python. See NOTICE.

License

Apache License 2.0 - See LICENSE for details.

Metadata

Release files for cadeft 0.4.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 cadeft 0.4.0
File Size Uploaded Provenance Actions
cadeft-0.4.0.tar.gz 23.8 kB With provenance Details for cadeft-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cadeft 0.4.0
File Interpreter ABI Platform Actions
cadeft-0.4.0-py3-none-any.whl Python 3 none any Details for cadeft-0.4.0-py3-none-any.whl

Total release size: 42.3 kB

Release files / cadeft-0.4.0.tar.gz

Download URL cadeft-0.4.0.tar.gz
Size 23.8 kB
Tags Source
SHA-256 checksum
How to use checksums
0001aff6d07f598c05f24d18fca90114640cb5beb57c6ba6a49054459c954630
BLAKE2b-256 checksum
How to use checksums
5fa1bed967912fcdb3f4ecf56cfa5ae8834546d2d78656bcb1839bf03befc8a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 20, 2026.

Transparency log

Release files / cadeft-0.4.0-py3-none-any.whl

Download URL cadeft-0.4.0-py3-none-any.whl
Size 18.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9db977e6455ee07926564e0d66e96c73683cf04992e23acc3f15d304f7778527
BLAKE2b-256 checksum
How to use checksums
435794712ae9335f25c4743ab17181feb0dd505d1d06c9f7351cde9d66d121ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 20, 2026.

Transparency log

Security for cadeft 0.4.0

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

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for cadeft-0.4.0.tar.gz

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 Nov 20, 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.

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files Full provenance

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