This release is a pre-release and may not be stable for production use.
fixedwidthparser
Read and write fixed-width files from Python through FixedWidthParser's NativeAOT library: no .NET runtime, parallel reads, results as NumPy views, Arrow, pandas or polars.
pip install "fixedwidthparser[numpy]" # fw.read: NumPy views
pip install "fixedwidthparser[pandas]" # or [pyarrow], [polars]
Wheels ship for Windows x64, macOS (arm64, x64) and Linux (glibc and musl, x64 and arm64). The package installs
as fixedwidthparser and imports as fixedwidth. pyarrow has no musllinux wheels, so on Alpine and other
musl systems Arrow, pandas, polars and writing need a pyarrow built for them.
import fixedwidth as fw
# B3's COTAHIST quote history: 245-byte lines, a header (00) and a trailer (99) around the quotes (01).
layout = fw.Layout([
fw.Column("tipreg", 0, 2, fw.String),
fw.Column("data_pregao", 2, 8, fw.Date, format="yyyyMMdd"),
fw.Column("codneg", 12, 12, fw.String),
fw.Column("preabe", 56, 13, fw.Float64, scale=2), # N(11)V99: two implied decimals
fw.Column("quatot", 152, 18, fw.Int64),
])
options = fw.ReadOptions(header_lines=1, skip_invalid=True) # the trailer fails to parse and is skipped
df = fw.read_pandas("COTAHIST_A2023.TXT", layout, options)
Reading
| Function | Returns |
|---|---|
fw.read(source, layout, options) |
fw.Table: NumPy views over the native columns, no copy |
fw.read_arrow(source, layout, options) |
pyarrow.Table (needs pyarrow) |
fw.read_pandas(source, layout, options) |
pandas.DataFrame (needs pyarrow and pandas) |
fw.read_polars(source, layout, options) |
polars.DataFrame |
fw.read_batches(source, layout, fw.ReaderOptions(batch_rows=...)) |
an iterator of fw.Table |
fw.read_arrow_stream(source, layout, fw.ReaderOptions(...)) |
an Arrow PyCapsule stream for polars.DataFrame(...) or pyarrow.RecordBatchReader.from_stream(...) |
source is a path, or bytes/bytearray/memoryview to read from memory. Every optional setting lives in
fw.ReadOptions: header_lines, skip_invalid, degree_of_parallelism (0 = one thread per processor,
1 = sequential), encoding (a code page or "latin-1", "cp1252", ...), max_line_length and
skip_byte_order_mark. A parallel read gives the same rows, in the same order, as a sequential one.
A line that fails to parse raises fw.ParseError with line_number and column, unless skip_invalid is set.
fw.Table maps a column name to a NumPy array (a list for strings), and has num_rows, column_names,
lines_read, lines_skipped, validity(name) (a bool array, True where the row holds a value, or None
when the column has no nulls) and to_arrow(), which shares the native buffers. Without pyarrow,
read_polars reads sequentially through the Arrow stream.
Columns
fw.Column(name, start, length, type, *, nullable, scale, format, trim_char, trim_mode, alignment, padding, overflow).
Positions are bytes. Types: fw.String, fw.Int64, fw.Float64, fw.Decimal (int64 unscaled, Arrow
decimal128(18, scale)), fw.Date, fw.Time, fw.Timestamp. scale is the number of implied decimals:
0000000123456 with scale=2 reads as 1234.56. format uses .NET date syntax (yyyyMMdd, HHmmss).
trim_mode, alignment and overflow take fw.TrimMode, fw.Alignment and fw.Overflow.
fw.Layout(columns, fw.LayoutOptions(line_length=..., filler=...)) sets how written lines are laid out:
line_length past the last column pads each line, and filler (default a space) fills the gaps between
columns.
Writing
fw.write(df, "out.txt", layout, fw.WriteOptions(degree_of_parallelism=0))
data = fw.write_bytes(df, layout)
Takes pandas, polars, pyarrow or anything with __arrow_c_stream__ (needs pyarrow), matching columns by name.
padding="0" writes zero-padded numbers with the sign leftmost; a null writes as its column filled with
trim_char. Parallel writes are byte-identical to serial ones. fw.WriteOptions also takes encoding,
newline (default "\n") and batch_rows.
A fw.Decimal column stores its value times 10**scale as an int64. Decimals and integers are scaled
exactly, and a decimal with more digits than scale raises. Floats round half to even to scale.
A value that is NaN, infinite or outside int64 once scaled raises before anything is written.
Building from source
python python/scripts/build_native.py # requires the .NET 10 SDK; publishes the library into src/fixedwidth/_lib
pip install -e "python[dev,pandas,polars]"
pytest python/tests
To point at a library built elsewhere, set FIXEDWIDTH_NATIVE_LIB to its full path.
Metadata
Release files for fixedwidthparser 2.0.0rc1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
Total release size: 10.7 MB
Release files / fixedwidthparser-2.0.0rc1-py3-none-win_amd64.whl
| Download URL | fixedwidthparser-2.0.0rc1-py3-none-win_amd64.whl |
|---|---|
| Size | 1.5 MB |
| Tags | Python 3 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
a9b041fe7d531351ad3970d1b4392d1d6868cce24eb92a105f306afb0ab919aa
|
|
BLAKE2b-256 checksum How to use checksums |
79fd6644d11010180a70f3271a8918168c4ed255333be71f4514946ddc1c29e6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 25, 2026.
Transparency logRelease files / fixedwidthparser-2.0.0rc1-py3-none-musllinux_1_2_x86_64.whl
| Download URL | fixedwidthparser-2.0.0rc1-py3-none-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 1.6 MB |
| Tags | Linux musl 1.2+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
173139d84e952a77bebdd9b95738f349cbd2cc77802ae38a751ad5fe4789794c
|
|
BLAKE2b-256 checksum How to use checksums |
e7a501c9bf72048350602771e8d5c4290f322b667553bb4009818516026b8785
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 25, 2026.
Transparency logRelease files / fixedwidthparser-2.0.0rc1-py3-none-musllinux_1_2_aarch64.whl
| Download URL | fixedwidthparser-2.0.0rc1-py3-none-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 1.5 MB |
| Tags | Linux musl 1.2+ ARM64 Python 3 |
|
SHA-256 checksum How to use checksums |
f9f6f80ee24f7d7d1d511085c4d2d9db84db6cc888d3ca690a730ced96964f6d
|
|
BLAKE2b-256 checksum How to use checksums |
c518ba7fd3774df39088ab428e69dc3296d17eb094a95784ca97433138c24a21
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 25, 2026.
Transparency logRelease files / fixedwidthparser-2.0.0rc1-py3-none-manylinux_2_34_x86_64.whl
| Download URL | fixedwidthparser-2.0.0rc1-py3-none-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 1.6 MB |
| Tags | Linux glibc 2.34+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
324fe52aec75d9560b79a5736ba54f930ebe053dc18706831acc2d6cd818f718
|
|
BLAKE2b-256 checksum How to use checksums |
c2ad62332d9609835117e90e75a4e5daf645e93de4a01f48c3cf2bbdc91339f7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 25, 2026.
Transparency logRelease files / fixedwidthparser-2.0.0rc1-py3-none-manylinux_2_34_aarch64.whl
| Download URL | fixedwidthparser-2.0.0rc1-py3-none-manylinux_2_34_aarch64.whl |
|---|---|
| Size | 1.5 MB |
| Tags | Linux glibc 2.34+ ARM64 Python 3 |
|
SHA-256 checksum How to use checksums |
9c9449f7f6166193a1f154d80f4ffb72cfb1b71255c0a0df777be7b894a3e2db
|
|
BLAKE2b-256 checksum How to use checksums |
9e95cff82d97e76d9d0f47be2d0117682a6ab3aa067da985045c735aa24b6d3f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 25, 2026.
Transparency logRelease files / fixedwidthparser-2.0.0rc1-py3-none-macosx_12_0_x86_64.whl
| Download URL | fixedwidthparser-2.0.0rc1-py3-none-macosx_12_0_x86_64.whl |
|---|---|
| Size | 1.6 MB |
| Tags | Python 3 macOS 12.0+ x86-64 |
|
SHA-256 checksum How to use checksums |
2d7887eefebcf6dd1e1f217d0540820e9ca3088396d66c8b12dba46ceb6a4a6b
|
|
BLAKE2b-256 checksum How to use checksums |
d86fa948e4dfe5323ecb5b0447eccee2fdf3ad562218fce993099f1ffd0881d3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 25, 2026.
Transparency logRelease files / fixedwidthparser-2.0.0rc1-py3-none-macosx_12_0_arm64.whl
| Download URL | fixedwidthparser-2.0.0rc1-py3-none-macosx_12_0_arm64.whl |
|---|---|
| Size | 1.5 MB |
| Tags | Python 3 macOS 12.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
0d50f49e82abe3d8d0c976bd272591bba72779376d36ccfea37192e00d9681a2
|
|
BLAKE2b-256 checksum How to use checksums |
1639b01b44c0782bfd769dc48cbb8c14ec578fc12bd55f23ba6c997465d3c596
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 25, 2026.
Transparency logSecurity for fixedwidthparser 2.0.0rc1
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.
Full provenance
All 7 files in this release have been uploaded with provenance metadata.
Attestation for fixedwidthparser-2.0.0rc1-py3-none-win_amd64.whl
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 25, 2026.
Transparency logA 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.