Welcome! This guide helps you set up the project locally for development and contributions. It also explains the coding standards used in the project along with the CI checks
This project uses uv for Python packaging and virtual environments. Python is pinned to 3.12.10 in pyproject.toml.
Clone the repository and navigate to the project directory.
cd RAG-ModuleIf uv is not already installed, install it via the official installer.
curl -LsSf https://astral.sh/uv/install.sh | sh
# Restart your terminal or run: source ~/.zshrcUse uv to install and manage Python 3.12.10.
uv python install 3.12.10From the project root (where pyproject.toml and uv.lock are located), recreate the environment from the lockfile.
# Create .venv and install dependencies strictly from uv.lock
uv sync --frozenNotes:
uv synccreates a local.venv/directory by default and installs dependencies fromuv.lock.- If
--frozenfails due to a stale lockfile, runuv sync -p 3.12.10(without--frozen) to resolve and update.
Activate the virtual environment to use it directly.
source .venv/bin/activate
python -V # Should output: Python 3.12.10When running any Python programs (APIs or scripts) in a docker container or locally, always run with
uv run python app.pyinstead of
python3 app.pyThis will make sure that regardless of whether you have activated the .venv environment or not uv will use virtual environment created instead of system level versions.
Install pre-commit hooks to ensure code quality checks run automatically before commits.
uv run pre-commit installThis installs git hooks that will run configured checks (linting, formatting, etc.) on staged files before each commit.
Test that the hooks are working correctly:
uv run pre-commit run --all-filesThis runs all pre-commit hooks on the entire codebase. Fix any issues that are reported.
Note: If pre-commit hooks fail during a commit, the commit will be blocked until you fix the issues and re-stage your changes.
For more help, check the uv documentation
-
Located in
.github/workflows/uv-env-check.yml -
This GitHub actions check runs to check whether there are any conflicts between the lockfile and pyproject.toml. If it fails, then there has been some dependency update to the pyproject.toml without updating the lockfile.
-
Located in
.github/workflows/pyright-type-check.yml -
This GitHub actions checks runs the Pyright type checker across the entire code-base to check for undeclared Python variables and objects. You can check the Pyright configuration in the
pyproject.tomlfile. We use astrictconfiguration, so even objects being returned through frameworks and libraries should be either type-casted or should be validated using libraries such asPydantic.
-
Located in
.github/workflows/pytest-testcases-check.yml -
This GitHub actions checks runs all Pytest test-cases unders the
tests/folder.
-
Located in
.github/workflows/ruff-format-check.yml -
This GitHub actions check runs the
ruff format --checkon the entire codebase to detect any code incompliant with the project's code formatting standards which are configured inpyproject.toml
-
Located in
.github/workflows/ruff-lint-check.yml -
This GitHub actions check runs the
ruff checkcommand on the entire code base to detect any code incompliant with the project's linting standards which are configured inpyproject.toml
-
Located in
.github/workflows/git-leaks-check.yml -
This GitHub actions check uses the GitLeaks open source tool to check for potential secret/key leakages in the code. There is also a pre-commit hook configured with gitleaks to detect any possible secret leaks before even committing.
If you need to add a new Python dependency, do not run pip install directly.
We use uv to manage environments and lockfiles so that installs are reproducible in local development, CI, and containers.
Use uv add instead of pip install. This ensures both pyproject.toml and uv.lock are updated together.
uv add "package-name>=x.y,<x.(y+1)"- Use a bounded version range (
>=+<) to avoid uncontrolled upgrades.
After adding, re-sync to refresh your local .venv:
uv sync --reinstallMake sure type checks, linter, and tests pass:
uv run pyright
uv run ruff check .
uv run pytestAlways commit both pyproject.toml and uv.lock. If only one is updated, CI will fail (uv sync --frozen check).
git add pyproject.toml uv.lock
git commit -m "added package-name dependency"CI will validate that the lockfile and environment are consistent. If you forgot to update the lockfile, the PR will fail with a clear error.
-
Never edit
uv.lockmanually. It is controlled byuv. -
Never use
uv pip installfor permanent deps — it only changes your local venv. Useuv addinstead. -
Never add or depend on
requirement.txtfiles for installing packages locally or through docker containers. Useuv run sync --frozeninstead. -
If you remove a dependency, run:
uv remove package-name
uv sync --reinstall
git add pyproject.toml uv.lock
git commit -m "removed package-name"