From 67f2e6f3af6b396c957cf875f07ad8fd1bad1794 Mon Sep 17 00:00:00 2001 From: Xingyao Wang Date: Thu, 21 Nov 2024 11:02:52 +0800 Subject: [PATCH 01/10] Update pyproject.toml - relax modal dep --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 8aa376d..46ff645 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", From c91270b7f4946190dc5fec6ddece2ca0b179db44 Mon Sep 17 00:00:00 2001 From: Xingyao Wang Date: Wed, 20 Nov 2024 22:05:32 -0500 Subject: [PATCH 02/10] update uv lock --- uv.lock | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/uv.lock b/uv.lock index c2c4ed2..58ccfc1 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,7 @@ dependencies = [ { name = "fastcore" }, { name = "ghapi" }, { name = "gitpython" }, + { name = "import-deps" }, { name = "modal" }, { name = "pre-commit" }, { name = "pymupdf" }, @@ -393,7 +394,8 @@ requires-dist = [ { name = "fastcore", specifier = ">=1.7.8" }, { name = "ghapi", specifier = ">=1.0.6" }, { name = "gitpython", specifier = ">=3.1.43" }, - { name = "modal", specifier = "==0.64.95" }, + { name = "import-deps", specifier = ">=0.3.0" }, + { name = "modal", specifier = ">=0.64.95" }, { name = "pre-commit", specifier = ">=3.8.0" }, { name = "pymupdf", specifier = ">=1.24.5" }, { name = "pytest", specifier = ">=8.3.3" }, @@ -762,6 +764,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 +1051,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 +1297,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 }, From d2e8514202f982d3607feb6852a17a3759c76698 Mon Sep 17 00:00:00 2001 From: openhands Date: Thu, 21 Nov 2024 03:29:42 +0000 Subject: [PATCH 03/10] Make agent dependencies optional --- pyproject.toml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 46ff645..6245e44 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,7 +22,6 @@ dependencies = [ "gitpython>=3.1.43", "pytest>=8.3.3", "datasets==3.0.1", - "aider-chat", ] classifiers = [ "License :: OSI Approved :: MIT License", @@ -36,7 +35,10 @@ agent = "agent.__main__:main" packages = ["commit0", "agent"] [project.optional-dependencies] -agent = [] +agent = [ + "aider-chat", +] +core = [] [project.urls] Homepage = "https://commit-0.github.io/" From a668f894fb5c4c1c095e0c0ee6c90606a8ee79d1 Mon Sep 17 00:00:00 2001 From: openhands Date: Thu, 21 Nov 2024 03:31:31 +0000 Subject: [PATCH 04/10] Update dependencies: make core exclude agent --- pyproject.toml | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 6245e44..8c60523 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,6 +22,7 @@ dependencies = [ "gitpython>=3.1.43", "pytest>=8.3.3", "datasets==3.0.1", + "aider-chat", ] classifiers = [ "License :: OSI Approved :: MIT License", @@ -35,10 +36,21 @@ agent = "agent.__main__:main" packages = ["commit0", "agent"] [project.optional-dependencies] -agent = [ - "aider-chat", +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", ] -core = [] [project.urls] Homepage = "https://commit-0.github.io/" From 2d2067796fdbba16577a6b0cbdf518bbcb4868c2 Mon Sep 17 00:00:00 2001 From: openhands Date: Thu, 21 Nov 2024 03:33:50 +0000 Subject: [PATCH 05/10] Make agent package optional based on installation type --- build.py | 10 ++++++++++ commit0/optional/__init__.py | 1 + {agent => commit0/optional/agent}/README.md | 0 {agent => commit0/optional/agent}/__main__.py | 0 {agent => commit0/optional/agent}/agent_utils.py | 0 {agent => commit0/optional/agent}/agents.py | 0 {agent => commit0/optional/agent}/class_types.py | 0 {agent => commit0/optional/agent}/cli.py | 0 {agent => commit0/optional/agent}/configs/agent.yaml | 0 {agent => commit0/optional/agent}/configs/base.yaml | 0 {agent => commit0/optional/agent}/display.py | 0 {agent => commit0/optional/agent}/run_agent.py | 0 {agent => commit0/optional/agent}/run_agent_no_rich.py | 0 pyproject.toml | 7 +++++-- 14 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 build.py create mode 100644 commit0/optional/__init__.py rename {agent => commit0/optional/agent}/README.md (100%) rename {agent => commit0/optional/agent}/__main__.py (100%) rename {agent => commit0/optional/agent}/agent_utils.py (100%) rename {agent => commit0/optional/agent}/agents.py (100%) rename {agent => commit0/optional/agent}/class_types.py (100%) rename {agent => commit0/optional/agent}/cli.py (100%) rename {agent => commit0/optional/agent}/configs/agent.yaml (100%) rename {agent => commit0/optional/agent}/configs/base.yaml (100%) rename {agent => commit0/optional/agent}/display.py (100%) rename {agent => commit0/optional/agent}/run_agent.py (100%) rename {agent => commit0/optional/agent}/run_agent_no_rich.py (100%) diff --git a/build.py b/build.py new file mode 100644 index 0000000..fbecc40 --- /dev/null +++ b/build.py @@ -0,0 +1,10 @@ +from hatchling.builders.hooks.plugin.interface import BuildHookInterface + +class CustomBuildHook(BuildHookInterface): + def initialize(self, version, build_data): + """Add agent package if not installing core-only.""" + target = build_data['wheel']['targets'][0] + extras = target.get('options', {}).get('extras', []) + + if 'core' not in extras: + target['packages'].append('commit0.optional.agent') \ No newline at end of file diff --git a/commit0/optional/__init__.py b/commit0/optional/__init__.py new file mode 100644 index 0000000..110464e --- /dev/null +++ b/commit0/optional/__init__.py @@ -0,0 +1 @@ +"""Optional packages for commit0.""" \ No newline at end of file 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 100% rename from agent/__main__.py rename to commit0/optional/agent/__main__.py diff --git a/agent/agent_utils.py b/commit0/optional/agent/agent_utils.py similarity index 100% rename from agent/agent_utils.py rename to commit0/optional/agent/agent_utils.py 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 100% rename from agent/cli.py rename to commit0/optional/agent/cli.py 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 100% rename from agent/run_agent.py rename to commit0/optional/agent/run_agent.py diff --git a/agent/run_agent_no_rich.py b/commit0/optional/agent/run_agent_no_rich.py similarity index 100% rename from agent/run_agent_no_rich.py rename to commit0/optional/agent/run_agent_no_rich.py diff --git a/pyproject.toml b/pyproject.toml index 8c60523..c39affe 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,10 +30,13 @@ classifiers = [ [project.scripts] commit0 = "commit0.__main__:main" -agent = "agent.__main__:main" +agent = "commit0.optional.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] core = [ From 382d385c16e857409b82417a7ff092547ace88b6 Mon Sep 17 00:00:00 2001 From: openhands Date: Thu, 21 Nov 2024 03:39:48 +0000 Subject: [PATCH 06/10] Fix build hook to handle missing wheel data --- build.py | 15 ++++++++++----- commit0/commit0 | 1 + 2 files changed, 11 insertions(+), 5 deletions(-) create mode 160000 commit0/commit0 diff --git a/build.py b/build.py index fbecc40..61cfa61 100644 --- a/build.py +++ b/build.py @@ -3,8 +3,13 @@ class CustomBuildHook(BuildHookInterface): def initialize(self, version, build_data): """Add agent package if not installing core-only.""" - target = build_data['wheel']['targets'][0] - extras = target.get('options', {}).get('extras', []) - - if 'core' not in extras: - target['packages'].append('commit0.optional.agent') \ No newline at end of file + if 'wheel' not in build_data: + return + + for target in build_data.get('wheel', {}).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 \ No newline at end of file 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 From 623a068f700356b07dcd89a4059a65e7eaa8d991 Mon Sep 17 00:00:00 2001 From: openhands Date: Thu, 21 Nov 2024 03:40:45 +0000 Subject: [PATCH 07/10] Fix build hook to handle editable installs --- build.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/build.py b/build.py index 61cfa61..613c12e 100644 --- a/build.py +++ b/build.py @@ -3,13 +3,15 @@ class CustomBuildHook(BuildHookInterface): def initialize(self, version, build_data): """Add agent package if not installing core-only.""" - if 'wheel' not in build_data: - return + # 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.get('wheel', {}).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 \ No newline at end of file + 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 \ No newline at end of file From f66f03b13eccba76f1e8fc6c6431313f1bb80c73 Mon Sep 17 00:00:00 2001 From: openhands Date: Thu, 21 Nov 2024 03:42:15 +0000 Subject: [PATCH 08/10] Update CI to test both full and core installations --- .github/workflows/system.yml | 43 +++++++++++++++++++++++++++++++++--- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/.github/workflows/system.yml b/.github/workflows/system.yml index 6cf32af..fa404b7 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-core setup simpy + - name: Build docker images + run: uv run commit0-core build + - name: Get tests + run: uv run commit0-core get-tests simpy + - name: Test + env: + MODAL_TOKEN_ID: ${{secrets.MODAL_TOKEN_ID}} + MODAL_TOKEN_SECRET: ${{secrets.MODAL_TOKEN_SECRET}} + run: | + uv run commit0-core test simpy tests/test_event.py::test_succeed --reference --rebuild + uv run commit0-core 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-core evaluate --reference --rebuild + uv run commit0-core evaluate --reference + - name: Lint + run: uv run commit0-core lint commit0/harness/ From 524b17a38b31f78dff5067ecbb40c12c294244b7 Mon Sep 17 00:00:00 2001 From: openhands Date: Thu, 21 Nov 2024 03:48:06 +0000 Subject: [PATCH 09/10] Fix core installation to use commit0[core] instead of commit0-core --- .github/workflows/system.yml | 16 ++++++++-------- pyproject.toml | 1 - 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/.github/workflows/system.yml b/.github/workflows/system.yml index fa404b7..9e76a52 100644 --- a/.github/workflows/system.yml +++ b/.github/workflows/system.yml @@ -61,24 +61,24 @@ jobs: - name: Install the project (core) run: uv pip install -e .[core] - name: Set up commit0 - run: uv run commit0-core setup simpy + run: uv run commit0 setup simpy - name: Build docker images - run: uv run commit0-core build + run: uv run commit0 build - name: Get tests - run: uv run commit0-core get-tests simpy + 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-core test simpy tests/test_event.py::test_succeed --reference --rebuild - uv run commit0-core test simpy tests/test_event.py::test_succeed --reference + 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-core evaluate --reference --rebuild - uv run commit0-core evaluate --reference + uv run commit0 evaluate --reference --rebuild + uv run commit0 evaluate --reference - name: Lint - run: uv run commit0-core lint commit0/harness/ + run: uv run commit0 lint commit0/harness/ diff --git a/pyproject.toml b/pyproject.toml index c39affe..8f4f38d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,7 +30,6 @@ classifiers = [ [project.scripts] commit0 = "commit0.__main__:main" -agent = "commit0.optional.agent.__main__:main" [tool.hatch.build.targets.wheel] packages = ["commit0"] From 1dc469408c9a3787def60869a873475e6e9ef118 Mon Sep 17 00:00:00 2001 From: openhands Date: Thu, 21 Nov 2024 03:51:52 +0000 Subject: [PATCH 10/10] Fix imports to use commit0.optional.agent --- build.py | 19 ++++++------- commit0/optional/__init__.py | 2 +- commit0/optional/agent/__main__.py | 2 +- commit0/optional/agent/agent_utils.py | 2 +- commit0/optional/agent/cli.py | 6 ++--- commit0/optional/agent/run_agent.py | 8 +++--- commit0/optional/agent/run_agent_no_rich.py | 8 +++--- uv.lock | 30 +++++++++++++++++++++ 8 files changed, 54 insertions(+), 23 deletions(-) diff --git a/build.py b/build.py index 613c12e..95dcd2d 100644 --- a/build.py +++ b/build.py @@ -1,17 +1,18 @@ from hatchling.builders.hooks.plugin.interface import BuildHookInterface + class CustomBuildHook(BuildHookInterface): - def initialize(self, version, build_data): + 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']: + 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 \ No newline at end of file + 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/optional/__init__.py b/commit0/optional/__init__.py index 110464e..8ab3a79 100644 --- a/commit0/optional/__init__.py +++ b/commit0/optional/__init__.py @@ -1 +1 @@ -"""Optional packages for commit0.""" \ No newline at end of file +"""Optional packages for commit0.""" diff --git a/commit0/optional/agent/__main__.py b/commit0/optional/agent/__main__.py index e2bc954..99522f8 100644 --- a/commit0/optional/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/commit0/optional/agent/agent_utils.py b/commit0/optional/agent/agent_utils.py index 4fdea82..b123cf0 100644 --- a/commit0/optional/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/commit0/optional/agent/cli.py b/commit0/optional/agent/cli.py index b02bf7a..229b3e8 100644 --- a/commit0/optional/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/commit0/optional/agent/run_agent.py b/commit0/optional/agent/run_agent.py index a1324cd..73d20cf 100644 --- a/commit0/optional/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/commit0/optional/agent/run_agent_no_rich.py b/commit0/optional/agent/run_agent_no_rich.py index 5822063..f0a7753 100644 --- a/commit0/optional/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/uv.lock b/uv.lock index 58ccfc1..ad8fa07 100644 --- a/uv.lock +++ b/uv.lock @@ -386,22 +386,52 @@ dependencies = [ { 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" }, + { name = "pytest" }, + { name = "ruff" }, + { name = "tenacity" }, + { name = "typer" }, +] + [package.metadata] 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 = "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]]