From 70e511e31619c0ddc498ad081e6639c40232e4d6 Mon Sep 17 00:00:00 2001 From: deansher Date: Mon, 5 Aug 2024 19:11:06 -0400 Subject: [PATCH] improved CONTRIBUTING.md as I used it --- CONTRIBUTING.md | 58 +++++++++++++++++++++++++++---------------------- 1 file changed, 32 insertions(+), 26 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d2b1c9599..22bcece77 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -80,24 +80,6 @@ virtualenv /path/to/venv source /path/to/venv/bin/activate ``` -### Install the Project Dependencies - -``` -pip install -r requirements.txt -``` - -If you want to contribute to the project or run tests, install the development dependencies: - -``` -pip install -r requirements-dev.txt -``` - -If you want to use the HuggingFace embedding models, install the additional requirements: - -``` -pip install -r requirements-hf-embed.txt -``` - ### Install the Project in Editable Mode This step allows you to make changes to the source code and have them take effect immediately without reinstalling the package. @@ -106,6 +88,22 @@ This step allows you to make changes to the source code and have them take effec pip install -e . ``` +### Install the Project Dependencies + +``` +pip install -r requirements.txt +``` + +For development, at least install the development dependencies: + +``` +pip install -r requirements/requirements-dev.txt +``` + +Consider installing other optional dependencies from the `requirements/` directory, if your development work needs them. + +Note that these dependency files are generated by `./scripts/pip-compile.sh` and then committed. See [Managing Dependencies](#managing-dependencies). + ### Install Pre-commit Hooks (Optional) The project uses pre-commit hooks for code formatting and linting. If you want to install and use these hooks, run: @@ -118,13 +116,21 @@ This will automatically run the pre-commit hooks when you commit changes to the Now you should have a fully functional development environment for the Aider project. You can start making changes, running tests, and contributing to the project. +### Handy Opinionated Setup Commands for MacOS / Linux + +Here's an example of following the setup instructions above, for your copy/paste pleasure if your system works the same. Start in the project directory. + +``` +python3 -m venv ../aider_venv \ + && source ../aider_venv/bin/activate \ + && pip3 install -e . \ + && pip3 install -r requirements.txt \ + && pip3 install -r requirements/requirements-dev.txt +``` + ### Running Tests -To run the project's tests, use the following command: - -``` -python -m unittest discover -s aider/tests -``` +Just run `pytest`. ### Building the Docker Image @@ -211,11 +217,12 @@ The project uses `pytest` as the testing framework, which is installed as a deve pip install -r requirements-dev.txt ``` -### Dependencies +### Managing Dependencies -When introducing new dependencies, make sure to add them to the appropriate `requirements.in` file (e.g., `requirements.in` for main dependencies, `requirements-dev.in` for development dependencies). Then, run the following command to update the corresponding `requirements.txt` file: +When introducing new dependencies, make sure to add them to the appropriate `requirements.in` file (e.g., `requirements.in` for main dependencies, `requirements-dev.in` for development dependencies). Then, run the following commands to update the corresponding `requirements.txt` file: ``` +pip install pip-tools ./scripts/pip-compile.sh ``` @@ -238,4 +245,3 @@ pre-commit will then run automatically on each `git commit` command. You can use ``` pre-commit run --all-files ``` -``` \ No newline at end of file