diff --git a/.github/workflows/system.yml b/.github/workflows/system.yml index 6cf32af..9e76a52 100644 --- a/.github/workflows/system.yml +++ b/.github/workflows/system.yml @@ -6,7 +6,8 @@ on: branches: [main] jobs: - system: + system-full: + name: Test Full Installation runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -16,8 +17,8 @@ jobs: run: uv venv --python 3.12 - name: Set up Docker uses: docker/setup-buildx-action@v3 - - name: Install the project - run: uv sync + - name: Install the project (full) + run: uv pip install -e . - name: Set up commit0 run: uv run commit0 setup simpy - name: Build docker images @@ -45,3 +46,39 @@ jobs: GITHUB_TOKEN: ${{ secrets.MY_GITHUB_TOKEN }} run: | uv run commit0 save test-save-commit0 master + + system-core: + name: Test Core Installation + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Install uv + uses: astral-sh/setup-uv@v2 + - name: Set up Python + run: uv venv --python 3.12 + - name: Set up Docker + uses: docker/setup-buildx-action@v3 + - name: Install the project (core) + run: uv pip install -e .[core] + - name: Set up commit0 + run: uv run commit0 setup simpy + - name: Build docker images + run: uv run commit0 build + - name: Get tests + run: uv run commit0 get-tests simpy + - name: Test + env: + MODAL_TOKEN_ID: ${{secrets.MODAL_TOKEN_ID}} + MODAL_TOKEN_SECRET: ${{secrets.MODAL_TOKEN_SECRET}} + run: | + uv run commit0 test simpy tests/test_event.py::test_succeed --reference --rebuild + uv run commit0 test simpy tests/test_event.py::test_succeed --reference + - name: Evaluate + env: + MODAL_TOKEN_ID: ${{secrets.MODAL_TOKEN_ID}} + MODAL_TOKEN_SECRET: ${{secrets.MODAL_TOKEN_SECRET}} + run: | + uv run commit0 evaluate --reference --rebuild + uv run commit0 evaluate --reference + - name: Lint + run: uv run commit0 lint commit0/harness/ diff --git a/build.py b/build.py new file mode 100644 index 0000000..95dcd2d --- /dev/null +++ b/build.py @@ -0,0 +1,18 @@ +from hatchling.builders.hooks.plugin.interface import BuildHookInterface + + +class CustomBuildHook(BuildHookInterface): + def initialize(self, version: str, build_data: dict) -> None: + """Add agent package if not installing core-only.""" + # Handle both wheel and editable builds + for build_type in ["wheel", "editable"]: + if build_type not in build_data: + continue + + for target in build_data[build_type].get("targets", []): + extras = target.get("options", {}).get("extras", []) + packages = target.get("packages", []) + + if "core" not in extras and "commit0.optional.agent" not in packages: + packages.append("commit0.optional.agent") + target["packages"] = packages diff --git a/commit0/commit0 b/commit0/commit0 new file mode 160000 index 0000000..a853f81 --- /dev/null +++ b/commit0/commit0 @@ -0,0 +1 @@ +Subproject commit a853f8168dc8187eebbd788c8fc4a4137644f74b diff --git a/commit0/optional/__init__.py b/commit0/optional/__init__.py new file mode 100644 index 0000000..8ab3a79 --- /dev/null +++ b/commit0/optional/__init__.py @@ -0,0 +1 @@ +"""Optional packages for commit0.""" diff --git a/agent/README.md b/commit0/optional/agent/README.md similarity index 100% rename from agent/README.md rename to commit0/optional/agent/README.md diff --git a/agent/__main__.py b/commit0/optional/agent/__main__.py similarity index 70% rename from agent/__main__.py rename to commit0/optional/agent/__main__.py index e2bc954..99522f8 100644 --- a/agent/__main__.py +++ b/commit0/optional/agent/__main__.py @@ -1,4 +1,4 @@ -from agent.cli import agent_app +from commit0.optional.agent.cli import agent_app def main() -> None: diff --git a/agent/agent_utils.py b/commit0/optional/agent/agent_utils.py similarity index 99% rename from agent/agent_utils.py rename to commit0/optional/agent/agent_utils.py index 4fdea82..b123cf0 100644 --- a/agent/agent_utils.py +++ b/commit0/optional/agent/agent_utils.py @@ -10,7 +10,7 @@ from graphlib import TopologicalSorter, CycleError import yaml -from agent.class_types import AgentConfig +from commit0.optional.agent.class_types import AgentConfig PROMPT_HEADER = ">>> Here is the Task:\n" REFERENCE_HEADER = "\n\n>>> Here is the Reference for you to finish the task:\n" diff --git a/agent/agents.py b/commit0/optional/agent/agents.py similarity index 100% rename from agent/agents.py rename to commit0/optional/agent/agents.py diff --git a/agent/class_types.py b/commit0/optional/agent/class_types.py similarity index 100% rename from agent/class_types.py rename to commit0/optional/agent/class_types.py diff --git a/agent/cli.py b/commit0/optional/agent/cli.py similarity index 97% rename from agent/cli.py rename to commit0/optional/agent/cli.py index b02bf7a..229b3e8 100644 --- a/agent/cli.py +++ b/commit0/optional/agent/cli.py @@ -1,9 +1,9 @@ import typer -from agent.run_agent_no_rich import run_agent as run_agent_no_rich -from agent.run_agent import run_agent +from commit0.optional.agent.run_agent_no_rich import run_agent as run_agent_no_rich +from commit0.optional.agent.run_agent import run_agent from commit0.harness.constants import RUN_AGENT_LOG_DIR import subprocess -from agent.agent_utils import write_agent_config +from commit0.optional.agent.agent_utils import write_agent_config agent_app = typer.Typer( no_args_is_help=True, diff --git a/agent/configs/agent.yaml b/commit0/optional/agent/configs/agent.yaml similarity index 100% rename from agent/configs/agent.yaml rename to commit0/optional/agent/configs/agent.yaml diff --git a/agent/configs/base.yaml b/commit0/optional/agent/configs/base.yaml similarity index 100% rename from agent/configs/base.yaml rename to commit0/optional/agent/configs/base.yaml diff --git a/agent/display.py b/commit0/optional/agent/display.py similarity index 100% rename from agent/display.py rename to commit0/optional/agent/display.py diff --git a/agent/run_agent.py b/commit0/optional/agent/run_agent.py similarity index 98% rename from agent/run_agent.py rename to commit0/optional/agent/run_agent.py index a1324cd..73d20cf 100644 --- a/agent/run_agent.py +++ b/commit0/optional/agent/run_agent.py @@ -3,7 +3,7 @@ import multiprocessing from datasets import load_dataset from git import Repo -from agent.agent_utils import ( +from commit0.optional.agent.agent_utils import ( create_branch, get_message, get_target_edit_files, @@ -14,17 +14,17 @@ ) import json import subprocess -from agent.agents import AiderAgents +from commit0.optional.agent.agents import AiderAgents from typing import Optional, Type, cast from types import TracebackType -from agent.class_types import AgentConfig +from commit0.optional.agent.class_types import AgentConfig from commit0.harness.constants import SPLIT from commit0.harness.get_pytest_ids import main as get_tests from commit0.harness.constants import RUN_AGENT_LOG_DIR, RepoInstance from commit0.cli import read_commit0_config_file from pathlib import Path from datetime import datetime -from agent.display import TerminalDisplay +from commit0.optional.agent.display import TerminalDisplay import queue import time diff --git a/agent/run_agent_no_rich.py b/commit0/optional/agent/run_agent_no_rich.py similarity index 97% rename from agent/run_agent_no_rich.py rename to commit0/optional/agent/run_agent_no_rich.py index 5822063..f0a7753 100644 --- a/agent/run_agent_no_rich.py +++ b/commit0/optional/agent/run_agent_no_rich.py @@ -4,7 +4,7 @@ from tqdm import tqdm from datasets import load_dataset from git import Repo -from agent.agent_utils import ( +from commit0.optional.agent.agent_utils import ( create_branch, get_message, get_target_edit_files, @@ -15,16 +15,16 @@ ) import subprocess import json -from agent.agents import AiderAgents +from commit0.optional.agent.agents import AiderAgents from typing import cast -from agent.class_types import AgentConfig +from commit0.optional.agent.class_types import AgentConfig from commit0.harness.constants import SPLIT from commit0.harness.get_pytest_ids import main as get_tests from commit0.harness.constants import RUN_AGENT_LOG_DIR, RepoInstance from commit0.cli import read_commit0_config_file from pathlib import Path from datetime import datetime -from agent.run_agent import DirContext, run_eval_after_each_commit +from commit0.optional.agent.run_agent import DirContext, run_eval_after_each_commit def run_agent_for_repo( diff --git a/pyproject.toml b/pyproject.toml index 8aa376d..8f4f38d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,7 +13,7 @@ dependencies = [ "pre-commit>=3.8.0", "import-deps>=0.3.0", "PyMuPDF>=1.24.5", - "modal==0.64.95", + "modal>=0.64.95", "typer>=0.12.0", "tenacity>=8.5.0", "docker>=7.1.0", @@ -30,13 +30,29 @@ classifiers = [ [project.scripts] commit0 = "commit0.__main__:main" -agent = "agent.__main__:main" [tool.hatch.build.targets.wheel] -packages = ["commit0", "agent"] +packages = ["commit0"] + +[tool.hatch.build.targets.wheel.hooks.custom] +path = "build.py" [project.optional-dependencies] -agent = [] +core = [ + "ruff>=0.6.4", + "pre-commit>=3.8.0", + "import-deps>=0.3.0", + "PyMuPDF>=1.24.5", + "modal>=0.64.95", + "typer>=0.12.0", + "tenacity>=8.5.0", + "docker>=7.1.0", + "fastcore>=1.7.8", + "ghapi>=1.0.6", + "gitpython>=3.1.43", + "pytest>=8.3.3", + "datasets==3.0.1", +] [project.urls] Homepage = "https://commit-0.github.io/" diff --git a/uv.lock b/uv.lock index c2c4ed2..ad8fa07 100644 --- a/uv.lock +++ b/uv.lock @@ -367,7 +367,7 @@ wheels = [ [[package]] name = "commit0" -version = "0.1.4" +version = "0.1.6" source = { editable = "." } dependencies = [ { name = "aider-chat" }, @@ -376,6 +376,24 @@ dependencies = [ { name = "fastcore" }, { name = "ghapi" }, { name = "gitpython" }, + { name = "import-deps" }, + { name = "modal" }, + { name = "pre-commit" }, + { name = "pymupdf" }, + { name = "pytest" }, + { name = "ruff" }, + { name = "tenacity" }, + { name = "typer" }, +] + +[package.optional-dependencies] +core = [ + { name = "datasets" }, + { name = "docker" }, + { name = "fastcore" }, + { name = "ghapi" }, + { name = "gitpython" }, + { name = "import-deps" }, { name = "modal" }, { name = "pre-commit" }, { name = "pymupdf" }, @@ -389,17 +407,31 @@ dependencies = [ requires-dist = [ { name = "aider-chat", git = "https://github.com/wenting-zhao/aider.git" }, { name = "datasets", specifier = "==3.0.1" }, + { name = "datasets", marker = "extra == 'core'", specifier = "==3.0.1" }, { name = "docker", specifier = ">=7.1.0" }, + { name = "docker", marker = "extra == 'core'", specifier = ">=7.1.0" }, { name = "fastcore", specifier = ">=1.7.8" }, + { name = "fastcore", marker = "extra == 'core'", specifier = ">=1.7.8" }, { name = "ghapi", specifier = ">=1.0.6" }, + { name = "ghapi", marker = "extra == 'core'", specifier = ">=1.0.6" }, { name = "gitpython", specifier = ">=3.1.43" }, - { name = "modal", specifier = "==0.64.95" }, + { name = "gitpython", marker = "extra == 'core'", specifier = ">=3.1.43" }, + { name = "import-deps", specifier = ">=0.3.0" }, + { name = "import-deps", marker = "extra == 'core'", specifier = ">=0.3.0" }, + { name = "modal", specifier = ">=0.64.95" }, + { name = "modal", marker = "extra == 'core'", specifier = ">=0.64.95" }, { name = "pre-commit", specifier = ">=3.8.0" }, + { name = "pre-commit", marker = "extra == 'core'", specifier = ">=3.8.0" }, { name = "pymupdf", specifier = ">=1.24.5" }, + { name = "pymupdf", marker = "extra == 'core'", specifier = ">=1.24.5" }, { name = "pytest", specifier = ">=8.3.3" }, + { name = "pytest", marker = "extra == 'core'", specifier = ">=8.3.3" }, { name = "ruff", specifier = ">=0.6.4" }, + { name = "ruff", marker = "extra == 'core'", specifier = ">=0.6.4" }, { name = "tenacity", specifier = ">=8.5.0" }, + { name = "tenacity", marker = "extra == 'core'", specifier = ">=8.5.0" }, { name = "typer", specifier = ">=0.12.0" }, + { name = "typer", marker = "extra == 'core'", specifier = ">=0.12.0" }, ] [[package]] @@ -762,6 +794,15 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/76/c6/c88e154df9c4e1a2a66ccf0005a88dfb2650c1dffb6f5ce603dfbd452ce3/idna-3.10-py3-none-any.whl", hash = "sha256:946d195a0d259cbba61165e88e65941f16e9b36ea6ddb97f00452bae8b1287d3", size = 70442 }, ] +[[package]] +name = "import-deps" +version = "0.3.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/21/0c/487690243f9d792c7d1cfdcbc971e21b901140c367729ae83e17d08242ae/import_deps-0.3.0.tar.gz", hash = "sha256:542544c69a435517dc8e556d0030044f49f2e61fff11ab8c2c612ac56ff62705", size = 6624 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/02/ea/8461a8fc157df724d56c7f0cce8d86af130bcb5e99622af2d3e6ceeca74f/import_deps-0.3.0-py3-none-any.whl", hash = "sha256:4619659d57b8d5426177de7b98748a04446dc756c18544d8d75afda33bb0b008", size = 7604 }, +] + [[package]] name = "importlib-metadata" version = "7.2.1" @@ -1040,7 +1081,11 @@ dependencies = [ ] sdist = { url = "https://files.pythonhosted.org/packages/68/e0/a77ca96e772e13c828fa52f3ad370d413bef194aeaf78b7c6611870ad815/multiprocess-0.70.15.tar.gz", hash = "sha256:f20eed3036c0ef477b07a4177cf7c1ba520d9a2677870a4f47fe026f0cd6787e", size = 1894495 } wheels = [ + { url = "https://files.pythonhosted.org/packages/35/a8/36d8d7b3e46b377800d8dec47891cdf05842d1a2366909ae4a0c89fbc5e6/multiprocess-0.70.15-py310-none-any.whl", hash = "sha256:7dd58e33235e83cf09d625e55cffd7b0f0eede7ee9223cdd666a87624f60c21a", size = 134824 }, { url = "https://files.pythonhosted.org/packages/e7/41/96ac938770ba6e7d5ae1d8c9cafebac54b413549042c6260f0d0a6ec6622/multiprocess-0.70.15-py311-none-any.whl", hash = "sha256:134f89053d82c9ed3b73edd3a2531eb791e602d4f4156fc92a79259590bd9670", size = 135392 }, + { url = "https://files.pythonhosted.org/packages/ca/3f/8354ce12fd13bd5c5bb4722261a10ca1d6e2eb7c1c08fa3d8a4e9dc98f44/multiprocess-0.70.15-py37-none-any.whl", hash = "sha256:f7d4a1629bccb433114c3b4885f69eccc200994323c80f6feee73b0edc9199c5", size = 116276 }, + { url = "https://files.pythonhosted.org/packages/c2/a6/c5cb599d917904878f220a4dbdfdcc4ef291dd3956c35b3b0dc6fc42fb6d/multiprocess-0.70.15-py38-none-any.whl", hash = "sha256:bee9afba476c91f9ebee7beeee0601face9eff67d822e893f9a893725fbd6316", size = 132626 }, + { url = "https://files.pythonhosted.org/packages/c6/c9/820b5ab056f4ada76fbe05bd481a948f287957d6cbfd59e2dd2618b408c1/multiprocess-0.70.15-py39-none-any.whl", hash = "sha256:3e0953f5d52b4c76f1c973eaf8214554d146f2be5decb48e928e55c7a2d19338", size = 133349 }, ] [[package]] @@ -1282,8 +1327,6 @@ version = "6.0.0" source = { registry = "https://pypi.org/simple" } sdist = { url = "https://files.pythonhosted.org/packages/18/c7/8c6872f7372eb6a6b2e4708b88419fb46b857f7a2e1892966b851cc79fc9/psutil-6.0.0.tar.gz", hash = "sha256:8faae4f310b6d969fa26ca0545338b21f73c6b15db7c4a8d934a5482faa818f2", size = 508067 } wheels = [ - { url = "https://files.pythonhosted.org/packages/c5/66/78c9c3020f573c58101dc43a44f6855d01bbbd747e24da2f0c4491200ea3/psutil-6.0.0-cp27-none-win32.whl", hash = "sha256:02b69001f44cc73c1c5279d02b30a817e339ceb258ad75997325e0e6169d8b35", size = 249766 }, - { url = "https://files.pythonhosted.org/packages/e1/3f/2403aa9558bea4d3854b0e5e567bc3dd8e9fbc1fc4453c0aa9aafeb75467/psutil-6.0.0-cp27-none-win_amd64.whl", hash = "sha256:21f1fb635deccd510f69f485b87433460a603919b45e2a324ad65b0cc74f8fb1", size = 253024 }, { url = "https://files.pythonhosted.org/packages/0b/37/f8da2fbd29690b3557cca414c1949f92162981920699cd62095a984983bf/psutil-6.0.0-cp36-abi3-macosx_10_9_x86_64.whl", hash = "sha256:c588a7e9b1173b6e866756dde596fd4cad94f9399daf99ad8c3258b3cb2b47a0", size = 250961 }, { url = "https://files.pythonhosted.org/packages/35/56/72f86175e81c656a01c4401cd3b1c923f891b31fbcebe98985894176d7c9/psutil-6.0.0-cp36-abi3-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:6ed2440ada7ef7d0d608f20ad89a04ec47d2d3ab7190896cd62ca5fc4fe08bf0", size = 287478 }, { url = "https://files.pythonhosted.org/packages/19/74/f59e7e0d392bc1070e9a70e2f9190d652487ac115bb16e2eff6b22ad1d24/psutil-6.0.0-cp36-abi3-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5fd9a97c8e94059b0ef54a7d4baf13b405011176c3b6ff257c247cae0d560ecd", size = 290455 },