graphrag-accelerator/docs/DEVELOPMENT-GUIDE.md

48 lines
2.4 KiB
Markdown
Raw Permalink Normal View History

2024-06-26 15:45:06 -04:00
# Development Guide
This document is for developers interested in contributing to GraphRAG.
## Quickstart
Development is best done in a unix environment (Linux, Mac, or [Windows WSL](https://learn.microsoft.com/en-us/windows/wsl/install)).
1. Clone the GraphRAG repository.
1. Follow all directions in the [deployment guide](DEPLOYMENT-GUIDE.md) to install required tools and deploy an instance of the GraphRAG service in Azure. Alternatively, this repo provides a devcontainer with all tools preinstalled.
2024-12-30 01:59:08 -05:00
1. New unit tests and integration tests are currently being added to improve the developer experience when testing code changes locally.
2024-06-26 15:45:06 -04:00
2024-12-30 01:59:08 -05:00
### Testing
2024-06-26 15:45:06 -04:00
2024-12-30 01:59:08 -05:00
A small collection of unit tests and integrations tests have been written to test functionality of the API. To get started, first ensure that all test dependencies have been installed.
2024-06-26 15:45:06 -04:00
2024-12-30 01:59:08 -05:00
```shell
cd <graphrag-accelerator-repo>/backend
poetry install --with test
```
2024-06-26 15:45:06 -04:00
2024-12-30 01:59:08 -05:00
Some tests require the [azurite emulator](https://learn.microsoft.com/en-us/azure/storage/common/storage-use-azurite?toc=%2Fazure%2Fstorage%2Fblobs%2Ftoc.json&bc=%2Fazure%2Fstorage%2Fblobs%2Fbreadcrumb%2Ftoc.json&tabs=docker-hub%2Cblob-storage) and [cosmosdb emulator](https://learn.microsoft.com/en-us/azure/cosmos-db/how-to-develop-emulator?tabs=docker-linux%2Ccsharp&pivots=api-nosql) to be running locally (these are setup in the ci/cd automatically). You may start these emulators by running them in the background as docker containers.
2024-06-26 15:45:06 -04:00
2024-12-30 01:59:08 -05:00
```shell
docker run -d -p 10000:10000 -p 10001:10001 -p 10002:10002 mcr.microsoft.com/azure-storage/azurite:latest
docker run -d -p 8081:8081 -p 1234:1234 mcr.microsoft.com/cosmosdb/linux/azure-cosmos-emulator:vnext-preview
```
2024-06-26 15:45:06 -04:00
2024-12-30 01:59:08 -05:00
To run the tests:
2024-06-26 15:45:06 -04:00
```shell
2024-12-30 01:59:08 -05:00
cd <graphrag-accelerator-repo>/backend
pytest -s --cov=src tests
2024-06-26 15:45:06 -04:00
```
### Deployment (CI/CD)
This repository uses Github Actions for continuous integration and continious deployment (CI/CD).
### Style Guide:
* We follow [PEP 8](https://peps.python.org/pep-0008) standards and naming conventions as close as possible.
* [ruff](https://docs.astral.sh/ruff) is used for linting and code formatting. A pre-commit hook has been setup to automatically apply settings to this repo. To make use of this tool without explicitly calling it, install the pre-commit hook.
```
> pre-commit install
```
### Versioning
2024-12-30 01:59:08 -05:00
We use [SemVer](https://aka.ms/StartRight/README-Template/semver) for semantic versioning.