cfinterface
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 —
VERSIONSdict withresolve_version()andvalidate_version()for files that evolve over time - Binary support —
StorageType.TEXT/StorageType.BINARYfor 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.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cfinterface-1.10.4.tar.gz | 83.4 kB | With provenance | Details for cfinterface-1.10.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cfinterface-1.10.4-py3-none-any.whl | Python 3 | none | any | Details for cfinterface-1.10.4-py3-none-any.whl |
Total release size: 125.7 kB
Release files / cfinterface-1.10.4.tar.gz
| Download URL | cfinterface-1.10.4.tar.gz |
|---|---|
| Size | 83.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c3acc60f12a49204b35fa98442ef8632dc558a67800dc6d3cf4b47832922b8a8
|
|
BLAKE2b-256 checksum How to use checksums |
09d6c22454b0f2785f8908119722f96ec73927abdd5b0f27cd12f74e865702f8
|
| 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 14, 2026.
Transparency logRelease files / cfinterface-1.10.4-py3-none-any.whl
| Download URL | cfinterface-1.10.4-py3-none-any.whl |
|---|---|
| Size | 42.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
065432b7f911b46047c3be9a0d4c37592ccfa32e045b264503595a4f16a73054
|
|
BLAKE2b-256 checksum How to use checksums |
b9f56fa401a9c6bf1b1cb05822ba92e4dc7e2038e31ca959da3628b825435e2d
|
| 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 14, 2026.
Transparency logSecurity for cfinterface 1.10.4
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.
Attestation for cfinterface-1.10.4.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 14, 2026.
Transparency logA 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.