Skip to main content

Python library to manipulate fixed width file (FWF)

Project description

Python FWF

Python PyPI Deploy Tests Coverage License: MIT pre-commit

Python library for reading and manipulating fixed-width files (FWF).

Features

  • 📖 Read fixed-width format files with custom column definitions
  • 🔧 Support for typed columns (integer, decimal, date, time, etc.)
  • 📋 Header and footer row handling
  • 🎯 Simple and intuitive API
  • ✅ Fully tested (100% coverage)

Installation

pip install pyfwf

Quick Start

from pyfwf.columns import CharColumn, PositiveIntegerColumn
from pyfwf.descriptors import DetailRowDescriptor, FileDescriptor
from pyfwf.readers import Reader

# Define columns
detail = DetailRowDescriptor([
    CharColumn(name='name', pos=1, size=20),
    PositiveIntegerColumn(name='age', pos=21, size=3),
])

# Create file descriptor
fd = FileDescriptor(line_size=23, details=[detail])

# Read file
with open('data.fwf', 'r') as f:
    reader = Reader(f, fd)
    for row in reader:
        print(row)

Supported Column Types

  • CharColumn - Text data
  • RightCharColumn - Right-aligned text
  • PositiveIntegerColumn - Positive integers
  • PositiveDecimalColumn - Decimal numbers
  • DateColumn - Date values
  • TimeColumn - Time values
  • DateTimeColumn - DateTime values

Documentation

See docs/ for detailed documentation and examples.

License

MIT License © 2015 Umbrella Tech

Author

Kelson da Costa Medeiros kelsoncm@gmail.com

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

pyfwf-1.0.1.tar.gz (16.0 kB view details)

Uploaded Source

Built Distribution

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

pyfwf-1.0.1-py3-none-any.whl (14.0 kB view details)

Uploaded Python 3

File details

Details for the file pyfwf-1.0.1.tar.gz.

File metadata

  • Download URL: pyfwf-1.0.1.tar.gz
  • Upload date:
  • Size: 16.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pyfwf-1.0.1.tar.gz
Algorithm Hash digest
SHA256 265fb8b4c40cc7d7a9f3f487ee1c222ccc2c99c941b058a03c38217def161949
MD5 e461b3670bdce98be2005fca15f8abe0
BLAKE2b-256 b9221b2cc6f7f16f730d4a2af4523154eaf50c348309d48f217af2759e57c619

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyfwf-1.0.1.tar.gz:

Publisher: publish.yml on kelsoncm/python-pyfwf

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyfwf-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: pyfwf-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 14.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pyfwf-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b046c3667e7e0dd9204d6e42be73f4bee22ed1d790c4ae614f309b3ae2b93537
MD5 dea5d7e67450a40fce4732d04a3aba95
BLAKE2b-256 0669b4e6436f47d64de182b728b5f474236368b05132a2714053656972e95364

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyfwf-1.0.1-py3-none-any.whl:

Publisher: publish.yml on kelsoncm/python-pyfwf

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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