Skip to content

Latest commit

 

History

History
67 lines (45 loc) · 2.65 KB

CONTRIBUTING.md

File metadata and controls

67 lines (45 loc) · 2.65 KB

Setup

We recommend to create a virtual environment to contribute to the client.

Run the following to create a virtual environment, activate it and install dependencies:

python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

The next time you open your shell, you can activate your virtual environment using source .venv/bin/activate

To run local instance of Weaviate, we recommend using Docker (see https://weaviate.io/developers/weaviate/installation/docker-compose).

Testing

Note: We use pytest to write tests, however many older tests use unittest. Regardless, the below commands will run all tests.

There are three kinds of tests:

  • Unit tests, that test individual components of the client
  • Integration tests, that test the client with a running weaviate instance
  • Mock tests, where a weaviate instance is mocked to return specific replies

To run the integration tests,

  1. Ensure that you have Docker installed, and then
  2. Start the weaviate instances with:
./ci/start_weaviate.sh

Then run all tests with

pytest integration
pytest mock_tests
pytest test

Linting

Note We strongly recommend to use pre-commit to automatically run all linters locally on each commit. Install on your system and then enable it using pre-commit install.

We use the following tools to ensure a high code quality:

  • black (formatter), run with black $FOLDER_WITH_CHANGES
  • flake8 with plugins. Run with flake8 $FOLDER_WITH_CHANGES. Note that all plugins are listed in the requirements.txt file and are installed in the first step.

Creating a Pull Request

  • The main branch is what is released and developed currently.
  • You can create a feature-branch that is named: feature/YOUR-FEATURE-NAME.
  • Your feature branch always has the main branch as a starting point.
  • When you are done with your feature you should create a pull request into the main branch.
  • The main branch is protected.

Contributor License Agreement

Contributions to Weaviate python client must be accompanied by a Contributor License Agreement. You (or your employer) retain the copyright to your contribution; this simply gives us permission to use and redistribute your contributions as part of Weaviate Python client. Go to this page to read the current agreement.

The process works as follows:

  • You contribute by opening a pull request.
  • If your account has no CLA, a DocuSign link will be added as a comment to the pull request.