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.2

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.2
File Size Uploaded Provenance Actions
cfinterface-1.10.2.tar.gz 82.5 kB With provenance Details for cfinterface-1.10.2.tar.gz

Built distribution (wheel)

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

Total release size: 124.7 kB

Release files / cfinterface-1.10.2.tar.gz

Download URL cfinterface-1.10.2.tar.gz
Size 82.5 kB
Tags Source
SHA-256 checksum
How to use checksums
21262ac57179f6d4eaa2b1f6a82f776c1070db706f2afd32f92d094da2b931fe
BLAKE2b-256 checksum
How to use checksums
c161dc0144d0b206bf017a11b75744a941fdac77965df031493fdcf595cbed9a
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 14, 2026.

Transparency log

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

Download URL cfinterface-1.10.2-py3-none-any.whl
Size 42.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e8e21daf0aed8f09c07454d40df5f8086d62c84735af026ac6de93f865adef68
BLAKE2b-256 checksum
How to use checksums
237d574afe13c89cc32513402dd25571a328668cabe556dcf60129674f0dff1a
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 14, 2026.

Transparency log

Security for cfinterface 1.10.2

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.2.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 14, 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.2 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