Skip to content

Commit 67ee573

Browse files
bokelleyclaude
andcommitted
fix: Move email-validator to runtime dependencies (#51)
* fix: Move email-validator to runtime dependencies The generated types use Pydantic's EmailStr which requires email-validator at runtime. Previously it was only in dev dependencies, causing the CLI to fail with "ModuleNotFoundError: No module named 'email_validator'". 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * test: Add CLI import test to catch missing runtime dependencies Added test_cli_imports_successfully to verify that the CLI can import all required dependencies, specifically including types that use EmailStr which requires email_validator. This test would have caught the bug where email_validator was only in dev dependencies. The test imports Contact from brand_manifest which uses EmailStr, triggering Pydantic's validation that requires email_validator to be installed. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 673278f commit 67ee573

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ dependencies = [
3131
"typing-extensions>=4.5.0",
3232
"a2a-sdk>=0.3.0",
3333
"mcp>=0.9.0",
34+
"email-validator>=2.0.0",
3435
]
3536

3637
[project.scripts]
@@ -45,7 +46,6 @@ dev = [
4546
"black>=23.0.0",
4647
"ruff>=0.1.0",
4748
"datamodel-code-generator[http]>=0.35.0",
48-
"email-validator>=2.0.0",
4949
]
5050

5151
[project.urls]

tests/test_cli.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,28 @@
2020
class TestCLIBasics:
2121
"""Test basic CLI functionality."""
2222

23+
def test_cli_imports_successfully(self):
24+
"""Test that CLI can import all dependencies including email_validator.
25+
26+
This test catches missing runtime dependencies that would cause
27+
ModuleNotFoundError when the CLI tries to import generated types.
28+
The generated types use EmailStr which requires email_validator.
29+
"""
30+
# Import the CLI module and a type that uses EmailStr (BrandManifest.contact.email)
31+
result = subprocess.run(
32+
[
33+
sys.executable,
34+
"-c",
35+
"import adcp.__main__; from adcp.types.generated_poc.brand_manifest import Contact",
36+
],
37+
capture_output=True,
38+
text=True,
39+
)
40+
assert result.returncode == 0, f"CLI import failed: {result.stderr}"
41+
assert "ModuleNotFoundError" not in result.stderr
42+
assert "email_validator" not in result.stderr
43+
assert "ImportError" not in result.stderr
44+
2345
def test_cli_help(self):
2446
"""Test that --help works."""
2547
result = subprocess.run(

0 commit comments

Comments
 (0)