Skip to content

Commit 1eb5d48

Browse files
committed
feat: separate out and update typer dependency
1 parent ecc15a6 commit 1eb5d48

9 files changed

Lines changed: 26 additions & 9 deletions

File tree

cli/m.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,13 @@
66
evaluation). Run ``m --help`` to see all available sub-commands.
77
"""
88

9-
import typer
9+
try:
10+
import typer
11+
except ImportError:
12+
raise SystemExit(
13+
"The 'm' CLI requires extra dependencies. "
14+
'Please install them with: pip install "mellea[cli]"'
15+
) from None
1016

1117
from cli.alora.commands import alora_app
1218
from cli.decompose import app as decompose_app

docs/alora.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Mellea provides a command-line interface for training and uploading [LoRA](https
99
From the root of the repository:
1010

1111
```bash
12-
pip install mellea
12+
pip install "mellea[cli]"
1313
huggingface-cli login # Optional: only needed for uploads
1414
```
1515

docs/docs/advanced/lora-and-alora-adapters.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ schemes not well-represented in general training data. Mellea lets you train a
1111
[aLoRA](https://github.com/IBM/activated-lora) adapter on your own labeled dataset
1212
and use it as a requirement validator in any Mellea program.
1313

14-
**Prerequisites:** `pip install mellea`, `m` CLI available. Training requires a GPU or
14+
**Prerequisites:** `pip install "mellea[cli]"`. Training requires a GPU or
1515
Apple Silicon Mac with sufficient VRAM for the chosen base model. Uploading requires a
1616
Hugging Face account.
1717

docs/docs/getting-started/installation.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ pip install "mellea[litellm]" # LiteLLM multi-provider (Anthropic, Bedrock, e
2525
pip install "mellea[hf]" # HuggingFace transformers for local inference
2626
pip install "mellea[watsonx]" # IBM WatsonX
2727
pip install "mellea[tools]" # Tool and agent dependencies (LangChain, smolagents)
28+
pip install "mellea[cli]" # m serve, m alora, m decompose CLI commands
2829
pip install "mellea[telemetry]" # OpenTelemetry tracing and metrics
2930
```
3031

@@ -33,6 +34,7 @@ uv add "mellea[litellm]" # LiteLLM multi-provider (Anthropic, Bedrock, et
3334
uv add "mellea[hf]" # HuggingFace transformers for local inference
3435
uv add "mellea[watsonx]" # IBM WatsonX
3536
uv add "mellea[tools]" # Tool and agent dependencies (LangChain, smolagents)
37+
uv add "mellea[cli]" # m serve, m alora, m decompose CLI commands
3638
uv add "mellea[telemetry]" # OpenTelemetry tracing and metrics
3739
```
3840

docs/docs/guide/m-decompose.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ description: "Break complex tasks into ordered, executable subtasks with the m d
1111
3. Generate a prompt template for each subtask
1212
4. Output a ready-to-run Python script that executes each subtask in order
1313

14-
**Prerequisites:** Mellea installed (`uv add mellea`), Ollama running locally (or an OpenAI-compatible endpoint).
14+
**Prerequisites:** Mellea installed (`uv add "mellea[cli]"`), Ollama running locally (or an OpenAI-compatible endpoint).
1515

1616
## Basic usage
1717

docs/docs/how-to/refactor-prompts-with-cli.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: "Use m decompose to break a complex prompt into typed, validated ge
55
# diataxis: how-to
66
---
77

8-
**Prerequisites:** `pip install mellea`, Ollama running locally (or an
8+
**Prerequisites:** `pip install "mellea[cli]"`, Ollama running locally (or an
99
OpenAI-compatible endpoint).
1010

1111
When a single prompt grows too long or asks the LLM to do too many things at

docs/docs/integrations/m-serve.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ description: "Run a Mellea program as an OpenAI-compatible chat endpoint with m
88
any LLM client — LangChain, the OpenAI SDK, `curl` — call your Mellea program as if
99
it were a model.
1010

11-
**Prerequisites:** `pip install mellea`.
11+
**Prerequisites:** `pip install "mellea[cli]"`.
1212

1313
## The serve() function
1414

pyproject.toml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ dependencies = [
2323
"jinja2",
2424
"ollama>=0.5.1",
2525
"requests>=2.32.3",
26-
"typer",
27-
"click<8.2.0", # Newer versions will cause errors with --help in typer CLIs.
2826
"mistletoe>=1.4.0",
2927
"pillow", # Needed for Intrinsics (HF and OpenAI Backends).
3028
"math_verify", # Needed for Majority Voting Sampling Strategies.
@@ -91,6 +89,10 @@ granite_retriever = [
9189
"elasticsearch>=8.0.0,<9.0.0",
9290
]
9391

92+
cli = [
93+
"typer",
94+
]
95+
9496
# Infrastructure
9597
server = [
9698
"uvicorn",
@@ -108,7 +110,7 @@ hooks = [
108110
"grpcio>=1.78.0",
109111
]
110112

111-
all = ["mellea[backends,docling,tools,telemetry,server,sandbox,granite_retriever,hooks]"]
113+
all = ["mellea[backends,docling,tools,telemetry,server,sandbox,granite_retriever,hooks,cli]"]
112114

113115
[dependency-groups]
114116
# Development groups: uv sync --all-groups

test/package/test_dependency_isolation.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
"import pyarrow",
6464
"import elasticsearch",
6565
],
66+
"cli": ["import typer"],
6667
"server": ["import uvicorn", "import fastapi"],
6768
"sandbox": ["import llm_sandbox"],
6869
"hooks": [
@@ -102,6 +103,7 @@
102103
"server",
103104
"sandbox",
104105
"hooks",
106+
"cli",
105107
"backends",
106108
}
107109

@@ -369,6 +371,11 @@ def test_sandbox() -> None:
369371
_run_check(extra="sandbox", should_succeed=[*IMPORTS["core"], *IMPORTS["sandbox"]])
370372

371373

374+
def test_cli() -> None:
375+
"""mellea[cli]: typer is available."""
376+
_run_check(extra="cli", should_succeed=[*IMPORTS["core"], *IMPORTS["cli"]])
377+
378+
372379
def test_hooks() -> None:
373380
"""mellea[hooks]: plugin framework is available."""
374381
_run_check(

0 commit comments

Comments
 (0)