FixedWidth
Two-way fixed-width <--> Python dict converter.
What it is and what it does
FixedWidth is a Python library for bidirectional conversion between fixed-width text records and Python dictionaries. It uses a configuration dictionary to define field positions, types, alignment, and padding, then parses fixed-width strings into dicts or serializes dicts back to fixed-width format. The library supports string, integer, and decimal types, with configurable date formatting and decimal precision.
The package has a minimal dependency footprint (only six) and low install friction. It was designed for production use and has reportedly run unchanged for several years. However, maintenance is aging—the latest release dates to 2018, and there is no recent activity. The library's main value lies in handling legacy fixed-width data formats, which remain common in certain data integration scenarios.
Use it for:
- Parse fixed-width records into Python dicts for processing or database import
- Generate fixed-width output files for systems that require strict positional field formatting
- Debug and validate fixed-width file specifications by catching configuration errors early
- Convert between fixed-width flat-file formats and in-memory Python data structures
- Integrate fixed-width data pipelines in batch processing workflows
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Converts between Python dictionaries and fixed-width text files in both directions, with configuration-driven field parsing and validation.
Yes, if you need to work with fixed-width files. The package is lightweight, permissively licensed, and has proven stable in production. However, be aware that maintenance is aging (last release 2018) and Python version support is unspecified—test compatibility with your target Python version before relying on it in new projects.
Install
fixedwidth on PyPI
pip
pip install fixedwidthuv
uv add fixedwidthpoetry
poetry add fixedwidthInstalling FixedWidth
Before you install
Low install friction with a single lightweight dependency (six). Maintenance is aging—last release was in 2018 and the repository has not been updated since 2025-04-22, though it remains unarchived and the package has been in production use for several years without modification.
License in practice
BSD permissive license places no restrictions on use, modification, or distribution in proprietary or open-source projects.
Quickstart
pip install FixedWidth
from fixedwidth import FixedWidth
config = {
'name': {'type': 'string', 'start_pos': 1, 'end_pos': 10, 'alignment': 'left', 'padding': ' '}
}
fw = FixedWidth(config)
record_dict = fw.parse(fixed_width_line)
fixed_width_line = fw.to_fixed_width(record_dict)
Verify before relying
- Whether the package works with modern Python versions beyond those it was originally tested against
- Whether the repository's last commit date (2025-04-22) indicates active maintenance or is a stale timestamp
- Current compatibility with six and whether six remains actively maintained
Package facts
| License | BSD (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — six |
| Maintenance | aging — 2,990 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,085,695/month — #4,386 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: FixedWidth-1.3-py3-none-any.whl
Keywords: fixed, width
Tags
More Text Processing packages
A drop-in replacement for Python's standard…
permissive · top 100 on PyPI
pyparsingpyparsing provides a library for building text…
permissive · top 1,000 on PyPI
docutilsDocutils converts plaintext documentation in…
unclear · top 1,000 on PyPI
RapidFuzzRapidFuzz provides fast fuzzy string matching…
permissive · top 1,000 on PyPI
tinycss2tinycss2 parses CSS strings into token and…
permissive · top 1,000 on PyPI
llama-parseLlamaParse parses complex documents (PDFs,…
permissive · top 1,000 on PyPI
copybookCopybook parses VSAM copybook definitions and…
permissive · top 15,000 on PyPI
py-markdown-tableGenerates formatted markdown tables from lists…
permissive · top 5,000 on PyPI
parseParse strings using format-string-like patterns…
permissive · top 5,000 on PyPI
fixedintProvides fixed-width integer classes that…
permissive · top 5,000 on PyPI
overpunchParses and formats overpunch-encoded numbers, a…
permissive · top 15,000 on PyPI
stringparserExtracts values from strings using…
permissive · top 15,000 on PyPI
avro-genGenerates typed Python record classes and a…
permissive · top 15,000 on PyPI
python-mecab-koProvides Python bindings for MeCab-ko, a…
permissive · top 15,000 on PyPI
lat-lon-parserParses latitude-longitude coordinate strings in…
permissive · top 15,000 on PyPI
tabulateFormats and prints tabular data in plain text…
permissive · top 1,000 on PyPI