Skip to content

Commit aeaf1f5

Browse files
authored
Merge pull request #1879 from weaviate/docs/update-repo-guides
Docs - update repo docs for tests & release creation
2 parents ee36ac0 + 6496753 commit aeaf1f5

File tree

4 files changed

+43
-90
lines changed

4 files changed

+43
-90
lines changed

CONTRIBUTING.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,12 @@
11
### Setup
22

3-
We recommend that you use a virtual environment to contribute to the client.
4-
5-
To create a virtual environment, activate it, and install dependencies, run the following shell code:
3+
The development requirements are listed in the `requirements-devel.txt` file. Install them to your virtual environment with:
64

75
```shell
8-
python3 -m venv .venv
9-
source .venv/bin/activate
106
pip install -r requirements-devel.txt
117
```
128

13-
To activate your virtual environment, run `source .venv/bin/activate`.
14-
15-
The newest client versions sometimes require upcoming Weaviate core features. We recommend using Docker (see https://weaviate.io/developers/weaviate/installation/docker-compose) to run a local instance of the `latest Weaviate core <https://hub.docker.com/r/semitechnologies/weaviate/tags>`_ for client development.
9+
The newest client versions sometimes require upcoming Weaviate core features. We recommend using Docker (see https://docs.weaviate.io/deploy/installation-guides/docker-installation) to run a local instance of the `latest Weaviate core <https://hub.docker.com/r/semitechnologies/weaviate/tags>`_ for client development.
1610

1711
#### Installation
1812

@@ -34,10 +28,16 @@ You can install a particular branch directly from GitHub with:
3428
pip install git+https://github.com/weaviate/weaviate-python-client.git@BRANCH_NAME
3529
```
3630

31+
If any static analysis tools such as Pylance fail, try installing the package with:
32+
`--config-settings editable_mode=compat` suffix. (e.g. `pip install -e . --config-settings editable_mode=compat`)
3733

3834
### Testing
3935

40-
> Note: We use [pytest](https://docs.pytest.org) to write tests for new client code. However, many older tests use [unittest](https://docs.python.org/3/library/unittest.html). These commands run the `pytest` and `unittest` tests.
36+
To set up the testing environment, install the test requirements with:
37+
38+
```shell
39+
pip install -r requirements-test.txt
40+
```
4141

4242
There are three kinds of tests:
4343
- Unit tests test individual client components.
@@ -67,9 +67,10 @@ pytest test
6767
> We strongly recommend using [pre-commit](https://pre-commit.com/) to automatically run all linters locally on each commit. Install `pre-commit` on your system, and then enable it with `pre-commit install`.
6868
6969
We use the following tools to ensure a high code quality:
70-
- black (formatter), run with `black $FOLDER_WITH_CHANGES`
71-
- 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.
70+
- ruff (formatter), run with `ruff format $FOLDER_WITH_CHANGES`
71+
- flake8 with plugins. Run with `flake8 $FOLDER_WITH_CHANGES`.
7272

73+
Note that all plugins are listed in the `requirements-devel.txt` file and are installed in the first step.
7374

7475
### Creating a Pull Request
7576

RELEASING.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
## How to create releases
2+
3+
### Step 1: Prepare for release
4+
1. Pull latest main
5+
- Merge any pending PRs
6+
2. Determine what the next version should be, following semantic versioning
7+
3. Create a new branch for the changelog
8+
4. Add a changelog entry to `docs/changelog.rst`
9+
- `gh pr list --repo weaviate/weaviate-python-client --state merged --search "merged:>=YYYY-MM-DD"` where `YYYY-MM-DD` is the last release date
10+
- Only add the relevant entries to the changelog
11+
- Examples - [minor release](https://github.com/weaviate/weaviate-python-client/releases/tag/v4.18.0), [patch release](https://github.com/weaviate/weaviate-python-client/releases/tag/v4.16.10)
12+
5. Merge back to main
13+
6. Pull main
14+
15+
### Step 2: Create release
16+
Option 1: With GH CLI
17+
1. `gh release create <VERSION_TAG>` (e.g. `gh release create v4.18.1`)
18+
19+
Option 2: With git + GH web UI
20+
1. git tag VERSION
21+
- `git tag -a v4.18.1 -m "v4.18.1"
22+
2. `git push --tags`
23+
3. Create a release [from the GH repo](https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository?tool=webui#creating-a-release)
24+
25+
### Step 3: Monitor pipeline
26+
1. Monitor the CICD pipeline
27+
1. When all tests pass, the release will be pushed to PyPI automatically
28+
29+
### Notes:
30+
- The package version is updated automatically (see setup.cfg)

publishing.md

Lines changed: 0 additions & 15 deletions
This file was deleted.

test/README.md

Lines changed: 1 addition & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1 @@
1-
# Unit tests for Weaviate Python client
2-
---
3-
Unit tests for weaviate package. Each module should have its own sub-directory in the `test` directory. Each test file should begin with `test_<fine_name>.py` and `test` directory should not be renamed, these are mandatory requirements for the `unittest` to parse and run all unittests.
4-
5-
The `util.py` contains helper functions for unit testing.
6-
7-
---
8-
## Run one file unittest
9-
In order to unit test a single file, you can run the following command:
10-
```
11-
python -m unittest path_to_file_dir.file
12-
```
13-
E.g. if you run it from repo root folder:
14-
```bash
15-
python -m unittest test.gql.test_get -v # -v is optional, -v = verbose
16-
```
17-
## Run whole package unittest
18-
In order to unit test the whole package, you can run the following command:
19-
```bash
20-
python -m unittest -v # -v is optional, -v = verbose
21-
```
22-
23-
# Coverage test
24-
---
25-
Coverage test for weaviate package. Coverage test can be performed using the existing unit test. It runs all the unit tests in order to find which parts of the code have been executed, thus it can be used instead of the Unit test.
26-
Coverage test is performed by the `coverage` package that should be installed with the `development-requirements.txt`. For more information on what and how to run coverage tests visit this [link](https://coverage.readthedocs.io/en/coverage-5.3.1/ "coverage.readthedocs.io").
27-
28-
---
29-
30-
## Run coverage test for one file
31-
Coverage test for one file can be performed using the following command:
32-
```bash
33-
coverage run -m unittest path_to_the_file_dir.file -v # -v is optional, -v = verbose
34-
```
35-
E.g. if you run it from repo root folder:
36-
```bash
37-
coverage run -m unittest test.gql.test_get -v # -v is optional, -v = verbose
38-
```
39-
40-
## Run whole package coverage test
41-
In order to unit test the whole package, you can run the following command:
42-
```bash
43-
coverage run -m unittest -v # -v is optional, -v = verbose
44-
```
45-
## Show coverage report
46-
To get the coverage report run the following command.
47-
```bash
48-
coverage report -m --skip-covered # --skip-covered = skip 100% covered files, -m = show missing lines
49-
```
50-
51-
# Linting
52-
---
53-
Lint the files that are modified before commiting. The linting is done by `pylint`.
54-
55-
To lint a file/module/package run the following command:
56-
```bash
57-
pylint path_to_the_file_or_module
58-
```
59-
E.g. if you run it from repo root folder:
60-
```bash
61-
pylint weaviate # for the whole package
62-
pylint weaviate/batch # for the module batch
63-
pylint weaviate/connect/connection.py # for the connection.py file
64-
```
1+
Refer to [CONTRIBUTING.md](CONTRIBUTING.md) file for instructions on how to run the tests.

0 commit comments

Comments
 (0)