dirsql-plugin-embeddings 0.1.15__tar.gz → 0.1.17__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. {dirsql_plugin_embeddings-0.1.15 → dirsql_plugin_embeddings-0.1.17}/PKG-INFO +6 -1
  2. {dirsql_plugin_embeddings-0.1.15 → dirsql_plugin_embeddings-0.1.17}/README.md +5 -0
  3. dirsql_plugin_embeddings-0.1.17/changelog.d/2026-08-12-null-embedding-guard.md +3 -0
  4. dirsql_plugin_embeddings-0.1.17/changelog.d/2026-08-12-worker-semaphore-leak.md +1 -0
  5. dirsql_plugin_embeddings-0.1.17/e2e-attestations/claude-815-loky-semaphore.json +7 -0
  6. dirsql_plugin_embeddings-0.1.17/e2e-attestations/claude-817-null-embedding-guard.json +7 -0
  7. dirsql_plugin_embeddings-0.1.17/src/dirsql_plugin_embeddings/embedding/progress.py +24 -0
  8. {dirsql_plugin_embeddings-0.1.15 → dirsql_plugin_embeddings-0.1.17}/src/dirsql_plugin_embeddings/search/sql.py +5 -0
  9. dirsql_plugin_embeddings-0.1.15/src/dirsql_plugin_embeddings/embedding/progress.py +0 -13
  10. {dirsql_plugin_embeddings-0.1.15 → dirsql_plugin_embeddings-0.1.17}/.gitignore +0 -0
  11. {dirsql_plugin_embeddings-0.1.15 → dirsql_plugin_embeddings-0.1.17}/changelog.d/2026-08-10-delete-old-surface.md +0 -0
  12. {dirsql_plugin_embeddings-0.1.15 → dirsql_plugin_embeddings-0.1.17}/changelog.d/2026-08-10-embed-worker.md +0 -0
  13. {dirsql_plugin_embeddings-0.1.15 → dirsql_plugin_embeddings-0.1.17}/changelog.d/2026-08-11-one-liner-cli.md +0 -0
  14. {dirsql_plugin_embeddings-0.1.15 → dirsql_plugin_embeddings-0.1.17}/changelog.d/2026-08-12-empty-search-reports-why.md +0 -0
  15. {dirsql_plugin_embeddings-0.1.15 → dirsql_plugin_embeddings-0.1.17}/changelog.d/2026-08-12-no-per-call-progress-bar.md +0 -0
  16. {dirsql_plugin_embeddings-0.1.15 → dirsql_plugin_embeddings-0.1.17}/e2e-attestations/claude-804-embed-worker.json +0 -0
  17. {dirsql_plugin_embeddings-0.1.15 → dirsql_plugin_embeddings-0.1.17}/e2e-attestations/claude-805-one-liner.json +0 -0
  18. {dirsql_plugin_embeddings-0.1.15 → dirsql_plugin_embeddings-0.1.17}/e2e-attestations/claude-814-suppress-per-call-progress.json +0 -0
  19. {dirsql_plugin_embeddings-0.1.15 → dirsql_plugin_embeddings-0.1.17}/e2e-attestations/claude-816-empty-corpus-error.json +0 -0
  20. {dirsql_plugin_embeddings-0.1.15 → dirsql_plugin_embeddings-0.1.17}/migrations.d/2026-08-10-delete-old-surface.md +0 -0
  21. {dirsql_plugin_embeddings-0.1.15 → dirsql_plugin_embeddings-0.1.17}/pyproject.toml +0 -0
  22. {dirsql_plugin_embeddings-0.1.15 → dirsql_plugin_embeddings-0.1.17}/src/dirsql_plugin_embeddings/__init__.py +0 -0
  23. {dirsql_plugin_embeddings-0.1.15 → dirsql_plugin_embeddings-0.1.17}/src/dirsql_plugin_embeddings/cli/__init__.py +0 -0
  24. {dirsql_plugin_embeddings-0.1.15 → dirsql_plugin_embeddings-0.1.17}/src/dirsql_plugin_embeddings/cli/main.py +0 -0
  25. {dirsql_plugin_embeddings-0.1.15 → dirsql_plugin_embeddings-0.1.17}/src/dirsql_plugin_embeddings/cli/search.py +0 -0
  26. {dirsql_plugin_embeddings-0.1.15 → dirsql_plugin_embeddings-0.1.17}/src/dirsql_plugin_embeddings/cli/worker.py +0 -0
  27. {dirsql_plugin_embeddings-0.1.15 → dirsql_plugin_embeddings-0.1.17}/src/dirsql_plugin_embeddings/dirsql.toml +0 -0
  28. {dirsql_plugin_embeddings-0.1.15 → dirsql_plugin_embeddings-0.1.17}/src/dirsql_plugin_embeddings/embedding/__init__.py +0 -0
  29. {dirsql_plugin_embeddings-0.1.15 → dirsql_plugin_embeddings-0.1.17}/src/dirsql_plugin_embeddings/embedding/cache.py +0 -0
  30. {dirsql_plugin_embeddings-0.1.15 → dirsql_plugin_embeddings-0.1.17}/src/dirsql_plugin_embeddings/embedding/model.py +0 -0
  31. {dirsql_plugin_embeddings-0.1.15 → dirsql_plugin_embeddings-0.1.17}/src/dirsql_plugin_embeddings/embedding/values.py +0 -0
  32. {dirsql_plugin_embeddings-0.1.15 → dirsql_plugin_embeddings-0.1.17}/src/dirsql_plugin_embeddings/embedding/worker.py +0 -0
  33. {dirsql_plugin_embeddings-0.1.15 → dirsql_plugin_embeddings-0.1.17}/src/dirsql_plugin_embeddings/search/__init__.py +0 -0
  34. {dirsql_plugin_embeddings-0.1.15 → dirsql_plugin_embeddings-0.1.17}/src/dirsql_plugin_embeddings/search/output.py +0 -0
  35. {dirsql_plugin_embeddings-0.1.15 → dirsql_plugin_embeddings-0.1.17}/src/dirsql_plugin_embeddings/search/run.py +0 -0
  36. {dirsql_plugin_embeddings-0.1.15 → dirsql_plugin_embeddings-0.1.17}/testing-conventions.toml +0 -0
  37. {dirsql_plugin_embeddings-0.1.15 → dirsql_plugin_embeddings-0.1.17}/tests/conftest.py +0 -0
  38. {dirsql_plugin_embeddings-0.1.15 → dirsql_plugin_embeddings-0.1.17}/tests/e2e/__init__.py +0 -0
  39. {dirsql_plugin_embeddings-0.1.15 → dirsql_plugin_embeddings-0.1.17}/tests/integration/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: dirsql-plugin-embeddings
3
- Version: 0.1.15
3
+ Version: 0.1.17
4
4
  Summary: First-party dirsql plugin: semantic search over files.
5
5
  Requires-Python: >=3.10
6
6
  Requires-Dist: cachetta>=0.7
@@ -26,10 +26,15 @@ uvx --with dirsql-plugin-embeddings dirsql "
26
26
  SELECT path
27
27
  FROM (SELECT path, embed(content ->> 'abstract') AS emb
28
28
  FROM './arxiv-firehose/data/**/metadata.json')
29
+ WHERE emb IS NOT NULL
29
30
  ORDER BY vec_distance_cosine(emb, embed('local private models'))
30
31
  LIMIT 10"
31
32
  ```
32
33
 
34
+ `WHERE emb IS NOT NULL` is not optional bookkeeping: a file that is unreadable
35
+ or not valid UTF-8 has NULL content, so its distance is NULL, and SQLite sorts
36
+ NULLs *first* ascending — without the guard those files take the top slots.
37
+
33
38
  For the common case — one glob, one question, top-k paths — the package is
34
39
  also its own command, generating and running exactly that SQL:
35
40
 
@@ -13,10 +13,15 @@ uvx --with dirsql-plugin-embeddings dirsql "
13
13
  SELECT path
14
14
  FROM (SELECT path, embed(content ->> 'abstract') AS emb
15
15
  FROM './arxiv-firehose/data/**/metadata.json')
16
+ WHERE emb IS NOT NULL
16
17
  ORDER BY vec_distance_cosine(emb, embed('local private models'))
17
18
  LIMIT 10"
18
19
  ```
19
20
 
21
+ `WHERE emb IS NOT NULL` is not optional bookkeeping: a file that is unreadable
22
+ or not valid UTF-8 has NULL content, so its distance is NULL, and SQLite sorts
23
+ NULLs *first* ascending — without the guard those files take the top slots.
24
+
20
25
  For the common case — one glob, one question, top-k paths — the package is
21
26
  also its own command, generating and running exactly that SQL:
22
27
 
@@ -0,0 +1,3 @@
1
+ **Fixed**
2
+
3
+ - **Files that cannot be embedded no longer take the top of the ranking (and no longer break the search).** A matched file that is unreadable, not valid UTF-8, or deleted mid-scan has NULL `content`, so `embed(content)` is NULL — and SQLite sorts NULLs *first* ascending, so those files occupied the top-k slots before anything else went wrong. The generated search SQL now carries `WHERE emb IS NOT NULL`, which fixes the ranking and the failure it led to (a `TypeError` formatting a NULL distance, or, depending on the sqlite-vec build, `Error reading 1st vector: ... found NULL` from SQLite itself). The documented hand-written idiom carries the same guard. (#817)
@@ -0,0 +1 @@
1
+ **Fixed** the `resource_tracker: There appear to be 1 leaked semaphore objects to clean up at shutdown: {'/loky-…'}` warning that every embedding run printed on stderr. model2vec's encode loop constructs a (disabled) tqdm bar whose default write lock allocates a multiprocessing semaphore, and the dirsql core tears the worker down with a kill, so the semaphore was never released. The worker now installs a process-local tqdm write lock at startup, so no semaphore exists to leak.
@@ -0,0 +1,7 @@
1
+ {
2
+ "command": "uv run --with-editable ../../packages/python --with-editable . python -m pytest tests/e2e -q",
3
+ "ran_at": 1786559931,
4
+ "exit_code": 0,
5
+ "commit": "b63619a59bf6138234daa5c08d2e29981729642d",
6
+ "branch": "claude/815-loky-semaphore"
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "command": "uv run --with-editable ../../packages/python python -m pytest tests/e2e/ -x -q",
3
+ "ran_at": 1786558054,
4
+ "exit_code": 0,
5
+ "commit": "f1af2bf7bf4c21dd62350b48b4d441356047ef59",
6
+ "branch": "claude/817-null-embedding-guard"
7
+ }
@@ -0,0 +1,24 @@
1
+ import os
2
+ import sys
3
+ import threading
4
+
5
+ from tqdm import tqdm
6
+
7
+
8
+ def stderr_is_tty():
9
+ return sys.stderr.isatty()
10
+
11
+
12
+ def configure():
13
+ # Hugging Face hub download bars honor this variable; setdefault keeps an
14
+ # explicit user choice in force.
15
+ if not stderr_is_tty():
16
+ os.environ.setdefault("HF_HUB_DISABLE_PROGRESS_BARS", "1")
17
+ # tqdm's first bar (model2vec's encode loop constructs one even when
18
+ # disabled) lazily allocates a multiprocessing RLock -- a named semaphore
19
+ # registered with the resource tracker. The dirsql core tears this worker
20
+ # down with a kill, not a graceful exit, so that semaphore is never
21
+ # unregistered and the tracker prints a "leaked semaphore" warning after
22
+ # every run. A single worker process needs no cross-process bar
23
+ # coordination: a process-local lock means no semaphore exists at all.
24
+ tqdm.set_lock(threading.RLock())
@@ -25,9 +25,14 @@ def embed_call(argument, model):
25
25
  def build_search_sql(glob, query, limit, model=None):
26
26
  outer = embed_call(quote(query), model)
27
27
  inner = embed_call("content", model)
28
+ # A matched file that is unreadable, not valid UTF-8, or deleted mid-scan
29
+ # has NULL content, so its embedding is NULL too. Dropping those rows is
30
+ # what keeps the ranking honest: a NULL distance sorts FIRST ascending in
31
+ # SQLite, so unrankable files would otherwise take the top-k slots.
28
32
  return (
29
33
  f"SELECT path, vec_distance_cosine(emb, {outer}) AS distance"
30
34
  f" FROM (SELECT path, {inner} AS emb FROM {quote(normalize_glob(glob))})"
35
+ f" WHERE emb IS NOT NULL"
31
36
  f" ORDER BY distance LIMIT {int(limit):d}"
32
37
  )
33
38
 
@@ -1,13 +0,0 @@
1
- import os
2
- import sys
3
-
4
-
5
- def stderr_is_tty():
6
- return sys.stderr.isatty()
7
-
8
-
9
- def configure():
10
- # Hugging Face hub download bars honor this variable; setdefault keeps an
11
- # explicit user choice in force.
12
- if not stderr_is_tty():
13
- os.environ.setdefault("HF_HUB_DISABLE_PROGRESS_BARS", "1")