Skip to content

Commit

Permalink
Switch to Poetry (All-Hands-AI#378)
Browse files Browse the repository at this point in the history
* create the pyproject file

* Fix the pyproject.toml file

* Update Makefile

* adapt makefile

* fix some execution issues

* Untrack lock files and wait for the backend to get start before frontend

* Remove LangChain dependencies

* Add github action for pytest

* add missing dependency

* rebase and fix the versions adding lock file

* add torch and pymupdfb deps

* some conflicts fixes

* Add dependencies evaluation group

* add poetry.lock

* Fix unexpected operator

---------

Co-authored-by: Robert Brennan <[email protected]>
  • Loading branch information
dorbanianas and rbren authored Apr 5, 2024
1 parent a0928ae commit 5ec0e5b
Show file tree
Hide file tree
Showing 11 changed files with 6,581 additions and 4,891 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Run Tests

on: [push]

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.11'
- name: Run tests
run: |
make build
poetry run pytest ./tests
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ ipython_config.py
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock
# poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
Expand Down Expand Up @@ -128,6 +128,7 @@ venv/
ENV/
env.bak/
venv.bak/
*venv/

# Spyder project settings
.spyderproject
Expand Down
20 changes: 12 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,19 @@ FRONTEND_PORT = 3001
DEFAULT_WORKSPACE_DIR = "./workspace"
DEFAULT_MODEL = "gpt-4-0125-preview"
CONFIG_FILE = config.toml
PRECOMMIT_CONFIG_PATH = "./dev_config/python/.pre-commit-config.yaml"

# Build
build:
@echo "Building project..."
@echo "Pulling Docker image..."
@docker pull $(DOCKER_IMAGE)
@echo "Installing Python dependencies..."
@python -m pip install pipenv
@python -m pipenv install -v
@curl -sSL https://install.python-poetry.org | python3 -
@poetry install --without evaluation
@echo "Activating Poetry shell..."
@echo "Installing pre-commit hooks..."
@poetry run pre-commit install --config $(PRECOMMIT_CONFIG_PATH)
@echo "Setting up frontend environment..."
@echo "Detect Node.js version..."
@cd frontend && node ./scripts/detect-node-version.js
Expand All @@ -30,7 +34,7 @@ build:
# Start backend
start-backend:
@echo "Starting backend..."
@python -m pipenv run uvicorn opendevin.server.listen:app --port $(BACKEND_PORT)
@poetry run uvicorn opendevin.server.listen:app --port $(BACKEND_PORT)

# Start frontend
start-frontend:
Expand All @@ -40,15 +44,15 @@ start-frontend:
# Run the app
run:
@echo "Running the app..."
@if [ "$(OS)" == "Windows_NT" ]; then \
@if [ "$(OS)" = "Windows_NT" ]; then \
echo "`make run` is not supported on Windows. Please run `make start-frontend` and `make start-backend` separately."; \
exit 1; \
fi
@mkdir -p logs
@rm -f logs/pipe
@mkfifo logs/pipe
@cat logs/pipe | (make start-backend) &
@echo 'test' | tee logs/pipe | (make start-frontend)
@poetry run nohup uvicorn opendevin.server.listen:app --port $(BACKEND_PORT) > logs/backend_$(shell date +'%Y%m%d_%H%M%S').log 2>&1 &
@echo "Waiting for the backend to start..."
@until nc -z localhost $(BACKEND_PORT); do sleep 0.1; done
@cd frontend && npm run start -- --port $(FRONTEND_PORT)

# Setup config.toml
setup-config:
Expand Down
32 changes: 0 additions & 32 deletions Pipfile

This file was deleted.

3,854 changes: 0 additions & 3,854 deletions Pipfile.lock

This file was deleted.

38 changes: 0 additions & 38 deletions Pipfile.torchidx

This file was deleted.

2 changes: 1 addition & 1 deletion dev_config/python/mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ warn_redundant_casts = True
no_implicit_optional = True
strict_optional = True

exclude = agenthub/monologue_agent/regression
exclude = agenthub/monologue_agent/regression
Loading

0 comments on commit 5ec0e5b

Please sign in to comment.