Skip to content

Commit d5de893

Browse files
author
Dylan Huang
committed
Merge branch 'main' into dhuang/dxe-442-refactor-ep-upload-to-use-fireworks-sdk-auto-generate-flags
2 parents faa63bc + 6517c35 commit d5de893

File tree

3 files changed

+42
-12
lines changed

3 files changed

+42
-12
lines changed

eval_protocol/training/__init__.py

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,30 @@
1-
from .gepa_trainer import GEPATrainer
2-
from .gepa_utils import (
3-
DSPyModuleType,
4-
DSPyModuleFactory,
5-
create_single_turn_program,
6-
create_signature,
7-
build_reflection_lm,
8-
)
1+
from typing import TYPE_CHECKING
2+
3+
# GEPA/DSPy-related imports are optional - only available when dspy extra is installed
4+
# Use: pip install eval-protocol[dspy]
5+
_DSPY_AVAILABLE = False
6+
try:
7+
import dspy # noqa: F401
8+
9+
_DSPY_AVAILABLE = True
10+
except ImportError:
11+
pass
12+
13+
14+
def _raise_dspy_import_error(name: str):
15+
"""Raise a helpful error when dspy is not installed."""
16+
raise ImportError(f"'{name}' requires the 'dspy' extra. Install it with: pip install eval-protocol[dspy]")
17+
18+
19+
if TYPE_CHECKING or _DSPY_AVAILABLE:
20+
from .gepa_trainer import GEPATrainer
21+
from .gepa_utils import (
22+
DSPyModuleType,
23+
DSPyModuleFactory,
24+
create_single_turn_program,
25+
create_signature,
26+
build_reflection_lm,
27+
)
928

1029
__all__ = [
1130
"GEPATrainer",
@@ -17,3 +36,10 @@
1736
# Reflection LM helpers
1837
"build_reflection_lm",
1938
]
39+
40+
41+
def __getattr__(name: str):
42+
"""Lazy loading for dspy-dependent exports."""
43+
if name in __all__ and not _DSPY_AVAILABLE:
44+
_raise_dspy_import_error(name)
45+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")

pyproject.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ dependencies = [
4848
"deepdiff>=6.0.0",
4949
"websockets>=15.0.1",
5050
"fastapi>=0.116.1",
51-
"dspy>=3.0.0",
5251
"fireworks-ai==1.0.0a18",
5352
]
5453

@@ -133,6 +132,9 @@ braintrust = [
133132
openenv = [
134133
"openenv-core",
135134
]
135+
dspy = [
136+
"dspy>=3.0.0",
137+
]
136138

137139
# Optional deps for LangGraph example/tests
138140
langgraph = [

uv.lock

Lines changed: 5 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)