Skip to content

Latest commit

 

History

History
102 lines (79 loc) · 4.27 KB

File metadata and controls

102 lines (79 loc) · 4.27 KB

Changelog

All notable changes to mojo-ini will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

[Unreleased]

Changed

  • Bumped MAX / Mojo toolchain dependency to max ">=26.1.0,<27" and updated recipes to pin mojo_version = "=0.26.1".
  • Updated the INI lexer to use codepoint_slices() and a cached List[String] buffer instead of direct String indexing, matching Mojo 0.26.1 __getitem__ semantics while preserving existing behaviour.
  • Adopted a "no warnings" policy for the core library and tests so future migrations surface only new issues.

[0.2.0] - 2026-01-13

Status: ✅ Production Ready

First stable release of mojo-ini! A native Mojo INI file parser and writer with Python configparser compatibility, featuring production-ready performance and comprehensive testing.

Added

Core Functionality

  • Lexer (364 LOC): Complete tokenization with 7 token types (EOF, NEWLINE, COMMENT, SECTION, KEY, VALUE, EQUALS)
  • Parser (171 LOC): Builds Dict[String, Dict[String, String]] from tokens
  • Writer (142 LOC): Serializes Dict structures to INI format
  • Public API (__init__.mojo): Clean imports from ini import parse, to_ini, parse_file, write_file

INI Features

  • Section headers: [section_name]
  • Key-value pairs with = or : separators
  • Comments: # (hash) and ; (semicolon) styles
  • Inline comments after values
  • Multiline values: Indented continuation lines (Python configparser compatible)
  • Empty values and empty sections
  • Special characters in values (URLs, paths, emails, Unicode)
  • Default section (empty string key) for keys before any [section]

File I/O

  • parse_file(path): Read and parse INI files
  • write_file(path, data): Write Dict structures to INI files

Testing

  • 46 tests across 5 test suites (100% passing)
  • Lexer tests (9 tests): Token generation and position tracking
  • Parser tests (10 tests): Structure building, edge cases, errors
  • Writer tests (9 tests): Formatting, roundtrip validation
  • Fixture tests (7 tests): Real-world INI files (sample, git, mypy, windows, multiline, edge cases)
  • Error tests (11 tests): Malformed input, Unicode, stress tests (10K char lines, 100+ sections)

Examples

  • examples/read_example.mojo: Basic parsing demonstration
  • examples/write_example.mojo: INI generation demonstration
  • examples/file_io_example.mojo: File reading/writing with modifications

Documentation

  • Comprehensive README with Quick Start, usage examples, limitations
  • WARP.md: Development guidelines and architecture documentation
  • Performance benchmarks with statistical reporting (warmup + 5 trials)
    • Small config (4 sections): ~9 μs parse, ~1 μs write
    • Medium config (10 sections): ~97 μs parse, ~23 μs write
    • Large config (50 sections): ~1038 μs parse, ~237 μs write
    • Multiline values: ~14 μs parse
    • 7-10x faster than Python for small configs

Python configparser Compatibility

Compatible:

  • Basic key=value syntax
  • [Section] headers
  • # comments and ; comments
  • Multiline values (indented continuations)
  • Inline comments
  • Empty values
  • Special characters in values

🚧 Planned for v0.3.0:

  • [DEFAULT] section with value inheritance
  • Value interpolation %(var)s
  • ConfigParser class API
  • Type converters (getint, getboolean, getfloat)
  • Case-insensitive mode

Known Limitations

Indented keys NOT supported (by design, matches Python configparser):

  • Lines starting with whitespace are treated as multiline value continuations
  • Tab-indented keys (Git config style) require removing leading tabs
  • Workaround: Keep all keys at column 0, or use TOML/YAML for nested structures

Technical Details

  • Language: Pure Mojo (zero Python dependencies at runtime)
  • LOC: 1,426 total (733 source, 628 tests, 65 examples)
  • Architecture: Three-stage pipeline (Lexer → Parser → Writer)
  • Error Handling: Clear error messages with line numbers and context
  • Package Manager: pixi for reproducible builds
  • Pre-commit: TOML/YAML/JSON validation, whitespace/EOF checks

For detailed development plans, see docs/planning/ROADMAP.md