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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file flatforge-0.1.2.tar.gz.
File metadata
- Download URL: flatforge-0.1.2.tar.gz
- Upload date:
- Size: 57.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fe9f9c39eb4c5bf5919db599691964f9fa7cf9748b42dc1781d68a72f6ba0b3e
|
|
| MD5 |
13c3e409edc27d518630be9d758ea316
|
|
| BLAKE2b-256 |
e5e68158a7f697bdc47d4d47dbe372914350af94ec03c56047d3d4e9412898ec
|
File details
Details for the file flatforge-0.1.2-py3-none-any.whl.
File metadata
- Download URL: flatforge-0.1.2-py3-none-any.whl
- Upload date:
- Size: 30.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e8047be29e9df3f09488d801b4bfbc631c73f8610b405f4a2e458abc35720641
|
|
| MD5 |
fa38920b5ebcd3a5b0318aceb2527054
|
|
| BLAKE2b-256 |
55f37e232dc40bd1fd1da6c20dba2bdaf079702e36179213b9fe52fcd4c9cfc3
|