Skip to main content

cfinterface

tests codecov PyPI version Python versions

Python framework for modeling custom file formats with declarative reading, formatting, and writing.

Key Features

  • Fields — typed value containers (LiteralField, IntegerField, FloatField, DatetimeField) with positional formatting for both text and binary files
  • Line — ordered collection of fields that models a single line or record
  • Register / RegisterFile — single-line blocks identified by a beginning pattern, ideal for files with many line types
  • Block / BlockFile — multi-line blocks with beginning/ending patterns, for complex structured files
  • Section / SectionFile — ordered, non-overlapping divisions of file content
  • TabularParser — schema-driven tabular parsing with fixed-width or delimiter-separated layouts
  • Versioning — VERSIONS dict with resolve_version() and validate_version() for files that evolve over time
  • Binary support — StorageType.TEXT / StorageType.BINARY for seamless text or binary I/O
  • Batch reading — read_many() for reading multiple files in one call

Install

cfinterface requires Python >= 3.10:

pip install cfinterface

Optional Dependencies

For pandas DataFrame integration (TabularParser.to_dataframe()):

pip install cfinterface[pandas]

Quick Start

Model a line-based file with Register and RegisterFile:

from datetime import datetime
from cfinterface import (
    DatetimeField, FloatField, LiteralField, Line, Register, RegisterFile,
)

class DataHigh(Register):
    IDENTIFIER = "DATA_HIGH"
    IDENTIFIER_DIGITS = 9
    LINE = Line(
        [
            LiteralField(size=6, starting_position=11),
            LiteralField(size=9, starting_position=19),
            DatetimeField(size=10, starting_position=30, format="%m/%d/%Y"),
            FloatField(size=6, starting_position=42, decimal_digits=2),
        ]
    )

class MyFile(RegisterFile):
    REGISTERS = [DataHigh]

file = MyFile.read("data.txt")
for reg in file.data.get_registers_of_type(DataHigh):
    print(reg.data)

Parse tabular data with TabularParser:

from cfinterface import IntegerField, FloatField, LiteralField
from cfinterface.components.tabular import ColumnDef, TabularParser

columns = [
    ColumnDef(name="City", field=LiteralField(size=12, starting_position=0)),
    ColumnDef(name="Pop", field=IntegerField(size=10, starting_position=12)),
    ColumnDef(name="Area", field=FloatField(size=8, starting_position=22, decimal_digits=1)),
]

parser = TabularParser(columns)
data = parser.parse_lines(["Springfield  1200000    115.4\n"])
# {"City": ["Springfield"], "Pop": [1200000], "Area": [115.4]}

Documentation

Guides, tutorials, and API reference: https://rjmalves.github.io/cfinterface

Changelog

See CHANGELOG.md for release history.

Metadata

Release files for cfinterface 1.10.3

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

Source distribution (sdist)

Source distribution for cfinterface 1.10.3
File Size Uploaded Provenance Actions
cfinterface-1.10.3.tar.gz 82.8 kB With provenance Details for cfinterface-1.10.3.tar.gz

Built distribution (wheel)

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

Total release size: 125.1 kB

Release files / cfinterface-1.10.3.tar.gz

Download URL cfinterface-1.10.3.tar.gz
Size 82.8 kB
Tags Source
SHA-256 checksum
How to use checksums
00c525c30f9b1f033d685614d6f9e950e9ef52aba206f4871a3124342587d4a2
BLAKE2b-256 checksum
How to use checksums
b6d50a83430b2b96a51ec1c3ed2d648e2506699f100bd06144b19d19eaf72902
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 Oct 30, 2026.

Transparency log

Release files / cfinterface-1.10.3-py3-none-any.whl

Download URL cfinterface-1.10.3-py3-none-any.whl
Size 42.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1cd892f998848e41f7047c3bbb5109539fe681b4359b2995c19227914b508070
BLAKE2b-256 checksum
How to use checksums
09603f126367476eedc102a14752cfb8d3103e61f776acb087c96f0951a0252c
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 Oct 30, 2026.

Transparency log

Security for cfinterface 1.10.3

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 cfinterface-1.10.3.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 Oct 30, 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

1.10.3 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