Thank you for your interest in contributing! This guide covers everything you need to get started.
- Ways to Contribute
- Development Setup
- Code Style
- Running Tests
- Submitting a Pull Request
- Reporting Bugs
- Requesting Features
- Bug reports — open an issue using the Bug Report template
- Feature requests — open an issue using the Feature Request template
- Documentation — fix typos, clarify explanations, or add examples
- Code — fix bugs, implement features, or add storage/LLM backends
- Testing — add test coverage for untested code paths
# Clone the repository
git clone https://github.com/HKUDS/LightRAG.git
cd LightRAG
# Install the development environment (requires uv): the test toolchain
# (pytest, ruff, pre-commit) plus the API server, every storage backend and
# every LLM provider integration
uv sync --extra test --extra offline
source .venv/bin/activate # Linux/macOS
# .venv\Scripts\activate # Windows
# Set up pre-commit hooks (run once)
pre-commit installPass every extra you need to one uv sync command. By default uv sync removes packages the selected extras do not need, so uv sync --extra offline-storage run after uv sync --extra test uninstalls pytest again.
After each git pull, re-sync with the same extras:
uv sync --locked --inexact --extra test --extra offline--locked installs exactly what uv.lock pins and fails instead of rewriting it. --inexact keeps packages that are not in uv.lock, such as the spaCy models. See Updating after git pull in the README.
This project uses Ruff for formatting and linting, enforced via pre-commit.
Running pre-commit run --all-files will automatically fix most style issues:
# Fix all files
pre-commit run --all-files
# Fix only staged files (faster during development)
pre-commit run| Hook | What it does |
|---|---|
trailing-whitespace |
Removes trailing whitespace |
end-of-file-fixer |
Ensures files end with a newline |
requirements-txt-fixer |
Keeps requirements.txt entries sorted |
ruff-format |
Formats Python code (Black-compatible) |
ruff |
Fixes Python lint errors |
The same checks run automatically on every pull request. If the CI check fails, run pre-commit run --all-files locally, commit the fixes, and push again.
- Python code and comments: English
- Frontend (WebUI): uses i18next for internationalization — add translation keys rather than hardcoding strings
- README:
README.mdand its translationsREADME-zh.md,README-ja.mdandREADME-id.mdstay line-for-line aligned. Make every README change in all four files in the same commit, with the same line count and the same line breaks.tests/test_readme_translations.pychecks this in CI and names the first line that differs. If you cannot translate the change, put the English text at the same lines in the translations so it can be translated later. Do not leave those files unchanged.
# Run offline tests (no external services required)
python -m pytest tests
# Run integration tests (requires configured external services)
python -m pytest tests --run-integration
# Run a specific test file
python -m pytest tests/chunker/test_chunking.py
# Keep test artifacts for debugging
python -m pytest tests --keep-artifactsSet LIGHTRAG_RUN_INTEGRATION=true as an environment variable as an alternative to --run-integration.
-
Fork the repository and create a branch from
main:git checkout -b fix/your-descriptive-branch-name
-
Make your changes and ensure:
- Pre-commit checks pass:
pre-commit run --all-files - Relevant tests pass:
python -m pytest tests - New behavior is covered by tests where applicable, by extending the existing tests of the changed code first (an assertion or a
parametrizecase) and adding a new test function only when none fits; see Writing backend tests in AGENTS.md
- Pre-commit checks pass:
-
Commit with a clear message describing why the change was made:
git commit -m "fix: handle permission-only encrypted PDFs without password" -
Push and open a pull request against
main. Fill out the pull request template completely. -
Respond to review feedback — a maintainer will review your PR and may request changes.
- Changes tested locally
- Pre-commit checks pass (
pre-commit run --all-files) - Unit/integration tests extended or added where applicable (existing tests first; a new test function says in the PR which existing test it could not join)
- Documentation updated if behavior changes
- README changes applied to all four language versions (
README.md,-zh,-ja,-id), line counts equal - PR description explains the why, not just the what
Please use the Bug Report issue template. Include:
- LightRAG version and Python version
- Storage backend and LLM provider being used
- Minimal reproducible example
- Full error traceback
Please use the Feature Request issue template. Describe:
- The problem you're trying to solve
- Your proposed solution
- Any alternatives you've considered
For usage questions, check the Discussions tab or open a Question issue.