coderace 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,30 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ permissions:
8
+ id-token: write
9
+
10
+ jobs:
11
+ publish:
12
+ runs-on: ubuntu-latest
13
+ environment:
14
+ name: pypi
15
+ url: https://pypi.org/p/coderace
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+
19
+ - uses: actions/setup-python@v5
20
+ with:
21
+ python-version: "3.12"
22
+
23
+ - name: Install build tools
24
+ run: pip install build
25
+
26
+ - name: Build package
27
+ run: python -m build
28
+
29
+ - name: Publish to PyPI
30
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,13 @@
1
+ .venv/
2
+ .coderace/
3
+ .agent-relay/
4
+ __pycache__/
5
+ *.egg-info/
6
+ *.pyc
7
+ dist/
8
+ build/
9
+
10
+ AGENTS.md
11
+ CLAUDE.md
12
+ GEMINI.md
13
+ prpm.lock
coderace-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 mikiships
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,142 @@
1
+ Metadata-Version: 2.4
2
+ Name: coderace
3
+ Version: 0.1.0
4
+ Summary: Race coding agents against each other on real tasks
5
+ Project-URL: Homepage, https://github.com/mikiships/coderace
6
+ Project-URL: Repository, https://github.com/mikiships/coderace
7
+ Author: mikiships
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
+ Keywords: ai,aider,benchmark,claude,codex,coding-agents
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Topic :: Software Development :: Testing
21
+ Requires-Python: >=3.10
22
+ Requires-Dist: pyyaml>=6.0
23
+ Requires-Dist: rich>=13.0
24
+ Requires-Dist: typer>=0.9.0
25
+ Provides-Extra: dev
26
+ Requires-Dist: pytest-mock>=3.0; extra == 'dev'
27
+ Requires-Dist: pytest>=7.0; extra == 'dev'
28
+ Requires-Dist: ruff>=0.4.0; extra == 'dev'
29
+ Description-Content-Type: text/markdown
30
+
31
+ # coderace
32
+
33
+ Race coding agents against each other on real tasks in your repo.
34
+
35
+ Define a task. Run it against Claude Code, Codex, and Aider. Get a scored comparison table.
36
+
37
+ ## Install
38
+
39
+ ```bash
40
+ pip install coderace
41
+ ```
42
+
43
+ ## Quick Start
44
+
45
+ ```bash
46
+ # Create a task template
47
+ coderace init fix-auth-bug
48
+
49
+ # Edit the task file (describe the bug, set test command)
50
+ # Then race the agents:
51
+ coderace run fix-auth-bug.yaml
52
+
53
+ # Or race them in parallel (uses git worktrees):
54
+ coderace run fix-auth-bug.yaml --parallel
55
+
56
+ # View results from the last run
57
+ coderace results fix-auth-bug.yaml
58
+ ```
59
+
60
+ ## Task Format
61
+
62
+ ```yaml
63
+ name: fix-auth-bug
64
+ description: |
65
+ The login endpoint returns 500 when email contains a plus sign.
66
+ Fix the email validation in auth/validators.py.
67
+ repo: .
68
+ test_command: pytest tests/test_auth.py -x
69
+ lint_command: ruff check .
70
+ timeout: 300
71
+ agents:
72
+ - claude
73
+ - codex
74
+ - aider
75
+ ```
76
+
77
+ ## What It Does
78
+
79
+ For each agent in the task:
80
+
81
+ 1. Creates a fresh git branch (`coderace/<agent>-<task>`)
82
+ 2. Invokes the agent CLI with the task description
83
+ 3. Runs your test command
84
+ 4. Runs your lint command (optional)
85
+ 5. Computes a composite score
86
+
87
+ ## Scoring
88
+
89
+ | Metric | Weight | Description |
90
+ |--------|--------|-------------|
91
+ | Tests pass | 40% | Did the test command exit 0? |
92
+ | Exit clean | 20% | Did the agent itself exit 0 without timeout? |
93
+ | Lint clean | 15% | Did the lint command exit 0? |
94
+ | Wall time | 15% | Faster is better (normalized across agents) |
95
+ | Lines changed | 10% | Fewer is better (normalized across agents) |
96
+
97
+ ## Output
98
+
99
+ Terminal table with Rich formatting:
100
+
101
+ ```
102
+ ┌──────┬────────┬───────┬───────┬──────┬──────┬──────────┬───────┐
103
+ │ Rank │ Agent │ Score │ Tests │ Exit │ Lint │ Time (s) │ Lines │
104
+ ├──────┼────────┼───────┼───────┼──────┼──────┼──────────┼───────┤
105
+ │ 1 │ claude │ 85.0 │ PASS │ PASS │ PASS │ 10.5 │ 42 │
106
+ │ 2 │ codex │ 70.0 │ PASS │ PASS │ FAIL │ 15.2 │ 98 │
107
+ │ 3 │ aider │ 55.0 │ FAIL │ PASS │ PASS │ 8.1 │ 31 │
108
+ └──────┴────────┴───────┴───────┴──────┴──────┴──────────┴───────┘
109
+ ```
110
+
111
+ Results also saved as JSON in `.coderace/<task>-results.json`.
112
+
113
+ ## Supported Agents
114
+
115
+ | Agent | CLI | Command |
116
+ |-------|-----|---------|
117
+ | Claude Code | `claude` | `claude --print --output-format json -p "<task>"` |
118
+ | Codex | `codex` | `codex --quiet --full-auto -p "<task>"` |
119
+ | Aider | `aider` | `aider --message "<task>" --yes --no-auto-commits` |
120
+ | Gemini CLI | `gemini` | `gemini --non-interactive -p "<task>"` |
121
+
122
+ Each agent must be installed and authenticated separately.
123
+
124
+ ## Parallel Mode
125
+
126
+ Use `--parallel` (or `-p`) to run all agents simultaneously using git worktrees. Each agent gets its own isolated working directory, so they don't interfere with each other.
127
+
128
+ ```bash
129
+ coderace run task.yaml --parallel
130
+ ```
131
+
132
+ Sequential mode (default) runs agents one at a time on the same repo.
133
+
134
+ ## Requirements
135
+
136
+ - Python 3.10+
137
+ - Git
138
+ - At least one coding agent CLI installed
139
+
140
+ ## License
141
+
142
+ MIT
@@ -0,0 +1,112 @@
1
+ # coderace
2
+
3
+ Race coding agents against each other on real tasks in your repo.
4
+
5
+ Define a task. Run it against Claude Code, Codex, and Aider. Get a scored comparison table.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ pip install coderace
11
+ ```
12
+
13
+ ## Quick Start
14
+
15
+ ```bash
16
+ # Create a task template
17
+ coderace init fix-auth-bug
18
+
19
+ # Edit the task file (describe the bug, set test command)
20
+ # Then race the agents:
21
+ coderace run fix-auth-bug.yaml
22
+
23
+ # Or race them in parallel (uses git worktrees):
24
+ coderace run fix-auth-bug.yaml --parallel
25
+
26
+ # View results from the last run
27
+ coderace results fix-auth-bug.yaml
28
+ ```
29
+
30
+ ## Task Format
31
+
32
+ ```yaml
33
+ name: fix-auth-bug
34
+ description: |
35
+ The login endpoint returns 500 when email contains a plus sign.
36
+ Fix the email validation in auth/validators.py.
37
+ repo: .
38
+ test_command: pytest tests/test_auth.py -x
39
+ lint_command: ruff check .
40
+ timeout: 300
41
+ agents:
42
+ - claude
43
+ - codex
44
+ - aider
45
+ ```
46
+
47
+ ## What It Does
48
+
49
+ For each agent in the task:
50
+
51
+ 1. Creates a fresh git branch (`coderace/<agent>-<task>`)
52
+ 2. Invokes the agent CLI with the task description
53
+ 3. Runs your test command
54
+ 4. Runs your lint command (optional)
55
+ 5. Computes a composite score
56
+
57
+ ## Scoring
58
+
59
+ | Metric | Weight | Description |
60
+ |--------|--------|-------------|
61
+ | Tests pass | 40% | Did the test command exit 0? |
62
+ | Exit clean | 20% | Did the agent itself exit 0 without timeout? |
63
+ | Lint clean | 15% | Did the lint command exit 0? |
64
+ | Wall time | 15% | Faster is better (normalized across agents) |
65
+ | Lines changed | 10% | Fewer is better (normalized across agents) |
66
+
67
+ ## Output
68
+
69
+ Terminal table with Rich formatting:
70
+
71
+ ```
72
+ ┌──────┬────────┬───────┬───────┬──────┬──────┬──────────┬───────┐
73
+ │ Rank │ Agent │ Score │ Tests │ Exit │ Lint │ Time (s) │ Lines │
74
+ ├──────┼────────┼───────┼───────┼──────┼──────┼──────────┼───────┤
75
+ │ 1 │ claude │ 85.0 │ PASS │ PASS │ PASS │ 10.5 │ 42 │
76
+ │ 2 │ codex │ 70.0 │ PASS │ PASS │ FAIL │ 15.2 │ 98 │
77
+ │ 3 │ aider │ 55.0 │ FAIL │ PASS │ PASS │ 8.1 │ 31 │
78
+ └──────┴────────┴───────┴───────┴──────┴──────┴──────────┴───────┘
79
+ ```
80
+
81
+ Results also saved as JSON in `.coderace/<task>-results.json`.
82
+
83
+ ## Supported Agents
84
+
85
+ | Agent | CLI | Command |
86
+ |-------|-----|---------|
87
+ | Claude Code | `claude` | `claude --print --output-format json -p "<task>"` |
88
+ | Codex | `codex` | `codex --quiet --full-auto -p "<task>"` |
89
+ | Aider | `aider` | `aider --message "<task>" --yes --no-auto-commits` |
90
+ | Gemini CLI | `gemini` | `gemini --non-interactive -p "<task>"` |
91
+
92
+ Each agent must be installed and authenticated separately.
93
+
94
+ ## Parallel Mode
95
+
96
+ Use `--parallel` (or `-p`) to run all agents simultaneously using git worktrees. Each agent gets its own isolated working directory, so they don't interfere with each other.
97
+
98
+ ```bash
99
+ coderace run task.yaml --parallel
100
+ ```
101
+
102
+ Sequential mode (default) runs agents one at a time on the same repo.
103
+
104
+ ## Requirements
105
+
106
+ - Python 3.10+
107
+ - Git
108
+ - At least one coding agent CLI installed
109
+
110
+ ## License
111
+
112
+ MIT
@@ -0,0 +1,3 @@
1
+ """coderace - Race coding agents against each other on real tasks."""
2
+
3
+ __version__ = "0.1.0"
@@ -0,0 +1,23 @@
1
+ """Agent adapters for coderace."""
2
+
3
+ from coderace.adapters.aider import AiderAdapter
4
+ from coderace.adapters.base import BaseAdapter
5
+ from coderace.adapters.claude import ClaudeAdapter
6
+ from coderace.adapters.codex import CodexAdapter
7
+ from coderace.adapters.gemini import GeminiAdapter
8
+
9
+ ADAPTERS: dict[str, type[BaseAdapter]] = {
10
+ "claude": ClaudeAdapter,
11
+ "codex": CodexAdapter,
12
+ "aider": AiderAdapter,
13
+ "gemini": GeminiAdapter,
14
+ }
15
+
16
+ __all__ = [
17
+ "ADAPTERS",
18
+ "BaseAdapter",
19
+ "ClaudeAdapter",
20
+ "CodexAdapter",
21
+ "AiderAdapter",
22
+ "GeminiAdapter",
23
+ ]
@@ -0,0 +1,20 @@
1
+ """Aider adapter."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from coderace.adapters.base import BaseAdapter
6
+
7
+
8
+ class AiderAdapter(BaseAdapter):
9
+ """Adapter for Aider coding assistant."""
10
+
11
+ name = "aider"
12
+
13
+ def build_command(self, task_description: str) -> list[str]:
14
+ return [
15
+ "aider",
16
+ "--message",
17
+ task_description,
18
+ "--yes",
19
+ "--no-auto-commits",
20
+ ]
@@ -0,0 +1,60 @@
1
+ """Base adapter interface."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import subprocess
6
+ import time
7
+ from abc import ABC, abstractmethod
8
+ from pathlib import Path
9
+
10
+ from coderace.types import AgentResult
11
+
12
+
13
+ class BaseAdapter(ABC):
14
+ """Abstract base class for coding agent adapters."""
15
+
16
+ name: str = "base"
17
+
18
+ @abstractmethod
19
+ def build_command(self, task_description: str) -> list[str]:
20
+ """Build the CLI command to invoke this agent."""
21
+ ...
22
+
23
+ def run(self, task_description: str, workdir: Path, timeout: int) -> AgentResult:
24
+ """Run the agent on a task and capture results."""
25
+ cmd = self.build_command(task_description)
26
+ start = time.monotonic()
27
+ timed_out = False
28
+
29
+ try:
30
+ proc = subprocess.run(
31
+ cmd,
32
+ cwd=workdir,
33
+ capture_output=True,
34
+ text=True,
35
+ timeout=timeout,
36
+ )
37
+ exit_code = proc.returncode
38
+ stdout = proc.stdout
39
+ stderr = proc.stderr
40
+ except subprocess.TimeoutExpired as e:
41
+ timed_out = True
42
+ exit_code = -1
43
+ stdout = (e.stdout or b"").decode("utf-8", errors="replace") if e.stdout else ""
44
+ stderr = (e.stderr or b"").decode("utf-8", errors="replace") if e.stderr else ""
45
+ except FileNotFoundError:
46
+ timed_out = False
47
+ exit_code = 127
48
+ stdout = ""
49
+ stderr = f"Command not found: {cmd[0]}"
50
+
51
+ wall_time = time.monotonic() - start
52
+
53
+ return AgentResult(
54
+ agent=self.name,
55
+ exit_code=exit_code,
56
+ stdout=stdout,
57
+ stderr=stderr,
58
+ wall_time=wall_time,
59
+ timed_out=timed_out,
60
+ )
@@ -0,0 +1,21 @@
1
+ """Claude Code adapter."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from coderace.adapters.base import BaseAdapter
6
+
7
+
8
+ class ClaudeAdapter(BaseAdapter):
9
+ """Adapter for Claude Code CLI."""
10
+
11
+ name = "claude"
12
+
13
+ def build_command(self, task_description: str) -> list[str]:
14
+ return [
15
+ "claude",
16
+ "--print",
17
+ "--output-format",
18
+ "json",
19
+ "-p",
20
+ task_description,
21
+ ]
@@ -0,0 +1,20 @@
1
+ """Codex CLI adapter."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from coderace.adapters.base import BaseAdapter
6
+
7
+
8
+ class CodexAdapter(BaseAdapter):
9
+ """Adapter for OpenAI Codex CLI."""
10
+
11
+ name = "codex"
12
+
13
+ def build_command(self, task_description: str) -> list[str]:
14
+ return [
15
+ "codex",
16
+ "--quiet",
17
+ "--full-auto",
18
+ "-p",
19
+ task_description,
20
+ ]
@@ -0,0 +1,19 @@
1
+ """Gemini CLI adapter."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from coderace.adapters.base import BaseAdapter
6
+
7
+
8
+ class GeminiAdapter(BaseAdapter):
9
+ """Adapter for Google Gemini CLI."""
10
+
11
+ name = "gemini"
12
+
13
+ def build_command(self, task_description: str) -> list[str]:
14
+ return [
15
+ "gemini",
16
+ "--non-interactive",
17
+ "-p",
18
+ task_description,
19
+ ]