Skip to content

Commit 6868182

Browse files
authored
Merge pull request #30 from codegen-sh/codegen-cg-18917-fix-build
2 parents b7513d6 + f2eae00 commit 6868182

File tree

7 files changed

+32
-28
lines changed

7 files changed

+32
-28
lines changed

.github/workflows/benchmark.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,14 @@ jobs:
2828
with:
2929
python-version: '3.12'
3030

31+
- name: Install uv
32+
uses: astral-sh/setup-uv@v3
33+
with:
34+
version: "latest"
35+
3136
- name: Install dependencies
3237
run: |
33-
python -m pip install --upgrade pip
34-
pip install -r requirements.txt
38+
uv sync --all-extras
3539
3640
- name: Set up Docker Buildx
3741
uses: docker/setup-buildx-action@v3
@@ -43,13 +47,13 @@ jobs:
4347
4448
- name: Run benchmarks
4549
run: |
46-
python benchmarks/scripts/auto_publish.py --run-benchmark
50+
uv run python benchmarks/scripts/auto_publish.py --run-benchmark
4751
env:
4852
DOCKER_HOST: unix:///var/run/docker.sock
4953

5054
- name: Generate summary report
5155
run: |
52-
python benchmarks/scripts/auto_publish.py --generate-summary
56+
uv run python benchmarks/scripts/auto_publish.py --generate-summary
5357
5458
- name: Commit and push results
5559
run: |
@@ -64,7 +68,7 @@ jobs:
6468
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6569

6670
- name: Upload benchmark artifacts
67-
uses: actions/upload-artifact@v3
71+
uses: actions/upload-artifact@v4
6872
if: always()
6973
with:
7074
name: benchmark-results

benchmarks/analysis/comparator.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def __init__(self, data_parser: BenchmarkDataParser):
2323
self.data_parser = data_parser
2424

2525
def compare_providers(
26-
self, provider1: str, provider2: str, time_range_days: str | Noneint] = None
26+
self, provider1: str, provider2: str, time_range_days: int | None = None
2727
) -> ComparisonResult:
2828
"""Compare two providers across all available metrics"""
2929

@@ -115,7 +115,7 @@ def compare_providers(
115115

116116
def analyze_time_trends(
117117
self,
118-
provider: str | Nonestr] = None,
118+
provider: str | None = None,
119119
days: int = 30,
120120
metric: str = "success_rate",
121121
) -> TrendAnalysis:
@@ -409,7 +409,7 @@ def _aggregate_provider_metrics_list(
409409

410410
def _extract_metric_value(
411411
self, provider_metrics: ProviderMetrics, metric: str
412-
) -> str | Nonefloat]:
412+
) -> float | None:
413413
"""Extract a specific metric value from provider metrics"""
414414
if metric == "success_rate":
415415
return provider_metrics.overall_success_rate

benchmarks/analysis/config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
class AnalysisConfig:
1111
"""Configuration manager for benchmark analysis settings"""
1212

13-
def __init__(self, config_path: str | Nonestr | Path] = None):
13+
def __init__(self, config_path: str | Path | None = None):
1414
if config_path is None:
1515
config_path = Path(__file__).parent.parent / "configs" / "analysis.json"
1616

@@ -104,7 +104,7 @@ def set(self, key: str, value: Any) -> None:
104104
# Set the value
105105
config[keys[-1]] = value
106106

107-
def save(self, path: str | Nonestr | Path] = None) -> None:
107+
def save(self, path: str | Path | None = None) -> None:
108108
"""Save configuration to file"""
109109
save_path = Path(path) if path else self.config_path
110110
save_path.parent.mkdir(parents=True, exist_ok=True)

benchmarks/analysis/data_parser.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def load_all_results(self) -> list[BenchmarkResult]:
4848
results.sort(key=lambda x: x.timestamp)
4949
return results
5050

51-
def load_json_result(self, file_path: Path) -> str | NoneBenchmarkResult]:
51+
def load_json_result(self, file_path: Path) -> BenchmarkResult | None:
5252
"""Load a benchmark result from a JSON file"""
5353
try:
5454
with open(file_path) as f:
@@ -59,7 +59,7 @@ def load_json_result(self, file_path: Path) -> str | NoneBenchmarkResult]:
5959
print(f"Error loading JSON file {file_path}: {e}")
6060
return None
6161

62-
def load_markdown_result(self, file_path: Path) -> str | NoneBenchmarkResult]:
62+
def load_markdown_result(self, file_path: Path) -> BenchmarkResult | None:
6363
"""Load a benchmark result from a Markdown file"""
6464
try:
6565
with open(file_path) as f:
@@ -279,7 +279,7 @@ def get_results_by_date_range(
279279
if start_date <= result.timestamp <= end_date
280280
]
281281

282-
def get_latest_result(self) -> str | NoneBenchmarkResult]:
282+
def get_latest_result(self) -> BenchmarkResult | None:
283283
"""Get the most recent benchmark result"""
284284
all_results = self.load_all_results()
285285
return all_results[-1] if all_results else None

benchmarks/analysis/models.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ class ProviderMetrics:
3434
avg_execution_time: float
3535
total_scenarios: int
3636
scenarios: dict[str, ScenarioMetrics] = field(default_factory=dict)
37-
benchmark_timestamp: str | Nonedatetime] = None
38-
benchmark_duration: str | Nonefloat] = None
37+
benchmark_timestamp: datetime | None = None
38+
benchmark_duration: float | None = None
3939
status: str = "unknown"
4040

4141

@@ -48,17 +48,17 @@ class BenchmarkResult:
4848
providers_tested: list[str]
4949
test_scenarios: int
5050
provider_results: dict[str, ProviderMetrics] = field(default_factory=dict)
51-
file_path: str | NonePath] = None
52-
raw_data: str | Nonedict[str, Any]] = None
51+
file_path: Path | None = None
52+
raw_data: dict[str, Any] | None = None
5353

5454

5555
@dataclass
5656
class ComparisonResult:
5757
"""Result of comparing benchmark data"""
5858

5959
comparison_type: str # "provider", "time_series", "regression"
60-
baseline: str | str, datetime] # Provider name or timestamp
61-
target: str | str, datetime]
60+
baseline: str | datetime # Provider name or timestamp
61+
target: str | datetime
6262
metrics_compared: list[str]
6363
improvements: dict[str, float] = field(default_factory=dict)
6464
regressions: dict[str, float] = field(default_factory=dict)
@@ -71,7 +71,7 @@ class TrendAnalysis:
7171
"""Time-series trend analysis result"""
7272

7373
metric_name: str
74-
provider: str | Nonestr]
74+
provider: str | None
7575
time_period: str
7676
trend_direction: str # "improving", "declining", "stable"
7777
trend_strength: float # 0-1 scale

benchmarks/analysis/reporter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def __init__(self, output_dir: str | Path = "benchmarks/reports"):
2121
def generate_comparison_report(
2222
self,
2323
comparison_result: ComparisonResult,
24-
output_path: str | NonePath] = None,
24+
output_path: str | Path | None = None,
2525
format: str = "markdown",
2626
) -> Path:
2727
"""Generate a detailed comparison report"""
@@ -44,7 +44,7 @@ def generate_comprehensive_report(
4444
self,
4545
results: list[BenchmarkResult],
4646
format: str = "html",
47-
output_path: str | NonePath] = None,
47+
output_path: str | Path | None = None,
4848
include_charts: bool = True,
4949
) -> Path:
5050
"""Generate a comprehensive benchmark analysis report"""

benchmarks/analysis/visualizer.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def create_provider_comparison_chart(
3939
self,
4040
comparison_result: ComparisonResult,
4141
chart_type: str = "bar",
42-
save_path: str | NonePath] = None,
42+
save_path: str | Path | None = None,
4343
) -> Path:
4444
"""Create a chart comparing two providers"""
4545

@@ -70,7 +70,7 @@ def create_provider_comparison_chart(
7070
return save_path
7171

7272
def create_trend_chart(
73-
self, trend_analysis: TrendAnalysis, save_path: str | NonePath] = None
73+
self, trend_analysis: TrendAnalysis, save_path: str | Path | None = None
7474
) -> Path:
7575
"""Create a trend analysis chart"""
7676

@@ -175,7 +175,7 @@ def create_trend_chart(
175175
return save_path
176176

177177
def create_performance_dashboard(
178-
self, results: list[BenchmarkResult], save_path: str | NonePath] = None
178+
self, results: list[BenchmarkResult], save_path: str | Path | None = None
179179
) -> Path:
180180
"""Create a comprehensive performance dashboard"""
181181

@@ -226,8 +226,8 @@ def create_performance_dashboard(
226226
return save_path
227227

228228
def create_interactive_dashboard(
229-
self, results: list[BenchmarkResult], save_path: str | NonePath] = None
230-
) -> str | NonePath]:
229+
self, results: list[BenchmarkResult], save_path: str | Path | None = None
230+
) -> str | Path | None:
231231
"""Create an interactive HTML dashboard using Plotly"""
232232

233233
if not PLOTLY_AVAILABLE:
@@ -671,7 +671,7 @@ def _plot_scenario_success_rates(self, results: list[BenchmarkResult], ax):
671671
)
672672

673673
def export_chart_data(
674-
self, results: list[BenchmarkResult], save_path: str | NonePath] = None
674+
self, results: list[BenchmarkResult], save_path: str | Path | None = None
675675
) -> Path:
676676
"""Export chart data as JSON for external visualization tools"""
677677

0 commit comments

Comments
 (0)