From 75343490959e9ad5cfcd62ba747b3646d2561765 Mon Sep 17 00:00:00 2001 From: mmprotest Date: Mon, 6 Oct 2025 08:24:01 +1100 Subject: [PATCH] Rename project metadata to raglite-sqlite --- CHANGELOG.md | 2 +- CONTRIBUTING.md | 4 ++-- README.md | 16 +++++++------- pyproject.toml | 4 +++- scripts/eval_small.py | 2 +- src/raglite/__init__.py | 2 +- src/raglite/ingest.py | 45 ++++++++++++++++++++++----------------- src/raglite/server/app.py | 2 +- 8 files changed, 43 insertions(+), 34 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ef007b1..65c2ab8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,4 +10,4 @@ - Documented architecture, limitations, and quickstart workflow with new README badges. ## 0.1.0 - 2024-05-01 -- Initial release of raglite with SQLite-backed RAG pipeline, Typer CLI, FastAPI server, and demo corpus. +- Initial release of raglite-sqlite with SQLite-backed RAG pipeline, Typer CLI, FastAPI server, and demo corpus. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1783136..b46633a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,6 +1,6 @@ -# Contributing to raglite +# Contributing to raglite-sqlite -Thank you for helping improve raglite! The project aims to provide a practical local-first RAG stack powered by SQLite. +Thank you for helping improve raglite-sqlite! The project aims to provide a practical local-first RAG stack powered by SQLite. ## Getting started diff --git a/README.md b/README.md index 9d9b11a..5a12fd9 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ -# raglite +# raglite-sqlite [![CI](https://github.com/mmprotest/raglite-sqlite/actions/workflows/ci.yml/badge.svg)](https://github.com/mmprotest/raglite-sqlite/actions/workflows/ci.yml) ![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg) ![Python: 3.10+](https://img.shields.io/badge/python-3.10%2B-blue.svg) -[![PyPI](https://img.shields.io/pypi/v/raglite.svg)](https://pypi.org/project/raglite/) +[![PyPI](https://img.shields.io/pypi/v/raglite-sqlite.svg)](https://pypi.org/project/raglite-sqlite/) Local-first retrieval augmented generation toolkit built on SQLite. Raglite bundles ingestion, chunking, hybrid BM25/vector search, Typer CLI workflows, and a FastAPI @@ -13,7 +13,7 @@ microservice. Everything runs on CPU and stores state in a single SQLite databas ```bash python -m venv .venv && source .venv/bin/activate -pip install "raglite[server]" +pip install "raglite-sqlite[server]" raglite init-db --db demo.db raglite ingest --db demo.db --path demo/mini_corpus raglite query --db demo.db --text "quick start guide" --k 5 --alpha 0.6 @@ -24,24 +24,24 @@ _On Windows use `\.venv\Scripts\activate` for step two._ ## Installation -Raglite is published as [`raglite` on PyPI](https://pypi.org/project/raglite/). Install the +Raglite is published as [`raglite-sqlite` on PyPI](https://pypi.org/project/raglite-sqlite/). Install the core toolkit with: ```bash -pip install raglite +pip install raglite-sqlite ``` To enable the optional FastAPI server, install the `server` extra: ```bash -pip install "raglite[server]" +pip install "raglite-sqlite[server]" ``` Development dependencies (linters, type checkers, packaging utilities) can be installed with the `dev` extra: ```bash -pip install "raglite[dev]" +pip install "raglite-sqlite[dev]" ``` ## Features @@ -150,7 +150,7 @@ triggers; see [`src/raglite/schema.sql`](src/raglite/schema.sql) for details. > - Best with a single writer; readers work fine with WAL mode. Remember to back up both > `*.db` and `*.db-wal` files. > - Increase α to ≥0.6 when keyword precision matters; lower it or enable rerank (with -> `raglite[rerank]`) for conversational questions. +> `raglite-sqlite[rerank]`) for conversational questions. > - Raglite is local-first—avoid ingesting secrets or PII. Use `.ragliteignore` patterns or > preprocess files to filter sensitive content. diff --git a/pyproject.toml b/pyproject.toml index 9a4ca08..cc01823 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ requires = ["setuptools>=64", "wheel"] build-backend = "setuptools.build_meta" [project] -name = "raglite" +name = "raglite-sqlite" version = "0.2.0" description = "Local-first RAG toolkit backed by a single SQLite database" readme = "README.md" @@ -88,6 +88,8 @@ known_first_party = ["raglite"] [tool.ruff] line-length = 100 + +[tool.ruff.lint] select = ["E", "F", "I", "B"] [tool.mypy] diff --git a/scripts/eval_small.py b/scripts/eval_small.py index 095290f..b49fb54 100755 --- a/scripts/eval_small.py +++ b/scripts/eval_small.py @@ -170,7 +170,7 @@ def main(argv: Sequence[str] | None = None) -> int: if rerank_available(): metrics.append(evaluate_variant(api, cases, alpha=args.alpha, rerank=True)) else: - print("(Hybrid+Rerank skipped: install raglite[rerank] to enable)") + print("(Hybrid+Rerank skipped: install raglite-sqlite[rerank] to enable)") print_table(metrics) if tmp_dir is not None: diff --git a/src/raglite/__init__.py b/src/raglite/__init__.py index 9103b82..4213bb2 100644 --- a/src/raglite/__init__.py +++ b/src/raglite/__init__.py @@ -6,7 +6,7 @@ from .config import RagliteConfig try: - __version__ = importlib_metadata.version("raglite") + __version__ = importlib_metadata.version("raglite-sqlite") except importlib_metadata.PackageNotFoundError: # pragma: no cover - fallback for dev installs __version__ = "0.0.0" diff --git a/src/raglite/ingest.py b/src/raglite/ingest.py index 599a104..fc81eeb 100644 --- a/src/raglite/ingest.py +++ b/src/raglite/ingest.py @@ -7,6 +7,7 @@ import sqlite3 from dataclasses import dataclass from pathlib import Path +from types import ModuleType from typing import Iterator, List, Sequence, Tuple from . import chunk as chunk_utils @@ -15,26 +16,35 @@ from .embed import get_embedding_store try: - from readability import Document + import readability as _readability except Exception: # pragma: no cover - optional dependency - Document = None + readability: ModuleType | None = None +else: + readability = _readability try: - from bs4 import BeautifulSoup + import bs4 as _bs4 except Exception: # pragma: no cover - optional dependency - BeautifulSoup = None + bs4: ModuleType | None = None +else: + bs4 = _bs4 try: - from pypdf import PdfReader + import pypdf as _pypdf except Exception: # pragma: no cover - optional dependency - PdfReader = None + pypdf: ModuleType | None = None +else: + pypdf = _pypdf try: # optional OCR - import pytesseract - from PIL import Image + import pytesseract as _pytesseract + from PIL import Image as _Image except Exception: # pragma: no cover - optional dependency - pytesseract = None - Image = None + pytesseract: ModuleType | None = None + Image: ModuleType | None = None +else: + pytesseract = _pytesseract + Image = _Image @dataclass @@ -80,26 +90,23 @@ def read_text_file(path: Path) -> str: def read_html_file(path: Path) -> str: html = path.read_text(encoding="utf-8", errors="ignore") - if Document is None or BeautifulSoup is None: + if readability is None or bs4 is None: return html - doc = Document(html) + doc = readability.Document(html) summary = doc.summary() - soup = BeautifulSoup(summary, "html.parser") + soup = bs4.BeautifulSoup(summary, "html.parser") return soup.get_text(" ") def read_pdf_file(path: Path, *, ocr: bool = False) -> str: - if PdfReader is None: + if pypdf is None: raise UnsupportedDocument("pypdf is required to read PDF files") - reader = PdfReader(str(path)) + reader = pypdf.PdfReader(str(path)) texts: List[str] = [] for page in reader.pages: text = page.extract_text() or "" if not text.strip() and ocr and pytesseract and Image: - try: - images = page.images - except AttributeError: # pragma: no cover - images = [] + images = list(getattr(page, "images", [])) for image in images: try: img = Image.open(image.data) diff --git a/src/raglite/server/app.py b/src/raglite/server/app.py index a3b49ab..32afd07 100644 --- a/src/raglite/server/app.py +++ b/src/raglite/server/app.py @@ -10,7 +10,7 @@ from fastapi import FastAPI, HTTPException from pydantic import BaseModel except Exception as exc: # pragma: no cover - optional dependency - raise RuntimeError("Install raglite[server] to use the FastAPI app") from exc + raise RuntimeError("Install raglite-sqlite[server] to use the FastAPI app") from exc from ..api import RagliteAPI from ..config import RagliteConfig