Skip to content

Commit 9e68977

Browse files
committed
docs
1 parent 13fc8b8 commit 9e68977

File tree

2 files changed

+122
-1
lines changed

2 files changed

+122
-1
lines changed

docs/make_md.py

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
import datasets
2+
import subprocess
3+
4+
import requests
5+
from bs4 import BeautifulSoup
6+
7+
def get_github_avatar(repo):
8+
"""
9+
Given a GitHub repo in the format 'owner/repo', get the avatar URL of the organization or user.
10+
"""
11+
try:
12+
org = repo.split("/")[0]
13+
# Construct the URL for the repo
14+
url = f"https://github.com/{org}"
15+
16+
# Make a request to the page
17+
response = requests.get(url)
18+
19+
# Check if the request was successful
20+
if response.status_code != 200:
21+
print(f"Failed to fetch page for {repo}. Status code: {response.status_code}")
22+
return None
23+
24+
# Parse the HTML content using BeautifulSoup
25+
soup = BeautifulSoup(response.content, 'html.parser')
26+
27+
# Find the meta tag with property "og:image" which contains the avatar URL
28+
meta_tag = soup.find('meta', property='og:image')
29+
30+
if meta_tag and 'content' in meta_tag.attrs:
31+
avatar_url = meta_tag['content']
32+
return avatar_url
33+
else:
34+
print(f"Avatar URL not found for {repo}")
35+
return None
36+
37+
except Exception as e:
38+
print(f"An error occurred: {e}")
39+
return None
40+
41+
d = datasets.load_dataset("wentingzhao/commit0_docstring", split="test")
42+
43+
print(d)
44+
45+
46+
47+
print("| | Name | Repo | Commit0 | Tests | | ")
48+
print("|--|--------|-------|----|----|------| ")
49+
overload = {
50+
"simpy" : "https://simpy.readthedocs.io/en/4.1.1/_images/simpy-logo-small.png",
51+
"tinydb" : "https://raw.githubusercontent.com/msiemens/tinydb/master/artwork/logo.png",
52+
"bitstring": "https://bitstring.readthedocs.io/en/stable/_images/bitstring_logo.png",
53+
"seaborn": "https://raw.githubusercontent.com/mwaskom/seaborn/master/doc/_static/logo-wide-lightbg.svg",
54+
"statsmodels": "https://raw.githubusercontent.com/statsmodels/statsmodels/main/docs/source/images/statsmodels-logo-v2-horizontal.svg",
55+
"pyboy" : "https://github.com/Baekalfen/PyBoy/raw/master/extras/README/pyboy.svg",
56+
}
57+
skip = {
58+
"pyjwt",
59+
"wcwidth",
60+
"chardet",
61+
"dnspython",
62+
"imapclient",
63+
"pexpect",
64+
"dulwich",
65+
"voluptuous",
66+
"requests",
67+
"tlslite-ng",
68+
"more-itertools",
69+
"deprecated",
70+
"cachetools",
71+
"paramiko",
72+
"jedi",
73+
"sqlparse",
74+
}
75+
for i, ex in enumerate(d):
76+
img = get_github_avatar(ex["original_repo"])
77+
78+
name = ex["repo"].split("/")[1]
79+
result = subprocess.check_output(f"commit0 get-tests {name} | wc", shell=True, text=True)
80+
81+
tests = int(result.split()[0])
82+
if name.lower() not in skip and name.lower() not in overload:
83+
img = f"<img src='{img}' width='100px'/>"
84+
elif name.lower() in overload:
85+
img = f"<img src='{overload[name.lower()]}' width='100px'/>"
86+
else:
87+
img = f"<b>{name}</b>"
88+
print(f"| {img} | [{name}]({ex['setup']['specification']}) | [[orig](http://github.com/{ex['original_repo']})] | [[commit0](http://github.com/{ex['repo']})] | {tests} | <img src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAABkCAQAAADtJZLrAAAAD0lEQVR42mNkYGAcRcQhADxaAGWhD8eHAAAAAElFTkSuQmCC'/> |")

docs/setup.md

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Setup
1+
# Quickstart
22

33
## Install
44

@@ -104,3 +104,36 @@ functions in one file of the minitorch library.
104104

105105
For a full example baseline system that tries to solve
106106
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

Comments
 (0)