From 0517af8d0b7ceb40dacbade43a3c25bd2f2a08b8 Mon Sep 17 00:00:00 2001 From: Michael Booth Date: Tue, 6 Jan 2026 12:00:26 +1100 Subject: [PATCH 1/4] Add mojo-dotenv package - Production-ready .env file parser and loader for Mojo - 98%+ compatible with python-dotenv - Variable expansion, multiline values, escape sequences - Auto-discovery with find_dotenv() - 42 comprehensive tests with TestSuite framework - MIT License Version: 0.2.0 Repository: https://github.com/DataBooth/mojo-dotenv --- recipes/mojo-dotenv/recipe.yaml | 48 +++++++++++++++++++++++++++++++++ recipes/mojo-dotenv/test.mojo | 13 +++++++++ 2 files changed, 61 insertions(+) create mode 100644 recipes/mojo-dotenv/recipe.yaml create mode 100644 recipes/mojo-dotenv/test.mojo diff --git a/recipes/mojo-dotenv/recipe.yaml b/recipes/mojo-dotenv/recipe.yaml new file mode 100644 index 00000000..6ba647b1 --- /dev/null +++ b/recipes/mojo-dotenv/recipe.yaml @@ -0,0 +1,48 @@ +context: + version: "0.2.0" + +package: + name: mojo-dotenv + version: ${{ version }} + +source: + git: https://github.com/DataBooth/mojo-dotenv + tag: v${{ version }} + +build: + number: 0 + noarch: generic + script: + - mkdir -p $PREFIX/lib/mojo/dotenv + - cp -r src/dotenv/* $PREFIX/lib/mojo/dotenv/ + +requirements: + host: + - max >=25.1.0 + run: + - max >=25.1.0 + +tests: + - script: + - test -f $PREFIX/lib/mojo/dotenv/__init__.mojo + - test -f $PREFIX/lib/mojo/dotenv/parser.mojo + - test -f $PREFIX/lib/mojo/dotenv/loader.mojo + - test -f $PREFIX/lib/mojo/dotenv/finder.mojo + +about: + homepage: https://github.com/DataBooth/mojo-dotenv + repository: https://github.com/DataBooth/mojo-dotenv + documentation: https://github.com/DataBooth/mojo-dotenv/blob/main/README.md + license: MIT + license_file: LICENSE + summary: Load environment variables from .env files in Mojo + description: | + A production-ready .env file parser and loader for Mojo with near-100% python-dotenv compatibility. + + Features: + - Parse .env files to Dict or load into environment + - Variable expansion (${VAR} and $VAR syntax) + - Multiline values and escape sequences + - Auto-discovery with find_dotenv() + - 98%+ compatible with python-dotenv + - 42 comprehensive tests using Mojo's TestSuite framework diff --git a/recipes/mojo-dotenv/test.mojo b/recipes/mojo-dotenv/test.mojo new file mode 100644 index 00000000..9e2018e4 --- /dev/null +++ b/recipes/mojo-dotenv/test.mojo @@ -0,0 +1,13 @@ +from dotenv import dotenv_values, load_dotenv + +fn main() raises: + # Basic smoke test + print("Testing mojo-dotenv import...") + + # Test that functions exist and are callable + # Note: We can't actually load files in the test environment + # but we can verify the functions are importable + print("✓ dotenv_values imported") + print("✓ load_dotenv imported") + + print("All import tests passed!") From 66e65e7c5f8f797c7c695b5cecb814c7e1871a26 Mon Sep 17 00:00:00 2001 From: Michael Booth Date: Tue, 6 Jan 2026 17:04:20 +1100 Subject: [PATCH 2/4] Update to mojo-dotenv v0.2.1 Update recipe to use v0.2.1 which includes important improvements: - Improved missing file handling (returns empty dict with WARNING) - Better error visibility and documentation - 7 new tests for missing file scenarios (49 total) - Documented Mojo vs Python getenv() differences - Updated README examples with proper error handling All changes are backward compatible. --- recipes/mojo-dotenv/recipe.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/mojo-dotenv/recipe.yaml b/recipes/mojo-dotenv/recipe.yaml index 6ba647b1..98987798 100644 --- a/recipes/mojo-dotenv/recipe.yaml +++ b/recipes/mojo-dotenv/recipe.yaml @@ -1,5 +1,5 @@ context: - version: "0.2.0" + version: "0.2.1" package: name: mojo-dotenv @@ -45,4 +45,4 @@ about: - Multiline values and escape sequences - Auto-discovery with find_dotenv() - 98%+ compatible with python-dotenv - - 42 comprehensive tests using Mojo's TestSuite framework + - 49 comprehensive tests using Mojo's TestSuite framework From 41a15b6cab00d278caa6fca81e3b311cd446356d Mon Sep 17 00:00:00 2001 From: Michael Booth Date: Mon, 12 Jan 2026 13:18:00 +1100 Subject: [PATCH 3/4] Fix trailing whitespace in recipe.yaml --- recipes/mojo-dotenv/recipe.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/mojo-dotenv/recipe.yaml b/recipes/mojo-dotenv/recipe.yaml index 98987798..f10077d3 100644 --- a/recipes/mojo-dotenv/recipe.yaml +++ b/recipes/mojo-dotenv/recipe.yaml @@ -38,7 +38,7 @@ about: summary: Load environment variables from .env files in Mojo description: | A production-ready .env file parser and loader for Mojo with near-100% python-dotenv compatibility. - + Features: - Parse .env files to Dict or load into environment - Variable expansion (${VAR} and $VAR syntax) From 32855a26ffa91c87ca9796e7f9b04498d26cfce8 Mon Sep 17 00:00:00 2001 From: Michael Booth Date: Mon, 12 Jan 2026 16:06:00 +1100 Subject: [PATCH 4/4] Fix trailing whitespace in test.mojo --- recipes/mojo-dotenv/test.mojo | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/mojo-dotenv/test.mojo b/recipes/mojo-dotenv/test.mojo index 9e2018e4..1818510a 100644 --- a/recipes/mojo-dotenv/test.mojo +++ b/recipes/mojo-dotenv/test.mojo @@ -3,11 +3,11 @@ from dotenv import dotenv_values, load_dotenv fn main() raises: # Basic smoke test print("Testing mojo-dotenv import...") - + # Test that functions exist and are callable # Note: We can't actually load files in the test environment # but we can verify the functions are importable print("✓ dotenv_values imported") print("✓ load_dotenv imported") - + print("All import tests passed!")