Skip to main content

A utility for validating and processing flat files

Project description

FlatForge

FlatForge is a Python library for processing and validating flat files (fixed-length or delimited) with a focus on flexibility and ease of use.

GitHub Repository: https://github.com/akram0zaki/flatforge

Features

  • Support for fixed-length and delimited file formats
  • Configurable validation rules for individual fields
  • Global validation rules across multiple records
  • Detailed error reporting
  • YAML and string-based configuration options
  • Extensible architecture for custom validators and processors

Installation

pip install flatforge

Quick Start

from flatforge.config_parser import StringConfigParser
from flatforge.processor import Processor

# Create a configuration
config = """
[parameters]
delimiter = ,
section_separator = \n\n
record_separator = \n

[section_metadata]
0 = fl{10,5,15}|0:required,numeric|1:length(5)|2:regex([A-Z]{2,})
"""

# Parse the configuration
parser = StringConfigParser()
file_props = parser.parse(config)

# Create a processor
processor = Processor(file_props)

# Process a file
file_content = "1234567890ABCDE               \n0987654321FGHIJ               "
results = processor.process_file(file_content)

# Check for errors
for section_index, section_results in results.items():
    for result in section_results:
        if not result.is_valid:
            print(f"Error in section {section_index}, column {result.message.column_index}: {result.message.text}")

Documentation

Full documentation is available at: https://akram0zaki.github.io/flatforge/

Repository and Contributing

The source code for FlatForge is hosted on GitHub: https://github.com/akram0zaki/flatforge

Issues, feature requests, and pull requests can be submitted through the GitHub repository.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flatforge-0.1.1.tar.gz (37.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flatforge-0.1.1-py3-none-any.whl (28.5 kB view details)

Uploaded Python 3

File details

Details for the file flatforge-0.1.1.tar.gz.

File metadata

  • Download URL: flatforge-0.1.1.tar.gz
  • Upload date:
  • Size: 37.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.4

File hashes

Hashes for flatforge-0.1.1.tar.gz
Algorithm Hash digest
SHA256 dae554a3e281919f72f42b212ad711f4723c21118c9dc463f43041c83d8e6aa3
MD5 c7f39f5d164c3706f5f16152bdf55b42
BLAKE2b-256 b8d7c3952302af8a8098f43670844f62f16bce812561758e8e6c62a43e4e2872

See more details on using hashes here.

File details

Details for the file flatforge-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: flatforge-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 28.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.4

File hashes

Hashes for flatforge-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f01498877cfbca2f93b6df982ea6d5cda0d0d0a1c829c3c88c06a11ed6ac10a3
MD5 19e9df5a2858f74962df21fdfae3ec47
BLAKE2b-256 de4f210cafa5a3ca9016434d022bba4b2f5b5236612316274a2862b7f7ba8828

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page