Skip to content

Commit 6c847a6

Browse files
[docs] refresh workflows and roadmap
1 parent 0f534a2 commit 6c847a6

File tree

3 files changed

+200
-103
lines changed

3 files changed

+200
-103
lines changed

CONTRIBUTING.md

Lines changed: 68 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,81 @@
11
# 👾 Contributing to PatchVec
22

3-
We welcome PRs, issues, and feedback!
3+
Patchvec accepts code and docs from people who ship patches. Follow the steps below and keep PRs focused.
44

5-
---
5+
## Environment setup
66

7-
## 🛠 Dev Setup
87
```bash
9-
python -m venv .venv
10-
source .venv/bin/activate
11-
python -m pip install --upgrade pip
12-
pip install -r requirements-test.txt # includes runtime + test deps
13-
```
8+
# clone and enter the repo first
9+
git clone https://github.com/patchvec/patchvec.git
10+
cd patchvec
1411

15-
## 🧪 Testing
16-
```bash
17-
pytest -q
12+
# GPU deps by default; add USE_CPU=1 if you do not have a GPU
13+
make install-dev
14+
15+
# copy local config overrides if you need to tweak behaviour
16+
cp config.yml.example config.yml
17+
cp tenants.yml.example tenants.yml
18+
19+
# optional: run the service right away
20+
USE_CPU=1 make serve
1821
```
19-
CI/CD blocks releases if tests fail.
2022

21-
## ▶️ Dev Server
23+
Run the test suite before pushing (`USE_CPU=1` if you installed CPU wheels):
24+
2225
```bash
23-
# CPU-only deps by default
24-
make serve
25-
# or explicitly
26-
HOST=0.0.0.0 PORT=8080 RELOAD=1 WORKERS=1 LOG_LEVEL=info ./pavesrv.sh
26+
# USE_CPU=1 if you installed CPU deps
27+
make test
2728
```
2829

30+
Need to inspect behaviour without reloads? After tweaking `config.yml` / `tenants.yml`, run `AUTH_MODE=static PATCHVEC_AUTH__GLOBAL_KEY=<your-secret> DEV=0 make serve` for an almost production-like stack, or call the wrapper script directly: `PATCHVEC_AUTH__GLOBAL_KEY=<your-secret> ./pavesrv.sh`.
31+
32+
## Workflow
33+
34+
1. Fork and clone the repository.
35+
2. Create a branch named after the task (`feature/tenant-search`, `fix/csv-metadata`, etc.).
36+
3. Make the change, keep commits scoped, and include tests when possible.
37+
4. Run `make test` and `make check` if you touched deployment or packaging paths.
38+
5. Open a pull request referencing the issue you claimed.
39+
40+
Use imperative, lowercase commit messages (`docs: clarify docker quickstart`).
41+
42+
## Issues and task claims
43+
44+
- `ROADMAP.md` lists chores that need owners.
45+
- To claim a task, open an issue titled `claim: <task>` and describe the approach.
46+
- Good first issues live under the `good-first-issue` label. Submit a draft PR within a few days of claiming.
47+
48+
## Code style
49+
50+
- Prefer direct, readable Python. Keep imports sorted and avoid wildcard imports.
51+
- Follow PEP 8 defaults, keep line length ≤ 88 characters, and run `ruff` locally if you have it installed.
52+
- Do not add framework abstractions unless they solve a concrete problem.
53+
- Avoid adding dependencies without discussing them in an issue first.
54+
55+
## Pull request checklist
56+
57+
- [ ] Tests pass locally (`make test`, add `USE_CPU=1` if you installed CPU wheels).
58+
- [ ] Packaged stack still works (`make check` on a clean checkout).
59+
- [ ] Docs updated when behavior changes.
60+
- [ ] PR description states what changed and why.
61+
62+
Ship code, not questions. If you need help, post logs and the failing command instead of asking for permission.
63+
64+
## Architecture
65+
66+
- Stores live under `pave/stores/*` (default txtai/FAISS today, Qdrant stub ready).
67+
- Embedding adapters reside in `pave/embedders/*` (txtai, sentence-transformers, OpenAI, etc.).
68+
- `pave/service.py` wires the FastAPI application and injects the store into `app.state`.
69+
- CLI entrypoints are defined in `pave/cli.py`; shell shims `pavecli.sh`/`pavesrv.sh` wrap the same commands for repo contributors.
70+
2971
## 🧰 Makefile Targets
30-
- `make install` — install runtime deps (CPU default; `USE_GPU=1` for GPU)
31-
- `make install-dev` — runtime + test deps
32-
- `make serve` — start FastAPI app (uvicorn) with autoreload
33-
- `make test` — run tests
34-
- `make build` — build sdist/wheel (includes ABOUT.md)
35-
- `make package` — create .zip and .tar.gz in ./artifacts
36-
- `make release VERSION=x.y.z` — update versions (setup.py, main.py, Dockerfile, compose, README tags), prepend CHANGELOG with sorted commits since last tag, run tests/build (must pass), tag & push
37-
- `make clean` / `make clean-dist` — cleanup
38-
39-
## 🚢 Release Notes
40-
- Version bumps also update Docker-related version strings where applicable.
41-
- The release target **will not push** if tests/build fail.
42-
- Ensure `PYPI_API_TOKEN` is set in CI to publish on tag.
43-
44-
## 🔐 Secrets & Config
45-
- Don’t commit secrets. Use `.env` (ignored) or env vars in CI.
46-
- For per-tenant keys, use an untracked `tenants.yml` and reference it from `config.yml` (`auth.tenants_file`).
47-
- Config precedence: code defaults < `config.yml` < `tenants.yml` < `PATCHVEC__*` env.
48-
49-
## 📝 Commit Style
50-
Keep commit messages short and scoped:
51-
```
52-
search: fix filter parsing
53-
docs: add curl examples
54-
build: include ABOUT.md in sdist
55-
arch: refactored StoreFactory
56-
```
5772

58-
## 🧩 Architecture (brief)
59-
- Stores: `pave/stores/*` (default txtai/FAISS, qdrant stub)
60-
- Embedders: `pave/embedders/*` (default/txtai, sbert, openai)
61-
- Pure-ish orchestration: `pave/service.py`
62-
- Dependency injection: `build_app()` wires store via `app.state`
73+
- `make install` — install runtime deps (CPU wheels by default; `USE_GPU=1` for GPU builds).
74+
- `make install-dev` — runtime + test deps for contributors.
75+
- `make serve` — start the FastAPI app (uvicorn) with autoreload (`USE_CPU=1` for CPU-only setups).
76+
- `make test` — run the pytest suite.
77+
- `make check` — build and smoke-test the container image with the demo corpus.
78+
- `make build` — build sdist/wheel (includes ABOUT.md).
79+
- `make package` — create `.zip`/`.tar.gz` artifacts under `./artifacts`.
80+
- `make release VERSION=x.y.z` — sync version strings, regenerate the changelog, run tests/build, tag & push.
81+
- `make clean` / `make clean-dist` — remove caches and build outputs.

README.md

Lines changed: 87 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,87 +1,120 @@
11
# 🍰 PatchVec — Lightweight, Pluggable Vector Search Microservice
22

3-
Upload → chunk → index (with metadata) → search via REST and CLI.
3+
Patchvec is a compact vector store built for people who want provenance and fast iteration on RAG plumbing. No black boxes, no hidden pipelines: every chunk records document id, page, and byte offsets, and you can swap embeddings or storage backends per collection.
44

5-
---
5+
## ⚙️ Core capabilities
66

7-
## 🚀 Quickstart
7+
- **Docker images** — prebuilt CPU/GPU images published to the GitLab Container Registry.
8+
- **Tenants and collections** — isolation by tenant with per-collection configuration.
9+
- **Pluggable embeddings** — choose the embedding adapter per collection; wire in local or hosted models.
10+
- **REST and CLI** — production use over HTTP, quick experiments with the bundled CLI.
11+
- **Deterministic provenance** — every hit returns doc id, page, offset, and snippet for traceability.
812

9-
### 🖥️ CPU-only Dev (default)
10-
```bash
11-
python -m venv .venv
12-
source .venv/bin/activate
13-
python -m pip install --upgrade pip
14-
pip install -r requirements-cpu.txt
15-
./pavesrv.sh
16-
```
13+
## 🧭 Workflows
14+
15+
### 🐳 Docker workflow (prebuilt images)
16+
17+
Pull the image that fits your hardware from the [https://gitlab.com/flowlexi](Flowlexi) Container Registry on Gitlab (CUDA builds publish as `latest`, CPU-only as `latest-cpu`).
1718

18-
### 📦 Install from PyPI
1919
```bash
20-
python -m venv .venv
21-
source .venv/bin/activate
22-
python -m pip install --upgrade pip
23-
pip install patchvec[cpu] # or patchvec[gpu] for CUDA
20+
docker pull registry.gitlab.com/flowlexi/patchvec/patchvec:latest
21+
docker pull registry.gitlab.com/flowlexi/patchvec/patchvec:latest-cpu
2422
```
2523

26-
### ▶️ Run the Server
27-
From source:
24+
Run the service by choosing the tag you need and mapping the API port locally:
25+
2826
```bash
29-
./pavesrv.sh
27+
docker run -d --name patchvec \
28+
-p 8086:8086 \
29+
registry.gitlab.com/flowlexi/patchvec/patchvec:latest-cpu
3030
```
31-
From PyPI:
31+
32+
Use the bundled CLI inside the container to create a tenant/collection, ingest a demo document, and query it:
33+
3234
```bash
33-
pavesrv
35+
docker exec patchvec pavecli create-collection demo books
36+
docker exec patchvec pavecli upload demo books /app/demo/20k_leagues.txt \
37+
--docid=verne-20k --metadata='{"lang":"en"}'
38+
docker exec patchvec pavecli search demo books "captain nemo" -k 3
3439
```
3540

36-
### ⚙️ Minimal Config
37-
For production (static auth), set env vars (do not commit secrets):
38-
```env
39-
PATCHVEC_AUTH__MODE=static
40-
PATCHVEC_AUTH__GLOBAL_KEY=sekret-passwod
41-
```
42-
(Optional: copy `config.yml.example` to an untracked `config.yml` and tweak as needed)
43-
(Tip: use an untracked `tenants.yml` and point `auth.tenants_file` to it in `config.yml`.)
41+
See below for REST and UI.
4442

45-
---
43+
Stop the container when you are done:
4644

47-
## 🔧 Overriding Server Settings (uvicorn)
48-
You can override a few server knobs via environment variables:
4945
```bash
50-
HOST=127.0.0.1 PORT=9000 RELOAD=1 WORKERS=4 LOG_LEVEL=debug pavesrv
46+
docker rm -f patchvec
5147
```
52-
> Note: Full configuration uses the `PATCHVEC_...` env scheme (e.g., `PATCHVEC_SERVER__PORT=9000`).
5348

54-
---
49+
### 🐍 PyPI workflow
5550

56-
## 🌐 REST API Examples
51+
Install Patchvec from PyPI inside an isolated virtual environment and point it at a local configuration directory:
5752

58-
**Create a collection**
5953
```bash
60-
curl -X POST "http://localhost:8086/collections/acme/invoices"
61-
```
54+
mkdir -p ~/pv && cd ~/pv #or wherever
55+
python -m venv .venv-pv
56+
source .venv-pv/bin/activate
57+
python -m pip install --upgrade pip
58+
python -m pip install "patchvec[cpu]" # or "patchvec[gpu]" for CUDA
6259

63-
**Upload a TXT/PDF/CSV document**
64-
```bash
65-
curl -X POST "http://localhost:8086/collections/acme/invoices/documents" -F "file=@sample.txt" -F "docid=DOC-1" -F 'metadata={"lang":"pt"}'
66-
```
60+
# grab the default configs
61+
curl -LO https://raw.githubusercontent.com/patchvec/patchvec/main/config.yml.example
62+
curl -LO https://raw.githubusercontent.com/patchvec/patchvec/main/tenants.yml.example
63+
cp config.yml.example config.yml
64+
cp tenants.yml.example tenants.yml
6765

68-
**Search (GET, no filters)**
69-
```bash
70-
curl "http://localhost:8086/collections/acme/invoices/search?q=garantia&k=5"
71-
```
66+
# sample demo corpus
67+
curl -LO https://raw.githubusercontent.com/patchvec/patchvec/main/demo/20k_leagues.txt
7268

73-
**Search (POST with filters)**
74-
```bash
75-
curl -X POST "http://localhost:8086/collections/acme/invoices/search" -H "Content-Type: application/json" -d '{"q": "garantia", "k": 5, "filters": {"docid": "DOC-1"}}'
69+
# point Patchvec at the config directory and set a local admin key
70+
export PATCHVEC_CONFIG="$HOME/pv/config.yml"
71+
export PATCHVEC_GLOBAL_KEY=super-sekret
72+
73+
# option A: run the service (stays up until you stop it)
74+
pavesrv
75+
76+
# option B: operate entirely via the CLI (no server needed)
77+
pavecli create-collection demo books
78+
pavecli upload demo books 20k_leagues.txt --docid=verne-20k --metadata='{"lang":"en"}'
79+
pavecli search demo books "captain nemo" -k 3
7680
```
7781

78-
**Health / Metrics**
82+
Deactivate the virtual environment with `deactivate` when finished.
83+
84+
### 🌐 REST API and Web UI usage
85+
86+
When the server is running (either via Docker or `pavesrv`), the API listens on `http://localhost:8086`. The following `curl` commands mirror the CLI sequence above—adjust the file path to wherever you stored the corpus (`/app/demo/20k_leagues.txt` in Docker, `~/pv/20k_leagues.txt` for PyPI installs) and reuse the bearer token exported earlier:
87+
7988
```bash
80-
curl "http://localhost:8086/health"
81-
curl "http://localhost:8086/metrics"
89+
# create collection
90+
curl -H "Authorization: Bearer $PATCHVEC_GLOBAL_KEY" \
91+
-X POST http://localhost:8086/collections/demo/books
92+
93+
# ingest document
94+
curl -H "Authorization: Bearer $PATCHVEC_GLOBAL_KEY" \
95+
-X POST http://localhost:8086/collections/demo/books/documents \
96+
-F "file=@20k_leagues.txt" \
97+
-F 'metadata={"lang":"en"}'
98+
99+
# run search
100+
curl -H "Authorization: Bearer $PATCHVEC_GLOBAL_KEY" \
101+
"http://localhost:8086/collections/demo/books/search?q=captain+nemo&k=3"
82102
```
83103

84-
---
104+
There is a simple Swagger UI available at the root of the server. Just point your browser to `http://localhost:8086/`
105+
106+
Health and metrics endpoints are available at `/health` and `/metrics`.
107+
108+
Configuration files copied in either workflow can be customised. Runtime options are also accepted via the `PATCHVEC_*` environment variable scheme (`PATCHVEC_SERVER__PORT`, `PATCHVEC_AUTH__MODE`, etc.), which precedes conf files.
109+
110+
### 🛠️ Developer workflow
111+
112+
Building from source relies on the `Makefile` shortcuts (`make install-dev`, `USE_CPU=1 make serve`, `make test`, etc.). The full contributor workflow, target reference, and task claiming rules live in [CONTRIBUTING.md](CONTRIBUTING.md).
113+
114+
## 🗺️ Roadmap
115+
116+
Short & mid-term chores are tracked in [`ROADMAP.md`](ROADMAP.md). Pick one, open an issue titled `claim: <task>`, and ship a patch.
85117

86118
## 📜 License
119+
87120
GPL-3.0-or-later — (C) 2025 Rodrigo Rodrigues da Silva

ROADMAP.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Roadmap
2+
3+
Immediate chores worth tackling now. Claim a task by opening an issue titled `claim: <task>` and link your branch or PR when ready.
4+
5+
## 0.5.x Series — Adoption & Stability
6+
7+
### v0.5.7 — Search, Filters, Traceability
8+
- Expand partial filter support (`*` prefix/fuzzy matching).
9+
- Return a `match_reason` field alongside every hit.
10+
- Persist configurable logging per tenant and collection.
11+
- Provide REST/CLI endpoints to delete a document by id.
12+
- Expose latency histograms (p50/p95/p99) via `/metrics` for search and ingest requests.
13+
14+
### v0.5.8 — Persistence, Infrastructure
15+
- Ship an internal metadata/content store (SQLite or TinyDB) with migrations.
16+
- Serve `/metrics` and `/collections` using the internal store as the source of truth.
17+
- Emit structured logs with `request_id`, tenant, and latency, and allow rolling retention per tenant/collection.
18+
- Support renaming collections through the API and CLI.
19+
- Provide per-tenant and per-operation API rate limits
20+
21+
### v0.5.9 — Ranking, Model Quality
22+
- Add hybrid reranking (vector similarity + BM25/token matching).
23+
- Honor `meta.priority` boosts during scoring.
24+
- Improve multilingual relevance and evaluation fixtures.
25+
26+
## 🚀 Towards 1.0
27+
28+
### 0.6 — Per-Collection Embeddings, Data Types
29+
- Configure embeddings per collection via `config.yml`.
30+
- Maintain per-collection hot caches with isolation guarantees.
31+
- List tenants and collections via the API (CLI parity included).
32+
- Lay ground to support new data types (audio, video, image)
33+
34+
### 0.7 — API Utilities & Observability
35+
- Default tenant/collection selectors in Swagger UI.
36+
- Export indexes, enforce collection-level logging toggles, add rate limiting, and finalize per-collection embedding configuration flows.
37+
38+
### 0.8 — Reliability & Governance
39+
- Deliver the internal DB for persistence, document versioning, rebuild tooling, persistent metrics, surfacing metrics in the UI, JWT auth, per-tenant quotas, and transactional rollback with safe retries.
40+
41+
### 0.9 — Scale & Multi-Tenant Search
42+
- Async ingest, parallel purge, horizontal scalability, tenant groups, and shared/group search with sub-index routing.
43+
44+
### 1.0 — API Freeze
45+
- Lock routes, publish the final OpenAPI spec, and ship an SDK client ready for long-term support.

0 commit comments

Comments
 (0)