Skip to content

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

Choose a tag to compare

@Mjboothaus Mjboothaus released this 05 Jan 12:25
· 53 commits to main since this release

[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)