Skip to content

Conversation

@Mjboothaus
Copy link

@Mjboothaus Mjboothaus commented Jan 7, 2026

Add mojo-toml v0.5.0 - TOML 1.0 Complete + Partial 1.1

Adds mojo-toml - a native TOML parser and writer for Mojo with zero Python dependencies.

Features

TOML 1.0 - Fully Compliant:

  • ✅ Complete TOML 1.0 specification support
  • ✅ Array of tables [[section]] syntax
  • ✅ Alternative number bases (hex 0xDEAD, octal 0o755, binary 0b1101)
  • ✅ Nested tables, dotted keys, duplicate detection
  • ✅ TOML writer with round-trip fidelity
  • ✅ 168 comprehensive tests (127 parser + 41 writer)
  • ✅ Clear error messages with line/column context

TOML 1.1 - Partial Support:

  • \xHH escape sequences (codepoints 0-255)
  • \e escape for escape character

Performance:

  • Real-world config files: ~2ms parse time
  • Simple documents: 40K+ parses/sec
  • Comprehensive benchmark system with machine info reporting

Repository

Testing

Package includes test_package.mojo which validates:

  • Simple key-value parsing
  • Integer, float, boolean, and array parsing
  • Nested table structures
  • Dotted key functionality
  • Round-trip serialization

All 168 tests pass in the source repository.

Installation

Users can install via:

git submodule add https://github.com/databooth/mojo-toml vendor/mojo-toml
mojo -I vendor/mojo-toml/src your_app.mojo

Or via modular-community once merged:

pixi add mojo-toml

Sponsored by DataBooth - Building high-performance data and AI services with Mojo

Package: mojo-toml v0.3.0

A native TOML 1.0 parser for Mojo with zero Python dependencies.

Features:
- Complete TOML 1.0 syntax support
- 96 comprehensive tests ensuring reliability
- Nested tables, dotted keys, duplicate detection
- Clear error messages with line/column context
- Performance: 26μs for simple parses, 2ms for real files

Repository:
- GitHub: https://github.com/DataBooth/mojo-toml
- Release: https://github.com/DataBooth/mojo-toml/releases/tag/v0.3.0
- License: MIT

Testing:
Package includes test_package.mojo which validates:
- Simple key-value parsing
- Integer and array parsing
- Nested table structures
- Dotted key functionality

All 96 tests pass in the source repository.

Sponsored by DataBooth (https://www.databooth.com.au/posts/mojo)
@Mjboothaus
Copy link
Author

v 0.5.0 has now been released

@Mjboothaus
Copy link
Author

Mjboothaus commented Jan 12, 2026

I have fixed the pre-commit issues and re-submitted. Please note that v 0.5.0 is the latest release of mojo-toml.

@Mjboothaus
Copy link
Author

Hi @bgreni! 👋

Apologies for the confusion with this PR - I'm still learning the GitHub PR workflow! I've (hopefully) now updated everything properly:

What I've done:

Fixed pre-commit hooks - All checks now pass (trailing whitespace, end-of-file)
Updated to v0.5.0 - The recipe now points to the latest release (was v0.3.0)
Updated description - Reflects current features and test count

Changes since original PR (v0.3.0 → v0.5.0):

  • TOML 1.0 Complete: Array-of-tables [[section]], alternative number bases (hex/octal/binary)
  • Partial TOML 1.1: \xHH and \e escape sequences
  • 168 tests (up from 96) - 127 parser + 41 writer
  • Comprehensive benchmarking system with machine info reporting
  • Performance: ~2ms for real-world config files, 40K+ parses/sec for simple docs

Links:

The package is significantly more feature-complete now than when I first submitted the PR. All tests pass, pre-commit hooks pass, and it's ready for review!

Let me know if you need anything else or if I've messed up the PR workflow again. 😅 Thanks for your patience!

@Mjboothaus Mjboothaus changed the title Add mojo-toml v0.3.0 - Native TOML parser Add mojo-toml v0.5.0 - Native TOML parser & writer Jan 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants