Skip to content

Latest commit

 

History

History
120 lines (86 loc) · 5.96 KB

CONTRIBUTING.md

File metadata and controls

120 lines (86 loc) · 5.96 KB

Contributing to GPT-engineer

GPT-engineer is a community project and lives from your contributions - they are warmly appreciated. The main contribution avenues are:

  • Bug report: report when something in GPT-engineer doesn't work. Do not report errors in programs written by GPT-engineer.
  • Feature request: provide a detailed sketch about something you want to have implemented in GPT-engineer. There is no guarantee that features will be implemented.
  • Discussion: raise awareness of a potential improvement. This is often a good starting point before making a detailed feature request.
  • Pull request: implement code and have it reviewed and potentially merged by the maintainers. Implementations of existing feature requests or fixes to bug reports are likely to be merged.

By participating in this project, you agree to abide by the code of conduct.

Merge Policy for Pull Requests

Code that is likely to introduce breaking changes, or significantly change the user experience for users and developers, require board approval to be merged. Smaller code changes can be merged directly. As a rule, cosmetic pull requests, for example rephrasing the readme or introducing more compact syntax, that do not yield clear practical improvements are not merged. Such pull requests are generally discouraged, both to save time for the maintainers and to establish a lower bar for becoming a contributor.

Getting Started with Pull Requests to GPT-engineer

To get started with contributing, please follow these steps:

  1. Fork the repository and clone it to your local machine.
  2. Install any necessary dependencies.
  3. Create a new branch for your changes: git checkout -b my-branch-name.
  4. Make your desired changes or additions.
  5. Run the tests to ensure everything is working as expected.
  6. Commit your changes: git commit -m "Descriptive commit message".
  7. Push to the branch: git push origin my-branch-name.
  8. Submit a pull request to the main branch of the original repository.

Code Style

Please make sure to follow the established code style guidelines for this project. Consistent code style helps maintain readability and makes it easier for others to contribute to the project.

To enforce this we use pre-commit to run black and ruff on every commit.

To install gpt-engineer as a developer, clone the repository and install the dependencies with:

$ poetry install
$ poetry shell

And then install the pre-commit hooks with:

$ pre-commit install

# output:
pre-commit installed at .git/hooks/pre-commit

If you are not familiar with the concept of git hooks and/or pre-commit please read the documentation to understand how they work.

As an introduction of the actual workflow, here is an example of the process you will encounter when you make a commit:

Let's add a file we have modified with some errors, see how the pre-commit hooks run black and fails. black is set to automatically fix the issues it finds:

$ git add chat_to_files.py
$ git commit -m "commit message"
black....................................................................Failed
- hook id: black
- files were modified by this hook

reformatted chat_to_files.py

All done! ✨ 🍰 ✨
1 file reformatted.

You can see that chat_to_files.py is both staged and not staged for commit. This is because black has formatted it and now it is different from the version you have in your working directory. To fix this you can simply run git add chat_to_files.py again and now you can commit your changes.

$ git status
On branch pre-commit-setup
Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
    modified:   chat_to_files.py

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
    modified:   chat_to_files.py

Now let's add the file again to include the latest commits and see how ruff fails.

$ git add chat_to_files.py
$ git commit -m "commit message"
black....................................................................Passed
ruff.....................................................................Failed
- hook id: ruff
- exit code: 1
- files were modified by this hook

Found 2 errors (2 fixed, 0 remaining).

Same as before, you can see that chat_to_files.py is both staged and not staged for commit. This is because ruff has formatted it and now it is different from the version you have in your working directory. To fix this you can simply run git add chat_to_files.py again and now you can commit your changes.

$ git add chat_to_files.py
$ git commit -m "commit message"
black....................................................................Passed
ruff.....................................................................Passed
fix end of files.........................................................Passed
[pre-commit-setup f00c0ce] testing
 1 file changed, 1 insertion(+), 1 deletion(-)

Now your file has been committed and you can push your changes.

At the beginning this might seem like a tedious process (having to add the file again after black and ruff have modified it) but it is actually very useful. It allows you to see what changes black and ruff have made to your files and make sure that they are correct before you commit them.

Licensing

By contributing to GPT Engineer, you agree that your contributions will be licensed under the LICENSE file of the project.

Thank you for your interest in contributing to GPT Engineer! We appreciate your support and look forward to your contributions.