QMD-Py — Query Markup Documents
An on-device hybrid search engine for Markdown documents. Python port of qmd.
Combines BM25 full-text search, vector semantic search (Qwen3-Embedding-0.6B), and LLM re-ranking (Qwen3-Reranker-0.6B) — all running locally via SQLite + sqlite-vec.
Install
pip install -e . # core
pip install -e ".[dev]" # + dev/test deps
pip install -e ".[testing]" # + contract test deps (rank-bm25, deepdiff)
Quick Start — Python API
from qmd import connect
client = connect("my_docs.sqlite")
col = client.collection("notes")
# Add documents
col.add_document("doc1", "# Meeting Notes\n\nDiscussed project timeline.", {"tag": "meeting"})
col.add_documents([
{"document_id": "doc2", "markdown": "# API Design\n\nREST endpoints..."},
{"document_id": "doc3", "markdown": "# Deployment\n\nDocker setup..."},
])
# Search
results = col.hybrid_search("project timeline", top_k=5)
for r in results:
print(f"{r.chunk_ref.document_id}: {r.score:.3f} — {r.text[:80]}")
# Search with reranking
results = col.hybrid_search("deployment", top_k=5, rerank=True)
client.close()
Quick Start — CLI
# Add a document
python -m qmd document add --collection notes --document-id doc1 --markdown-file notes.md
# List documents
python -m qmd document list --collection notes
# Search
python -m qmd search --collection notes --query "project timeline" --top-k 5
# List collections
python -m qmd collection list
Architecture
- Storage: SQLite + sqlite-vec (single-file database)
- Embedding: Qwen3-Embedding-0.6B (sentence-transformers, 1024-dim)
- Reranker: Qwen3-Reranker-0.6B (transformers, yes/no softmax)
- Query Expansion: Qwen3-0.6B (optional, configurable)
- Fusion: BM25 + Vector → Reciprocal Rank Fusion (RRF, k=60)
- Blending: Position-aware blending (optional, configurable weights)
Configuration
Place qmd.yaml next to your .sqlite file:
chunking:
size: 512
overlap: 64
embedding:
batch_size: "auto" # GPU=64, CPU=16
rerank:
enabled: false
top_k_candidates: 40
expansion:
enabled: false # Query expansion (Qwen3-0.6B)
retrieval:
rrf_k: 60
blending_mode: "pure_rerank" # or "position_aware"
Requirements
- Python >= 3.11
- GPU (optional): CUDA for accelerated embedding/reranking
License
MIT
Metadata
Release files for qmd 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| qmd-0.1.2.tar.gz | 27.6 kB | Without provenance | Details for qmd-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| qmd-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for qmd-0.1.2-py3-none-any.whl |
Total release size: 60.9 kB
Release files / qmd-0.1.2.tar.gz
| Download URL | qmd-0.1.2.tar.gz |
|---|---|
| Size | 27.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
eb25df2a3a4bd1c39cd2018c441f327b6d0a1af60d25135560de0d114b240286
|
|
BLAKE2b-256 checksum How to use checksums |
a3aa6ccce7a495881a366e3431273fa02b632abb8681b1ec7186d9dd52851ebe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.15
|
Release files / qmd-0.1.2-py3-none-any.whl
| Download URL | qmd-0.1.2-py3-none-any.whl |
|---|---|
| Size | 33.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7ace26b620a80f6504ba7509f67b90d29f4a915f8d099fa62aafbcddf8658710
|
|
BLAKE2b-256 checksum How to use checksums |
bd0a011773ed1e1931c1c2aa67e266052ae951b1f2839b86a8b7c658587dde99
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.15
|
Security for qmd 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.