Commit0

October 24, 2024 ยท View on GitHub

Updates

Sep 28, 2024:

If you want to use agent with the OpenAI o1 models, please run these installation commands to update packages pip install git+https://github.com/wenting-zhao/aider.git.


Commit0

Commit0 is a from scratch AI coding challenge. Can you create a library from commit 0?

The benchmark consists of 57 core Python libraries. The challenge is to rebuild these libraries and pass their unit tests. All libraries have:

  • Significant test coverage
  • Detailed specification and documentation
  • Lint and type checking

Commit0 is an interactive environment that makes it easy to design and test new agents. You can:

  • Efficiently run tests in isolated environments
  • Distribute testing and development across cloud systems
  • Track and log all changes made throughout.

To install Commit0, run:

pip install commit0

Commit0 provides several commands to facilitate the process of cloning, building, testing, and evaluating repositories. Here's an overview of the available commands:

Setup

Use commit0 setup [OPTIONS] REPO_SPLIT to clone a repository split. Available options include:

ArgumentTypeDescriptionDefault
repo_splitstrSplit of repositories to clone
--dataset-namestrName of the Huggingface datasetwentingzhao/commit0_combined
--dataset-splitstrSplit of the Huggingface datasettest
--base-dirstrBase directory to clone repos torepos/
--commit0-config-filestrStoring path for stateful commit0 configs.commit0.yaml

Build

Use commit0 build [OPTIONS] to build the Commit0 split chosen in the Setup stage. Available options include:

ArgumentTypeDescriptionDefault
--num-workersintNumber of workers8
--commit0-config-filestrPath to the commit0 dot file.commit0.yaml
--verboseintVerbosity level (1 or 2)1

Get Tests

Use commit0 get-tests REPO_NAME to get tests for a Commit0 repository.

ArgumentTypeDescriptionDefault
repo_namestrName of the repository to get tests for

Test

Use commit0 test [OPTIONS] REPO_OR_REPO_PATH [TEST_IDS] to run tests on a Commit0 repository. Available options include:

ArgumentTypeDescriptionDefault
repo_or_repo_pathstrDirectory of the repository to test
test_idsstrTest IDs to run
--branchstrBranch to test
--backendstrBackend to use for testingmodal
--timeoutintTimeout for tests in seconds1800
--num-cpusintNumber of CPUs to use1
--referenceboolTest the reference commitFalse
--coverageboolGet coverage informationFalse
--rebuildboolRebuild an imageFalse
--commit0-config-filestrPath to the commit0 dot file.commit0.yaml
--verboseintVerbosity level (1 or 2)1
--stdinboolRead test names from stdinFalse

Evaluate

Use commit0 evaluate [OPTIONS] to evaluate the Commit0 split chosen in the Setup stage. Available options include:

ArgumentTypeDescriptionDefault
--branchstrBranch to evaluate
--backendstrBackend to use for evaluationmodal
--timeoutintTimeout for evaluation in seconds1800
--num-cpusintNumber of CPUs to use1
--num-workersintNumber of workers to use8
--referenceboolEvaluate the reference commitFalse
--coverageboolGet coverage informationFalse
--commit0-config-filestrPath to the commit0 dot file.commit0.yaml
--rebuildboolRebuild imagesFalse

Lint

Use commit0 lint [OPTIONS] REPO_OR_REPO_DIR to lint files in a repository. Available options include:

ArgumentTypeDescriptionDefault
repo_or_repo_dirstrDirectory of the repository to test
--filesList[Path]Files to lint (optional)
--commit0-config-filestrPath to the commit0 dot file.commit0.yaml
--verboseintVerbosity level (1 or 2)1

Save

Use commit0 save [OPTIONS] OWNER BRANCH to save the Commit0 split to GitHub. Available options include:

ArgumentTypeDescriptionDefault
ownerstrOwner of the repository
branchstrBranch to save
--github-tokenstrGitHub token for authentication
--commit0-config-filestrPath to the commit0 dot file.commit0.yaml

Agent

Config

Use agent config [OPTIONS] AGENT_NAME to set up the configuration for an agent. Available options include:

ArgumentTypeDescriptionDefault
agent_namestrAgent to use, we only support aider for now.aider
--model-namestrLLM model to use, check here for all supported models.claude-3-5-sonnet-20240620
--use-user-promptboolUse a custom prompt instead of the default prompt.False
--user-promptstrThe prompt sent to agent.See code for details.
--run-testsboolRun tests after code modifications for feedback. You need to set up docker or modal before running tests, refer to commit0 docs.False
--max-iterationintMaximum number of agent iterations.3
--use-repo-infoboolInclude the repository information.False
--max-repo-info-lengthintMaximum length of the repository information to use.10000
--use-unit-tests-infoboolInclude the unit tests information.False
--max-unit-tests-info-lengthintMaximum length of the unit tests information to use.10000
--use-spec-infoboolInclude the spec information.False
--max-spec-info-lengthintMaximum length of the spec information to use.10000
--use-lint-infoboolInclude the lint information.False
--max-lint-info-lengthintMaximum length of the lint information to use.10000
--pre-commit-config-pathstrPath to the pre-commit config file. This is needed for running lint..pre-commit-config.yaml
--agent-config-filestrPath to write the agent config..agent.yaml

Running

Use agent run [OPTIONS] BRANCH to execute an agent on a specific branch. Available options include:

ArgumentTypeDescriptionDefault
branchstrBranch to run the agent on, you can specific the name of the branch
--backendstrTest backend to run the agent on, ignore this option if you are not adding run_tests option to agent.modal
--log-dirstrLog directory to store the logs.logs/aider
--max-parallel-reposintMaximum number of repositories for agent to run in parallel. Running in sequential if set to 1.1
--display-repo-progress-numintNumber of repo progress displayed when running.5