Skip to content

Commit

Permalink
Merge pull request #1 from princeton-nlp/main
Browse files Browse the repository at this point in the history
Pull updates from the upstream
  • Loading branch information
ollmer committed May 6, 2024
2 parents 6d8eee9 + ff35352 commit ab59b47
Show file tree
Hide file tree
Showing 20 changed files with 372 additions and 69 deletions.
4 changes: 4 additions & 0 deletions .devcontainer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# .devcontainer

The files in this directory configure a VSCode environment like
GitHub codespaces.
7 changes: 7 additions & 0 deletions .devcontainer/bashrc_epilog.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

if [ -z "$(docker images -q sweagent/swe-agent 2> /dev/null)" ]; then ─╯
echo "⚠️ Please wait for the postCreateCommand to start and finish (a new window will appear shortly) ⚠️"
fi

echo "Here's an example SWE-agent command to try out:"
echo "python run.py --model_name gpt4 --data_path https://github.com/pvlib/pvlib-python/issues/1603 --config_file config/default_from_url.yaml"
22 changes: 22 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "SWE-Agent Codespace",
"image": "mcr.microsoft.com/vscode/devcontainers/miniconda:0-3",
"customizations":{
"vscode":{
"extensions": [
"ms-python.python",
"ms-azuretools.vscode-docker",
"ms-toolsai.jupyter"
]
}
},
"onCreateCommand": "./.devcontainer/oncreate.sh",
"postCreateCommand": "./.devcontainer/postcreate.sh",
"features": {
"docker-in-docker": "latest"
},
"mounts": [
"source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind"
],
"remoteUser": "vscode"
}
12 changes: 12 additions & 0 deletions .devcontainer/oncreate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

set -euo pipefail
set -x

# Run from repo root

sudo usermod -aG docker vscode
sudo chmod 666 /var/run/docker.sock
pip install -e '.'
cp .devcontainer/sample_keys.cfg keys.cfg
cat .devcontainer/bashrc_epilog.sh >> ~/.bashrc
7 changes: 7 additions & 0 deletions .devcontainer/postcreate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

set -euo pipefail
set -x

pip install -e '.'
docker pull sweagent/swe-agent
9 changes: 9 additions & 0 deletions .devcontainer/sample_keys.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
GITHUB_TOKEN: 'GitHub Token to clone private repos' # <-- delete if not needed
OPENAI_API_KEY: 'OpenAI API Key Here if using OpenAI Model'
ANTHROPIC_API_KEY: 'Anthropic API Key Here if using Anthropic Model'
TOGETHER_API_KEY: 'Together API Key Here if using Together Model'
AZURE_OPENAI_API_KEY: 'Azure OpenAI API Key Here if using Azure OpenAI Model'
AZURE_OPENAI_ENDPOINT: 'Azure OpenAI Endpoint Here if using Azure OpenAI Model'
AZURE_OPENAI_DEPLOYMENT: 'Azure OpenAI Deployment Here if using Azure OpenAI Model'
AZURE_OPENAI_API_VERSION: 'Azure OpenAI API Version Here if using Azure OpenAI Model'
OPENAI_API_BASE_URL: 'LM base URL here if using Local or alternative api Endpoint'
194 changes: 194 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1 +1,195 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# Mac files
*.DS_Store

# Custom
keys.cfg

# iPython Notebooks
*.ipynb

# Evaluation folders
results/
testbed/
temp/

# Ignore all YAML files in data/
data/*/ic-*
data/*/single-issues

# Fine tuning data
fine_tune/*.ipynb
fine_tune/subtasks/*.jsonl
temp*.jsonl

# Inspector
inspector/*.json

# Ignore all files in the private folder
private/

### Website

# dependencies
website/frontend/node_modules
website/frontend/package-lock.json
website/frontend/.pnp
*.pnp.js

# testing
website/frontend/coverage

# production
website/frontend/build

# misc
*.env.local
*.env.development.local
*.env.test.local
*.env.production.local
.api_key
*npm-debug.log*
*yarn-debug.log*
*yarn-error.log*


# demo yamls (for editing)
*.demo.yaml

# trajectory files
trajectories/**
!trajectories/demonstrations/**

.vscode/**

# PyCharm
.idea/
20 changes: 9 additions & 11 deletions .github/workflows/ci_no_llm.yaml → .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

name: Tests (no LLM)
name: Pytest

on:
push:
Expand All @@ -18,20 +18,18 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Miniconda
uses: conda-incubator/setup-miniconda@v2
- uses: actions/setup-python@v5
with:
miniconda-version: "latest"
architecture: x64
activate-environment: swe-agent
environment-file: environment.yml
- name: Run setup script and create keys.cfg
python-version: '3.9'
- name: Pull swe-agent docker container
run: |
docker pull sweagent/swe-agent:latest
- name: Create keys.cfg
run: |
./setup.sh
touch keys.cfg
shell: bash
- name: Install test dependencies
- name: Install dependencies
run: |
pip install .
pip install pytest pytest-cov
- name: Run pytest
run: |
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/test_build_containers.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

name: Test build containers

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
setup_job:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Run setup.sh
run: |
./setup.sh
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,8 @@ website/frontend/build
*.demo.yaml

# trajectory files
trajectories/*
trajectories/**
!trajectories/demonstrations/**

.vscode/**

Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ repos:
- id: check-ast

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.1
rev: v0.4.2
hooks:
# Run the linter.
- id: ruff
Expand Down
5 changes: 2 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ FROM python:3.9
# Set the working directory
WORKDIR /app

# Install Python dependencies
RUN pip install anthropic[bedrock] config datasets docker gymnasium numpy openai pandas rich rich_argparse ruamel.yaml swebench tenacity unidiff simple-parsing together ollama

# Install Docker CLI using the official Docker installation script
RUN curl -fsSL https://get.docker.com -o get-docker.sh && \
sh get-docker.sh
Expand All @@ -14,3 +11,5 @@ RUN curl -fsSL https://get.docker.com -o get-docker.sh && \
# Do this last to take advantage of the docker layer mechanism
COPY . /app

# Install Python dependencies
RUN pip install .
Loading

0 comments on commit ab59b47

Please sign in to comment.