Skip to content

Commit

Permalink
docs: README.md, CONTRIBUTING.md, doc.go
Browse files Browse the repository at this point in the history
  • Loading branch information
Anush008 committed Sep 6, 2024
1 parent 5233697 commit 36f9d24
Show file tree
Hide file tree
Showing 4 changed files with 122 additions and 3 deletions.
100 changes: 100 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
## Report Issues on GitHub [Issues](https://github.com/qdrant/go-client/issues)

We track public bugs and feature requests using GitHub issues. Please report by [opening a new issue](https://github.com/qdrant/go-client/issues/new).

**Effective Bug Reports** should include:

- A clear summary or background
- Steps to reproduce the issue
- Be as specific as possible
- Include sample code when possible
- What you expected to happen
- What actually happened
- Additional notes (e.g., why you think the issue occurs or solutions you’ve tried that didn’t work)

## Contributing Code

Follow these steps before submitting a pull request:

### Building the Project

```bash
go build ./...
```

This will download all dependencies and compile the project.

### Running Tests

All test files are in the `qdrant_test` directory and use [Testcontainers Go](https://golang.testcontainers.org/) for integration tests.

Run the following command to execute the test suites:

```bash
go test -v ./...
```

This command pulls a Qdrant Docker image to run integration tests. Ensure Docker is running.

### Formatting and Linting

Ensure your code is free from warnings and follows project standards.

The project uses [Gofmt](https://go.dev/blog/gofmt) for formatting and [golangci-lint](https://github.com/golangci/golangci-lint) for linting.

To format your code:

```bash
gofmt -s -w .
```

To lint your code:

```bash
golangci-lint run
```

### Preparing for a New Release

Much of the client is generated from upstream Qdrant proto definitions, which are downloaded from [qdrant/qdrant](https://github.com/qdrant/qdrant).

#### Steps:

1. Download and generate the latest proto definitions by running the following command from the project root:

```bash
BRANCH=dev sh tools/sync_proto.sh
```

2. Update the test image value in `qdrant_test/image_test.go` to `qdrant/qdrant:dev`.

3. Manually remove the gRPC server definitions from the auto-generated code.

There is currently [no way](https://github.com/golang/protobuf/issues/373) to skip generating Go server definitions, so you’ll need to manually delete them from `snapshots_service_grpc.pb.go`, `points_service_grpc.pb.go`, and `collections_service_grpc.pb.go`. Remove lines starting from comments like `// CollectionsServer is the server API for Collections service.` until the end of the file. [Here’s an example commit]().

4. Implement new Qdrant methods in `points.go`, `collections.go`, or `qdrant.go` as needed.

5. If there are any new `oneOf` properties in the proto definitions, add helper constructors in `oneof_factory.go` following the existing patterns.

6. Submit your pull request and get some of those approvals.

### Releasing a New Version

Once the new Qdrant version is live:

1. Run the following command:

```bash
BRANCH=master sh tools/sync_proto.sh
```

2. Update the test image value in `qdrant_test/image_test.go` to `qdrant/qdrant:NEW_VERSION`.

3. Merge the pull request.

4. Push a new Git tag to publish the version:

```bash
git tag v1.11.0
git push --tags
```
16 changes: 16 additions & 0 deletions qdrant/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
# Qdrant Go Client
Package provides a client for interfacing with the Qdrant - https://qdrant.tech/ gRPC API.
# Documentation
- Usage examples are available throughout the [Qdrant documentation] and [API Reference]
- [Godoc Reference]
[Qdrant documentation]: https://qdrant.tech/documentation/
[API Reference]: https://api.qdrant.tech/
[Godoc Reference]: https://pkg.go.dev/github.com/qdrant/go-client
*/
package qdrant
4 changes: 2 additions & 2 deletions tools/generate_proto_go.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ PROJECT_ROOT="$(pwd)/$(dirname "$0")/../"

QDRANT_PROTO_DIR='proto'

go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.34.2
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.5.1
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest

export PATH="$PATH:$(go env GOPATH)/bin"

Expand Down
5 changes: 4 additions & 1 deletion tools/sync_proto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

set -e

BRANCH=${BRANCH:-"master"}
PROJECT_ROOT="$(pwd)/$(dirname "$0")/../"

cd $(mktemp -d)

git clone --sparse --filter=blob:none --depth=1 https://github.com/qdrant/qdrant
git clone --sparse --branch $BRANCH --filter=blob:none --depth=1 https://github.com/qdrant/qdrant
cd qdrant
git sparse-checkout add lib/api/src/grpc/proto

Expand Down Expand Up @@ -37,3 +38,5 @@ sed -i '

# Remove csharp option from proto files
sed -i '/option csharp_namespace = .*/d' $CLIENT_DIR/*.proto

sh tools/generate_proto_go.sh

0 comments on commit 36f9d24

Please sign in to comment.