Skip to main content

FlatForge

A generic, modular, and extensible library to validate flat files of fixed length or delimited format. This project was created with help of Claude Sonnet 3.7.

Features

  • Validate flat files against predefined schemas
  • Transform flat files from one format to another
  • Support for fixed-length and delimited file formats
  • Extensible rule system for validation and transformation
  • Global rules for cross-record validation
  • CLI interface for easy integration into workflows
  • Support for multi-section files (header, body, footer)
  • Comprehensive error reporting
  • Efficient processing of large files (>1GB) with chunked processing and progress reporting

Installation

pip install flatforge

Quick Start

Command Line Interface

# Validate a file against a schema
flatforge validate --config schema.yaml --input data.csv --output valid.csv --errors errors.csv

# Convert a file from one format to another
flatforge convert --config mapping.yaml --input data.csv --output converted.txt

# Process a large file with chunked processing and progress reporting
flatforge validate --config schema.yaml --input large_data.csv --output valid.csv --errors errors.csv --chunk-size 10000 --show-progress

Programmatic Usage

from flatforge.processors import ValidationProcessor
from flatforge.parsers import ConfigParser

# Parse the configuration
config_parser = ConfigParser.from_file("schema.yaml")
config = config_parser.parse()

# Create a processor
processor = ValidationProcessor(config)

# Process the file
result = processor.process("data.csv", "valid.csv", "errors.csv")
print(f"Processed {result.total_records} records with {result.error_count} errors")

# Process a large file in chunks with progress reporting
def update_progress(processed, total):
    print(f"Progress: {processed}/{total} records ({int(100 * processed / total)}%)")

result = processor.process_chunked(
    "large_data.csv", 
    "valid.csv", 
    "errors.csv", 
    chunk_size=10000, 
    progress_callback=update_progress
)
print(f"Processed {result.total_records} records with {result.error_count} errors")

Documentation

For detailed documentation, please refer to:

Changelog

See the CHANGELOG.md file for details on the changes made in each release.

Contributing

Contributions are welcome! Please see the CONTRIBUTING.md file for guidelines on how to contribute to this project.

Author

License

This project is licensed under the MIT License - see the LICENSE file for details.

Metadata

Release files for flatforge 0.3.4

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

Source distribution (sdist)

Source distribution for flatforge 0.3.4
File Size Uploaded Provenance Actions
flatforge-0.3.4.tar.gz 191.9 kB Without provenance Details for flatforge-0.3.4.tar.gz

Built distribution (wheel)

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

Total release size: 292.6 kB

Release files / flatforge-0.3.4.tar.gz

Download URL flatforge-0.3.4.tar.gz
Size 191.9 kB
Tags Source
SHA-256 checksum
How to use checksums
95aa57d231f4628e3c23144968d8a3f1852368eacf337158e67eaea3e43a9041
BLAKE2b-256 checksum
How to use checksums
16a52ba34a7fd4322a6fad6012f8531448bd9b6fe0a04f959505c60956667390
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.4

Release files / flatforge-0.3.4-py3-none-any.whl

Download URL flatforge-0.3.4-py3-none-any.whl
Size 100.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ff7f00d13941a8bf2b87883aeddecfd952c13a52dfe4a5a4a055e108271e6d8f
BLAKE2b-256 checksum
How to use checksums
b4f63ddbf297d4107a24fb2b4fa3ec06eee279e492367b3bd51d3eb1d9ecd5da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.4

Security for flatforge 0.3.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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

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