mirror of
https://github.com/All-Hands-AI/OpenHands.git
synced 2026-01-09 14:57:59 -05:00
* WIP for integrate aider linter, see OpenDevin#2220
Updated aider linter to:
* Always return text and line numbers
* Moved extract line number more consistently
* Changed pylint to stop after first linter detects errors
Updated agentskills
* To get back a LintResult object and then use lines and text for error message and related line number
* Moved code for extracting line number to aider linter
Tests:
* Added additional unit tests for aider to test for
* Return values from lint failures
* Confirm linter works for non-configured languages like Ruby
* move to agent_skills, fixes not seeing skills error
* format/lint to new code, fix failing tests, remove unused code from aider linter
* small changes (remove litellm, fix readme typo)
* fix failing sandbox test
* keep, change dumping of metadata
* WIP for integrate aider linter, see OpenDevin#2220
Updated aider linter to:
* Always return text and line numbers
* Moved extract line number more consistently
* Changed pylint to stop after first linter detects errors
Updated agentskills
* To get back a LintResult object and then use lines and text for error message and related line number
* Moved code for extracting line number to aider linter
Tests:
* Added additional unit tests for aider to test for
* Return values from lint failures
* Confirm linter works for non-configured languages like Ruby
* move to agent_skills, fixes not seeing skills error
* format/lint to new code, fix failing tests, remove unused code from aider linter
* remove duplication of tree-sitter, grep-ast and update poetry.lock
* revert to main branch poetry.lock version
* only update necessary package
* fix jupyter kernel wrong interpreter issue (only for swebench)
* fix failing lint tests
* update syntax error checks for flake
* update poetry lock file
* update poetry.lock file, which update content-hash
* add grep ast
* remove extra stuff caused by merge
* update pyproject
* remove extra pytest fixture, ruff styling fixes
* lint files
* update poetry.lock file
---------
Co-authored-by: Jeff Katzy <jeffreyerickatz@gmail.com>
Co-authored-by: yufansong <yufan@risingwave-labs.com>
Co-authored-by: Xingyao Wang <xingyao@all-hands.dev>
Co-authored-by: Xingyao Wang <xingyao6@illinois.edu>
Co-authored-by: tobitege <tobitege@gmx.de>
88 lines
3.5 KiB
Bash
Executable File
88 lines
3.5 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
# Hardcoded to use the Python interpreter from the OpenDevin runtime client
|
|
OPENDEVIN_PYTHON_INTERPRETER=/opendevin/miniforge3/bin/python
|
|
# check if OPENDEVIN_PYTHON_INTERPRETER exists and it is usable
|
|
if [ -z "$OPENDEVIN_PYTHON_INTERPRETER" ] || [ ! -x "$OPENDEVIN_PYTHON_INTERPRETER" ]; then
|
|
echo "OPENDEVIN_PYTHON_INTERPRETER is not usable. Please pull the latest Docker image!"
|
|
exit 1
|
|
fi
|
|
|
|
# Install dependencies
|
|
$OPENDEVIN_PYTHON_INTERPRETER -m pip install jupyterlab notebook jupyter_kernel_gateway
|
|
|
|
source ~/.bashrc
|
|
# ADD /opendevin/plugins to PATH to make `jupyter_cli` available
|
|
echo 'export PATH=$PATH:/opendevin/plugins/jupyter' >> ~/.bashrc
|
|
export PATH=/opendevin/plugins/jupyter:$PATH
|
|
|
|
# Temporary add /opendevin/miniforge3/bin to PATH
|
|
# will not persist after the end of the script
|
|
# This fixes https://github.com/OpenDevin/OpenDevin/pull/2489#issuecomment-2223088169
|
|
export PATH=/opendevin/miniforge3/bin:$PATH
|
|
|
|
# if user name is `opendevin`, add '/home/opendevin/.local/bin' to PATH
|
|
if [ "$USER" = "opendevin" ]; then
|
|
echo 'export PATH=$PATH:/home/opendevin/.local/bin' >> ~/.bashrc
|
|
echo "export OPENDEVIN_PYTHON_INTERPRETER=$OPENDEVIN_PYTHON_INTERPRETER" >> ~/.bashrc
|
|
export PATH=$PATH:/home/opendevin/.local/bin
|
|
export PIP_CACHE_DIR=$HOME/.cache/pip
|
|
fi
|
|
# if user name is `root`, add '/root/.local/bin' to PATH
|
|
if [ "$USER" = "root" ]; then
|
|
echo 'export PATH=$PATH:/root/.local/bin' >> ~/.bashrc
|
|
echo "export OPENDEVIN_PYTHON_INTERPRETER=$OPENDEVIN_PYTHON_INTERPRETER" >> ~/.bashrc
|
|
export PATH=$PATH:/root/.local/bin
|
|
export PIP_CACHE_DIR=$HOME/.cache/pip
|
|
|
|
fi
|
|
|
|
# Run background process to start jupyter kernel gateway
|
|
# write a bash function that finds a free port
|
|
find_free_port() {
|
|
local start_port="${1:-20000}"
|
|
local end_port="${2:-65535}"
|
|
|
|
for port in $(seq $start_port $end_port); do
|
|
if ! ss -tuln | awk '{print $5}' | grep -q ":$port$"; then
|
|
echo $port
|
|
return
|
|
fi
|
|
done
|
|
|
|
echo "No free ports found in the range $start_port to $end_port" >&2
|
|
return 1
|
|
}
|
|
|
|
export JUPYTER_GATEWAY_PORT=$(find_free_port 20000 30000)
|
|
$OPENDEVIN_PYTHON_INTERPRETER -m \
|
|
jupyter kernelgateway --KernelGatewayApp.ip=0.0.0.0 --KernelGatewayApp.port=$JUPYTER_GATEWAY_PORT > /opendevin/logs/jupyter_kernel_gateway.log 2>&1 &
|
|
|
|
export JUPYTER_GATEWAY_PID=$!
|
|
echo "export JUPYTER_GATEWAY_PID=$JUPYTER_GATEWAY_PID" >> ~/.bashrc
|
|
export JUPYTER_GATEWAY_KERNEL_ID="default"
|
|
echo "export JUPYTER_GATEWAY_KERNEL_ID=$JUPYTER_GATEWAY_KERNEL_ID" >> ~/.bashrc
|
|
echo "JupyterKernelGateway started with PID: $JUPYTER_GATEWAY_PID"
|
|
|
|
# Start the jupyter_server
|
|
export JUPYTER_EXEC_SERVER_PORT=$(find_free_port 30000 40000)
|
|
echo "export JUPYTER_EXEC_SERVER_PORT=$JUPYTER_EXEC_SERVER_PORT" >> ~/.bashrc
|
|
$OPENDEVIN_PYTHON_INTERPRETER /opendevin/plugins/jupyter/execute_server.py > /opendevin/logs/jupyter_execute_server.log 2>&1 &
|
|
export JUPYTER_EXEC_SERVER_PID=$!
|
|
echo "export JUPYTER_EXEC_SERVER_PID=$JUPYTER_EXEC_SERVER_PID" >> ~/.bashrc
|
|
echo "Execution server started with PID: $JUPYTER_EXEC_SERVER_PID"
|
|
|
|
# Wait until /opendevin/logs/jupyter_kernel_gateway.log contains "is available"
|
|
while ! grep -q "at" /opendevin/logs/jupyter_kernel_gateway.log; do
|
|
echo "Waiting for Jupyter kernel gateway to be available..."
|
|
sleep 1
|
|
done
|
|
# Wait until /opendevin/logs/jupyter_execute_server.log contains "Jupyter kernel created for conversation"
|
|
while ! grep -q "kernel created" /opendevin/logs/jupyter_execute_server.log; do
|
|
echo "Waiting for Jupyter kernel to be created..."
|
|
sleep 1
|
|
done
|
|
echo "Jupyter kernel ready."
|