Skip to content

Commit d167cd4

Browse files
Fix Python 3.9 compatibility + add .claude project settings
- Replace `str | list[str]` with `Union[str, List[str]]` (3.9 compat) - Replace `str | None` with `Optional[str]` in validator.py - Replace `Live | None` with `Optional[Live]` in display.py - Add .claude/settings.json: auto-allow git, ruff, pytest, pip, soup Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 7665e7c commit d167cd4

File tree

4 files changed

+33
-5
lines changed

4 files changed

+33
-5
lines changed

.claude/settings.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"permissions": {
3+
"allow": [
4+
"Bash(git status*)",
5+
"Bash(git diff*)",
6+
"Bash(git log*)",
7+
"Bash(git add*)",
8+
"Bash(git commit*)",
9+
"Bash(git push*)",
10+
"Bash(git branch*)",
11+
"Bash(git checkout*)",
12+
"Bash(git stash*)",
13+
"Bash(git remote*)",
14+
"Bash(ruff check*)",
15+
"Bash(ruff format*)",
16+
"Bash(pytest*)",
17+
"Bash(python -m pytest*)",
18+
"Bash(pip install*)",
19+
"Bash(pip list*)",
20+
"Bash(soup *)",
21+
"Bash(python -m soup_cli*)"
22+
]
23+
}
24+
}

soup_cli/config/schema.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Pydantic schemas for soup.yaml config — single source of truth."""
22

3-
from typing import Literal, Optional
3+
from typing import List, Literal, Optional, Union
44

55
from pydantic import BaseModel, Field
66

@@ -9,7 +9,7 @@ class LoraConfig(BaseModel):
99
r: int = Field(default=64, description="LoRA rank")
1010
alpha: int = Field(default=16, description="LoRA alpha")
1111
dropout: float = Field(default=0.05, description="LoRA dropout")
12-
target_modules: str | list[str] = Field(
12+
target_modules: Union[str, List[str]] = Field(
1313
default="auto",
1414
description="Target modules for LoRA. 'auto' = let peft decide.",
1515
)
@@ -28,7 +28,7 @@ class DataConfig(BaseModel):
2828
class TrainingConfig(BaseModel):
2929
epochs: int = Field(default=3, ge=1, description="Number of training epochs")
3030
lr: float = Field(default=2e-5, gt=0, description="Learning rate")
31-
batch_size: int | Literal["auto"] = Field(
31+
batch_size: Union[int, Literal["auto"]] = Field(
3232
default="auto",
3333
description="Batch size. 'auto' = find max that fits in memory.",
3434
)

soup_cli/data/validator.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
"""Dataset validation and statistics."""
22

3+
from typing import Optional
4+
35
from soup_cli.data.formats import FORMAT_SIGNATURES
46

57

6-
def validate_and_stats(data: list[dict], expected_format: str | None = None) -> dict:
8+
def validate_and_stats(data: list[dict], expected_format: Optional[str] = None) -> dict:
79
"""Compute stats and validate dataset."""
810
if not data:
911
return {

soup_cli/monitoring/display.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
"""Rich live training dashboard in the terminal."""
22

3+
from typing import Optional
4+
35
from rich.console import Console
46
from rich.live import Live
57
from rich.panel import Panel
@@ -23,7 +25,7 @@ def __init__(self, config: SoupConfig, device_name: str = ""):
2325
self.grad_norm = 0.0
2426
self.gpu_mem = ""
2527
self.speed = 0.0
26-
self._live: Live | None = None
28+
self._live: Optional[Live] = None
2729

2830
def start(self, total_steps: int):
2931
"""Start the live display."""

0 commit comments

Comments
 (0)