Skip to content
This repository was archived by the owner on Nov 22, 2026. It is now read-only.

Releases

mojo-csv v0.1.2

Choose a tag to compare

@amarbarosys amarbarosys released this 08 Nov 23:00

mojo-csv-public v0.1.2

Released: 2026-11-08 · Commit: 9e38f66 · Previous: v0.1.1

What it does

CSV reader and writer for Mojo byte buffers, with CPython 3.14 quoting rules.
Unquoted fields view the input as Spans; quoted and escaped fields use retained
row scratch. Supports six quoting modes, distinct None and empty string
preservation, invalid UTF-8 passthrough, and ASCII float validation.

Highlights

  • Packaging only: the conda recipe pins mojo-compiler to the minor the package was built with (<1.3.0a0), so it cannot be installed on a Mojo it does not load on.

Changes

Changed

  • recipe.yaml: mojo-compiler run dependency pinned to the build's minor (<1.3.0a0).

Verified

Check Result
pkg-conda dry run on the version commit (H1-H3,H6) PASS: mojo-csv-0.1.2-hb0f4dca_0.conda

Known limits

  • Packages are built on one Mojo minor only; see the package protocol.

Upgrade / run

None: no API change.

Commits

  • 9e38f66 build: bump version to 0.1.2
  • 5a9651b build: recipe pins mojo-compiler to the build's minor

mojo-csv v0.1.1

Choose a tag to compare

@amarbarosys amarbarosys released this 07 Nov 10:49

mojo-csv v0.1.1

Released: 2026-11-07 · Commit: the one tagged v0.1.1 · Previous: v0.1.0

What it does

CSV reader and writer for Mojo byte buffers, with CPython 3.14 quoting rules.
Unquoted fields view the input as Spans; quoted and escaped fields use retained
row scratch. Supports six quoting modes, distinct None and empty string
preservation, invalid UTF-8 passthrough, and ASCII float validation.

Highlights

  • write_all is 1.9x faster: 242.5 -> 468.2 MB/s on 714285 records (CPython csv.writer on the same rows: 97.1 MB/s).
  • write_all peaks 36 MB lower on that input (326328 -> 290052 KB): the output is reserved once, with no doubling copies.
  • Dialect(escapechar=...) now enables escaping. Before, the byte was ignored without has_escape=True.
  • No reader change: 840k random reader cases, 350k writer cases and 50k line_num cases agreed with CPython 3.14.8.

Changes

Changed

  • write_all: one 256-byte stack table flags special bytes, fields without one are copied with a single extend, and the output is reserved from the field byte sum.
  • scripts/nightly.sh requires MOJO (no machine path); scripts/benchmark.sh alternates Mojo and CPython rounds itself and adds the write mode.

Fixed

  • A nonzero escapechar passed without has_escape=True was silently ignored, so a\,b split into two fields. has_escape=True is now only needed for a NUL escape.

Verified

Check Result
scripts/ci.sh: build, goldens, mutants, API, quickstart, two differentials PASS 6/6, PASS ci
scripts/check.sh: CPython golden vectors (tests/test_golden.mojo, 1255 rows, 6 new writer rows) PASS golden 1255
tests/test_limit.mojo: 131072 boundary for quoted, doubled-quote, escaped and CRLF fields PASS limit
tests/test_dialect.mojo: escapechar inference (fails on v0.1.0: left 2, right 1) PASS dialect
scripts/mutants.sh: 16 compiling behavior mutants 16/16 killed, 0 invalid
tools/oracle_fuzz.py and tools/oracle_write_fuzz.py: 20000 random cases each vs CPython 3.14, seed 7 0 diffs
scripts/nightly.sh on Mojo 1.3.0.dev2026110305 PASS nightly
write A/B: 7 alternating rounds, CPU 7 (docs/benchmarks/csv-writer.txt) 242.5 -> 468.2 MB/s median

Known limits

  • Byte buffers only: no Python file or streaming chunk abstractions. Sniffer, DictReader and DictWriter are excluded.
  • Field limit is 131072 bytes, not codepoints. Numeric syntax is ASCII. Error messages are library-specific.
  • Row and field views expire at the next next() or reset(); the compiler does not reject invalid retention.
  • row[index] has no bounds check in release builds.
  • OwnedField rows cost about 64 bytes per small field on read_all (240732 KB for 50 MB); streaming with row() stays at 58288 KB.
  • Tried and reverted: quoted fields as input views (+0.9% stream, 0% owned), SIMD width 32 (-7%) and 8 (+3%).

Upgrade / run

git clone https://github.com/amarbaro/mojo-csv && cd mojo-csv && uv sync
scripts/cap.sh .venv/bin/mojo run -I src examples/quickstart.mojo

Upgrade from v0.1.0: no API change. Code that passed only escapechar= now gets escaping.

Commits

  • git log v0.1.0..v0.1.1