Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion data/failed-compatibility-macos-latest.json
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
{}
mojo-toml:
failed_at: '2026-01-14T07:20:14.606055'
2 changes: 1 addition & 1 deletion data/failed-compatibility-magic_arm64_8core.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{}
{}
2 changes: 1 addition & 1 deletion data/failed-compatibility-ubuntu-latest.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{}
{}
54 changes: 54 additions & 0 deletions recipes/mojo-toml/recipe.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package:
name: mojo-toml
version: 0.3.0

source:
git: https://github.com/DataBooth/mojo-toml.git
tag: v0.3.0

build:
number: 0
script:
- mkdir -p $PREFIX/lib/mojo/toml
- cp -r src/toml/* $PREFIX/lib/mojo/toml/

requirements:
build:
- mojo >=25.1
host:
- mojo >=25.1
run:
- mojo >=25.1

test:
commands:
- test -f $PREFIX/lib/mojo/toml/__init__.mojo
- test -f $PREFIX/lib/mojo/toml/lexer.mojo
- test -f $PREFIX/lib/mojo/toml/parser.mojo

about:
homepage: https://github.com/DataBooth/mojo-toml
license: MIT
license_file: LICENSE
summary: A native TOML 1.0 parser for Mojo 🔥
description: |
mojo-toml is the first native TOML 1.0 parser for Mojo, enabling fast and
efficient parsing of TOML configuration files with zero Python dependencies.

Features:
- Complete TOML 1.0 syntax support (strings, numbers, arrays, tables)
- Nested table structures with proper Dict navigation
- Dotted keys for creating nested structures
- Duplicate key detection
- Clear error messages with line/column context
- 96 comprehensive tests ensuring reliability
- Performance: 26μs for simple parses, 2ms for real-world files

Perfect for configuration files, build systems, and any Mojo application
needing structured configuration.
doc_url: https://github.com/DataBooth/mojo-toml/blob/main/README.md
dev_url: https://github.com/DataBooth/mojo-toml

extra:
recipe-maintainers:
- mjboothaus
54 changes: 54 additions & 0 deletions recipes/mojo-toml/test_package.mojo
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
"""Test file for mojo-toml package installation.

This test verifies that mojo-toml is properly installed and can parse TOML.
"""

from toml import parse


fn main() raises:
"""Test basic TOML parsing functionality."""

print("Testing mojo-toml package installation...")

# Test 1: Simple key-value parsing
var config1 = parse('name = "mojo-toml"')
var name = config1["name"].as_string()
if name != "mojo-toml":
raise Error("Test failed: Expected 'mojo-toml', got: " + name)
print("✓ Test 1 passed: Simple key-value")

# Test 2: Integer parsing
var config2 = parse('port = 8080')
var port = config2["port"].as_int()
if port != 8080:
raise Error("Test failed: Expected 8080, got: " + String(port))
print("✓ Test 2 passed: Integer parsing")

# Test 3: Array parsing
var config3 = parse('items = [1, 2, 3]')
var items = config3["items"].as_array()
if len(items) != 3:
raise Error("Test failed: Expected 3 items, got: " + String(len(items)))
print("✓ Test 3 passed: Array parsing")

# Test 4: Nested table parsing
var config4 = parse('[database]\nhost = "localhost"\nport = 5432')
var db = config4["database"].as_table()
var host = db["host"].as_string()
if host != "localhost":
raise Error("Test failed: Expected 'localhost', got: " + host)
print("✓ Test 4 passed: Nested tables")

# Test 5: Dotted keys
var config5 = parse('a.b.c = "nested"')
var a_table = config5["a"].as_table()
var b_table = a_table["b"].as_table()
var c_value = b_table["c"].as_string()
if c_value != "nested":
raise Error("Test failed: Expected 'nested', got: " + c_value)
print("✓ Test 5 passed: Dotted keys")

print()
print("✅ All tests passed! mojo-toml is working correctly.")
print("Package version: 0.3.0")