[MLsys2026 Best Paper]: https://arxiv.org/abs/2506.08276. RAG on Everything with LEANN. Enjoy 97% storage savings while running a fast, accurate, and 100% private RAG application on your personal device.
Python aifaissgpt-osslangchainllama-indexllmlocalstorageoffline-firstollamaprivacypythonragretrieval-augmented-generationvector-databasevector-searchvectors
fix(sync): include .pdf in default sync extension allowlist (#394)
Wu-Yumincd9b9d49c01b
diff --git a/packages/leann-core/src/leann/sync.py b/packages/leann-core/src/leann/sync.pyindex fa04bd1..ef5a116 100644--- a/packages/leann-core/src/leann/sync.py+++ b/packages/leann-core/src/leann/sync.py@@ -14,6 +14,7 @@ DEFAULT_INDEX_EXTENSIONS: list[str] = [".md",".docx",".pptx",+ ".pdf",".py",".js",".ts",diff --git a/tests/test_sync.py b/tests/test_sync.pyindex f57971a..03c0015 100644--- a/tests/test_sync.py+++ b/tests/test_sync.py@@ -78,6 +78,34 @@ class TestFileSynchronizer(unittest.TestCase):assert len(result) == 1assert str((root / "code.py").resolve()) in result+ def test_generate_file_hashes_includes_pdf_by_default(self):+ # Regression test: PDFs are indexed by `leann build` by default, so they+ # must also be covered by the default sync allowlist. Without this, a+ # PDF-only directory yields zero hashes, detect_changes() reports no new+ # files, and the first build exits early with "Index up to date."+ with tempfile.TemporaryDirectory() as temp_dir:+ root = Path(temp_dir)+ pdf = root / "doc.pdf"+ pdf.write_bytes(b"%PDF-1.4 fake")+ fs = FileSynchronizer(root_dir=temp_dir, auto_load=False)+ result = fs.generate_file_hashes()+ assert str(pdf.resolve()) in result++ def test_detect_changes_reports_pdf_as_added_on_first_build(self):+ with tempfile.TemporaryDirectory() as temp_dir:+ root = Path(temp_dir)+ snapshot = root / "sync.pickle"+ docs = root / "docs"+ docs.mkdir()+ pdf = docs / "manual.pdf"+ pdf.write_bytes(b"%PDF-1.4 fake")++ fs = FileSynchronizer(root_dir=str(docs), snapshot_path=str(snapshot))+ added, removed, modified = fs.detect_changes()+ assert [str(pdf.resolve())] == added+ assert removed == []+ assert modified == []+def test_generate_file_hashes_explicit_files_only(self):with tempfile.TemporaryDirectory() as temp_dir:root = Path(temp_dir)