Skip to content

Commit e259eab

Browse files
Mjboothauswarp-agentyetalit
authored
Add mojo-dotenv v0.2.2 - .env file loader for Mojo (#197)
* Add mojo-dotenv v0.2.2 with CodeQL and package image - Add package image for builds.modular.com display - Update to v0.2.2 with CodeQL scanning enabled - Update license to Apache-2.0 - Rename test.mojo to test_package.mojo per convention * Standardize mojo-dotenv to use mojo_version context with 0.25.7 - Add mojo_version to context - Change from 'max >=25.1.0' to 'mojo-compiler =0.25.7' - Add build section with mojo-compiler - Use pin_compatible() for runtime dependency Co-Authored-By: Warp <agent@warp.dev> * Update mojo-dotenv recipe to Mojo 0.26.1 Co-Authored-By: Warp <agent@warp.dev> --------- Co-authored-by: Warp <agent@warp.dev> Co-authored-by: Tiyagora <98420273+yetalit@users.noreply.github.com>
1 parent a5345d9 commit e259eab

3 files changed

Lines changed: 64 additions & 0 deletions

File tree

recipes/mojo-dotenv/image.png

151 KB
Loading

recipes/mojo-dotenv/recipe.yaml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
context:
2+
version: "0.2.2"
3+
mojo_version: "=0.26.1"
4+
5+
package:
6+
name: mojo-dotenv
7+
version: ${{ version }}
8+
9+
source:
10+
git: https://github.com/DataBooth/mojo-dotenv
11+
tag: v${{ version }}
12+
13+
build:
14+
number: 0
15+
noarch: generic
16+
script:
17+
- mkdir -p $PREFIX/lib/mojo/dotenv
18+
- cp -r src/dotenv/* $PREFIX/lib/mojo/dotenv/
19+
20+
requirements:
21+
build:
22+
- mojo-compiler ${{ mojo_version }}
23+
host:
24+
- mojo-compiler ${{ mojo_version }}
25+
run:
26+
- ${{ pin_compatible('mojo-compiler') }}
27+
28+
tests:
29+
- script:
30+
- test -f $PREFIX/lib/mojo/dotenv/__init__.mojo
31+
- test -f $PREFIX/lib/mojo/dotenv/parser.mojo
32+
- test -f $PREFIX/lib/mojo/dotenv/loader.mojo
33+
- test -f $PREFIX/lib/mojo/dotenv/finder.mojo
34+
35+
about:
36+
homepage: https://github.com/DataBooth/mojo-dotenv
37+
repository: https://github.com/DataBooth/mojo-dotenv
38+
documentation: https://github.com/DataBooth/mojo-dotenv/blob/main/README.md
39+
license: Apache-2.0
40+
license_file: LICENSE
41+
summary: Load environment variables from .env files in Mojo
42+
description: |
43+
A production-ready .env file parser and loader for Mojo with near-100% python-dotenv compatibility.
44+
45+
Features:
46+
- Parse .env files to Dict or load into environment
47+
- Variable expansion (${VAR} and $VAR syntax)
48+
- Multiline values and escape sequences
49+
- Auto-discovery with find_dotenv()
50+
- 98%+ compatible with python-dotenv
51+
- 49 comprehensive tests using Mojo's TestSuite framework
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from dotenv import dotenv_values, load_dotenv
2+
3+
fn main() raises:
4+
# Basic smoke test
5+
print("Testing mojo-dotenv import...")
6+
7+
# Test that functions exist and are callable
8+
# Note: We can't actually load files in the test environment
9+
# but we can verify the functions are importable
10+
print("✓ dotenv_values imported")
11+
print("✓ load_dotenv imported")
12+
13+
print("All import tests passed!")

0 commit comments

Comments
 (0)