1+ # Quickstart
2+
3+ ## Install
4+
15First be sure that you have docker tools installed.
26
37``` bash
@@ -7,42 +11,129 @@ apt install docker
711To install the benchmark run,
812
913``` bash
10- pip install spec2repo
14+ pip install commit0
1115```
1216
13- Then run
17+ ## Commands
18+
19+ The system is a command-line tool that allows you to run unit-tests on a
20+ variety of libraries in isolated environments. To get started with the full
21+ setup run the ` clone ` command which will install a clone the code of a subset
22+ of libraries to your ` repos/ ` directory.
1423
1524``` bash
16- spec2repo new local
25+ commit0 clone lit
1726```
1827
19- This will generate a file ` spec2repo.yml ` in your project.
20- To launch the benchmark suite run
28+ Next run the ` build ` command which will configure Docker containers for
29+ each of the libraries with isolated virtual environments. The command uses the
30+ [ uv] ( https://github.com/astral-sh/uv ) library for efficient builds.
2131
2232``` bash
23- spec2repo launch
33+ commit0 build lit
2434```
2535
26- This will launch a set of docker instances for each of the repos as well as a
27- local master.
36+ The main operation you can do with these enviroments is to run tests.
37+ Here we run [ a test] ( https://github.com/commit-0/simpy/blob/master/tests/test_event.py#L11 ) in the ` simpy ` library.
38+
39+ ``` bash
40+ commit0 test simpy tests/test_event.py::test_succeed
41+ ```
2842
29- Now let's apply a patch to one of our repos:
43+ This test should run and pass, but others will fail.
44+
45+ ``` bash
46+ commit0 test minitorch tests/test_operators.py::test_relu
47+ ```
48+
49+ Let's now manually go in and change that repo.
50+ This is all just standard shell commands.
3051
3152``` bash
3253cd repos/minitorch/
33- git checkout -b first_change
34- patch ../../minitorch.example.patch .
35- spec2repo test minitorch first_change test_add
54+ git checkout -b mychange
3655```
3756
38- This will run the ` test_add ` in the MiniTorch Repository and show the results .
57+ And apply and commit this patch .
3958
40- To get your current score on a repository you can run
59+ ```
60+ --- a/minitorch/operators.py
61+ +++ b/minitorch/operators.py
62+ @@ -81,7 +81,7 @@ def relu(x: float) -> float:
63+ (See https://en.wikipedia.org/wiki/Rectifier_(neural_networks) .)
64+ """
65+ # TODO: Implement for Task 0.1.
66+ - raise NotImplementedError('Need to implement for Task 0.1')
67+ + return 1. if x > 0. else 0.
68+ ```
69+
70+ Once this is done we can run ` test ` with
71+ a branch and the environment will sync and run.
72+
73+ ``` bash
74+ commit0 test minitorch branch=mychange tests/test_operators.py::test_relu
75+ ```
76+
77+ ## Running an Agent
78+
79+ Next we will see how this can be run with an AI agent system.
80+ We will use [ Aider] ( https://aider.chat/ ) which is a nice
81+ command-line oriented agent system.
82+
83+ To setup Aider first set your api key.
84+ We recommend using Claude Sonnet.
4185
4286``` bash
43- spec2repo score minitorch
87+ # Work with Claude 3.5 Sonnet on your repo
88+ export ANTHROPIC_API_KEY=your-key-goes-here
4489```
4590
46- ## Running Aider
91+ Once this is setup you can run Aider with the following command.
92+ This will edit the files locally in your branch, but
93+ run the tests inside the environment.
4794
48- ...
95+ ``` bash
96+ aider --model sonnet --file repos/minitorch/operators.py --message " fill in" \
97+ --auto-test --test \
98+ --test-cmd ' commit0 test minitorch branch=mychange tests/test_operators.py::test_relu' \
99+ --yes
100+ ```
101+
102+ This will run an LLM agent that will try to fill in the
103+ functions in one file of the minitorch library.
104+
105+ For a full example baseline system that tries to solve
106+ all the tests in the library see the [ baseline] ( baseline ) documentation.
107+
108+
109+ ## Distributed Tests
110+
111+ One of the main advantages of ` commit0 ` is that it can run
112+ a range of unit tests in distributed environments.
113+
114+ By default, the library is configured to work with [ modal] ( https://modal.com/ ) .
115+
116+ ``` bash
117+ pip install modal
118+ modal token new
119+ ```
120+
121+ To enable distributed run, first
122+ create a file called ` distributed.yaml `
123+
124+ ``` yaml
125+ backend : modal
126+ base_dir : repos.dist/
127+ ` ` `
128+
129+ You can pass this configuration file as an argumnet to clone.
130+
131+ ` ` ` bash
132+ commit0 clone lite --cfg=distributed.yaml
133+ ```
134+
135+ Next to run tests you can run the standard test command.
136+
137+ ``` bash
138+ commit0 test simpy master tests/test_event.py::test_succeed --cfg=distributed.yaml
139+ ```
0 commit comments