Thank you for contributing! This document explains how to get a local development environment running, run tests, and submit a PR.
- Git
- Python 3.10+ (recommended)
- Poetry (or pip + virtualenv)
- Docker & Docker Compose
- (Optional) OpenAI API key if you plan to run examples that generate embeddings or use an LLM
- Clone the repo:
git clone https://github.com/oceanbase/langchain-oceanbase.git
cd langchain-oceanbase- Create a virtual environment and install dependencies:
- With Poetry:
poetry install
poetry shell- With pip:
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt- Bring up the local database for development (OceanBase):
make docker-up
# or for SeekDB lightweight alternative:
make docker-up-seek- Environment variables (examples)
Create a
.envfile or export environment variables:
OB_HOST=127.0.0.1
OB_PORT=3306
OB_USER=root
OB_PASSWORD=yourpassword
OB_DB=langchain_ob_demo
OPENAI_API_KEY=sk-xxxx
- Unit tests:
pytest tests/unit- Integration tests (requires docker-compose services up):
make docker-up
pytest tests/integration- Linting / type checks:
ruff check .
mypy .- Formatting: black
- Linting: ruff
- Type checks: mypy
- Commit messages: follow Conventional Commits or keep concise, descriptive messages.
-
Start from the correct base branch:
- Regular work starts from
develop - Releases start from
develop - Hotfixes start from
main
- Regular work starts from
-
Create a branch with a git-flow style name:
git checkout -b feature/onboard-docker-compose origin/developExamples:
git checkout -b bugfix/fix-seekdb-timeout origin/develop
git checkout -b release/0.3.4 origin/develop
git checkout -b hotfix/restore-ci origin/main-
Make edits and add tests where applicable.
-
Run tests and linters locally.
-
Commit changes:
git add .
git commit -m "feat: add docker-compose and onboarding docs"
git push origin feature/onboard-docker-compose- Open a PR describing the change. Use these git-flow targets:
feature/*,bugfix/*,chore/*,docs/*,refactor/*,test/*->developrelease/*->mainhotfix/*->main, then back-merge todevelop- Dependabot version updates target
develop - Dependabot security updates still follow the GitHub default branch until a repo admin switches the default branch from
maintodevelop
Include:
- Problem you're solving
- Any migration or manual steps
- Testing steps
- Tests added/updated
- Linting passes
- Clear description & motivation
- Updated docs if needed
make docker-up— start OceanBasemake docker-up-seek— start SeekDB (alternative)make docker-down— stop OceanBase and remove volumesmake docker-logs— follow OceanBase logs
Thank you for contributing!