Skip to content

Releases: DataBooth/mojo-dotenv

v0.2.1 - Improved Error Handling

06 Jan 06:02

Choose a tag to compare

Package Files

dotenv.mojopkg - Compiled with Mojo 0.26.1.0.dev2026010517 (9d7cb35f)

⚠️ Compatibility Note: This .mojopkg file is compiled with the Mojo version shown above. It may not work with different Mojo versions. For maximum compatibility, use source installation (git submodule or direct copy).

v0.2.0 - Initial public release: Near-100% python-dotenv Compatibility

05 Jan 12:25

Choose a tag to compare

[0.2.0] - 2026-01-05

Features

  • Variable expansion with ${VAR} and $VAR syntax
  • Two-pass parsing: parse lines first, then expand variables
  • System environment fallback for undefined variables
  • Multiline values (quoted strings spanning multiple lines)
  • Proper quote state tracking across line boundaries
  • Escape sequences in quoted strings: \n, \t, \\, \", \'
  • Inline comment handling with quote-awareness
  • Export prefix support (export KEY=value stripped automatically)
  • Keys without = return empty string (Mojo Dict limitation)
  • Verbose mode on all APIs (verbose: Bool parameter)
  • find_dotenv() function for automatic .env discovery (up to 20 parent directories)

Bug Fixes:

  • Fixed multiline quote detection to properly handle escaped backslashes (e.g., \\\\ before closing quote)
  • Consecutive backslash counting ensures correct quote escape detection

Testing:

  • 8 comprehensive test files covering all features
  • test_export.mojo - export prefix handling
  • test_escapes.mojo - escape sequence processing
  • test_variables.mojo - variable expansion
  • test_multiline.mojo - multiline value parsing
  • test_phase3plus.mojo - find_dotenv(), inline comments, verbose mode
  • Dynamic test-all task runs all test_*.mojo files automatically

Compatibility:

  • 98%+ feature parity with python-dotenv
  • All Phase 3+ features implemented
  • Near-100% compatibility achieved

Known Differences from python-dotenv

  1. Keys without =: Returns "" instead of None (Mojo Dict limitation documented)
  2. Stream input: Not supported (file paths only)
  3. Encoding parameter: UTF-8 only (Mojo default)