Skip to content

Commit ffa9188

Browse files
committed
2 parents 59f5a57 + 5a0e9fe commit ffa9188

File tree

6 files changed

+89
-3
lines changed

6 files changed

+89
-3
lines changed

.github/workflows/tests.yaml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
2+
name: Tests
3+
4+
on:
5+
push:
6+
branches:
7+
- main
8+
pull_request:
9+
branches:
10+
- main
11+
12+
jobs:
13+
test:
14+
runs-on: ubuntu-latest
15+
defaults:
16+
run:
17+
shell: bash -l {0}
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v2
21+
- uses: actions/setup-python@v5
22+
with:
23+
python-version: '3.9'
24+
- name: Create dummy keys.cfg
25+
run: touch keys.cfg
26+
- name: Install uv
27+
run: |
28+
curl -LsSf https://astral.sh/uv/install.sh | sh
29+
- name: Install dependencies
30+
run: |
31+
uv pip install --python ${Python_ROOT_DIR} -e .
32+
- name: Run pytest
33+
run: |
34+
pytest --cov

.pre-commit-config.yaml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
ci:
2+
autoupdate_commit_msg: "chore: update pre-commit hooks"
3+
4+
repos:
5+
- repo: https://github.com/pre-commit/pre-commit-hooks
6+
rev: "v4.6.0"
7+
hooks:
8+
- id: check-added-large-files
9+
- id: check-case-conflict
10+
- id: check-merge-conflict
11+
- id: check-symlinks
12+
- id: mixed-line-ending
13+
- id: detect-private-key
14+
# - id: check-ast
15+
# - id: trailing-whitespace
16+
17+
- repo: https://github.com/astral-sh/ruff-pre-commit
18+
rev: v0.4.4
19+
hooks:
20+
# Run the linter.
21+
- id: ruff
22+
args: ["--fix"]
23+
# Run the formatter.
24+
# - id: ruff-format
25+

eval/scripts/README.md

+9
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@ To run the script, go to the root of this repo and use the following command fro
66
python evaluation/scripts/gencode_json.py [options]
77
```
88

9+
Your first need to set up your API keys. For this, create a `keys.cfg` file at the root of the repository
10+
and add keys as follows:
11+
12+
```
13+
OPENAI_KEY = 'your_api_key'
14+
ANTHROPIC_KEY = 'your_api_key'
15+
GOOGLE_KEY = 'your_api_key' 
16+
```
17+
918
For example, to create model results with `gpt-4o` and the default settings, run
1019

1120
```bash

pyproject.toml

+2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ dependencies = [
2929
"anthropic",
3030
"config",
3131
"rich",
32+
"pytest",
33+
"pytest-cov",
3234
# requirements for execution
3335
"numpy",
3436
"scipy",

src/scicode/parse/parse.py

-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88
import scipy
99
import numpy as np
1010
from sympy import Symbol
11-
from pathlib import Path
12-
from textwrap import dedent
13-
from typing import Any
1411

1512
OrderedContent = list[tuple[str, str]]
1613

tests/test_run_gencode_json.py

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import subprocess
2+
3+
4+
def test_smoke_test():
5+
subprocess.run(["python", "eval/scripts/gencode_json.py", "--help"], check=True)
6+
7+
8+
def test_run_gencode_dummy_model(tmpdir):
9+
cmd = [
10+
"python",
11+
"eval/scripts/gencode_json.py",
12+
"--model",
13+
"dummy",
14+
"--output-dir",
15+
str(tmpdir),
16+
"--prompt-dir",
17+
str(tmpdir / "prompts"),
18+
]
19+
subprocess.run(cmd, check=True)

0 commit comments

Comments
 (0)