dirsql-plugin-embeddings 0.1.1__tar.gz → 0.1.3__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 (19) hide show
  1. {dirsql_plugin_embeddings-0.1.1 → dirsql_plugin_embeddings-0.1.3}/.gitignore +3 -0
  2. {dirsql_plugin_embeddings-0.1.1 → dirsql_plugin_embeddings-0.1.3}/PKG-INFO +1 -1
  3. dirsql_plugin_embeddings-0.1.1/e2e-attestations/claude-open-issues-review-le8hm5-531.json → dirsql_plugin_embeddings-0.1.3/e2e-attestations/claude-on-file-integration-e2e-lpeicb-read-content.json +3 -3
  4. {dirsql_plugin_embeddings-0.1.1 → dirsql_plugin_embeddings-0.1.3}/pyproject.toml +1 -1
  5. dirsql_plugin_embeddings-0.1.3/src/dirsql_plugin_embeddings/on_file/__init__.py +11 -0
  6. dirsql_plugin_embeddings-0.1.3/src/dirsql_plugin_embeddings/on_file/build_rows.py +13 -0
  7. dirsql_plugin_embeddings-0.1.3/src/dirsql_plugin_embeddings/on_file/on_file.py +25 -0
  8. dirsql_plugin_embeddings-0.1.3/src/dirsql_plugin_embeddings/on_file/read_content.py +13 -0
  9. dirsql_plugin_embeddings-0.1.3/src/dirsql_plugin_embeddings/on_file/read_text.py +11 -0
  10. dirsql_plugin_embeddings-0.1.1/src/dirsql_plugin_embeddings/on_file.py +0 -33
  11. {dirsql_plugin_embeddings-0.1.1 → dirsql_plugin_embeddings-0.1.3}/README.md +0 -0
  12. {dirsql_plugin_embeddings-0.1.1 → dirsql_plugin_embeddings-0.1.3}/src/dirsql_plugin_embeddings/__init__.py +0 -0
  13. {dirsql_plugin_embeddings-0.1.1 → dirsql_plugin_embeddings-0.1.3}/src/dirsql_plugin_embeddings/dirsql.toml +0 -0
  14. {dirsql_plugin_embeddings-0.1.1 → dirsql_plugin_embeddings-0.1.3}/src/dirsql_plugin_embeddings/embedder.py +0 -0
  15. {dirsql_plugin_embeddings-0.1.1 → dirsql_plugin_embeddings-0.1.3}/src/dirsql_plugin_embeddings/pre_query.py +0 -0
  16. {dirsql_plugin_embeddings-0.1.1 → dirsql_plugin_embeddings-0.1.3}/testing-conventions.toml +0 -0
  17. {dirsql_plugin_embeddings-0.1.1 → dirsql_plugin_embeddings-0.1.3}/tests/conftest.py +0 -0
  18. {dirsql_plugin_embeddings-0.1.1 → dirsql_plugin_embeddings-0.1.3}/tests/e2e/__init__.py +0 -0
  19. {dirsql_plugin_embeddings-0.1.1 → dirsql_plugin_embeddings-0.1.3}/tests/integration/__init__.py +0 -0
@@ -56,3 +56,6 @@ docs/playwright-report/
56
56
  docs/blob-report/
57
57
  docs/.playwright/
58
58
  actionlint
59
+
60
+ # cargo-mutants run output (never commit)
61
+ mutants.out/
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dirsql-plugin-embeddings
3
- Version: 0.1.1
3
+ Version: 0.1.3
4
4
  Summary: First-party dirsql plugin: semantic search via an OpenAI-compatible embeddings endpoint.
5
5
  Requires-Python: >=3.11
6
6
  Description-Content-Type: text/markdown
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "command": "uv run --with sqlite-vec --with-editable . --with-editable ../../packages/python python -m pytest tests/e2e -x -q",
3
- "ran_at": 1784022840,
3
+ "ran_at": 1785324484,
4
4
  "exit_code": 0,
5
- "commit": "5f6caffd4996dfdf09cf798c1deb55f6e216fde5",
6
- "branch": "claude/open-issues-review-le8hm5-531"
5
+ "commit": "e8600a3672b0ecd9c604c3c22ecc5be49adc5df5",
6
+ "branch": "claude/on-file-integration-e2e-lpeicb-read-content"
7
7
  }
@@ -39,7 +39,7 @@ git_describe_command = ["git", "describe", "--dirty", "--tags", "--long", "--mat
39
39
  [project.scripts]
40
40
  # The two command hooks the fragment invokes; installing the package puts them
41
41
  # on PATH so `dirsql` resolves them when it spawns the hooks.
42
- dirsql-embeddings-on-file = "dirsql_plugin_embeddings.on_file:main"
42
+ dirsql-embeddings-on-file = "dirsql_plugin_embeddings.on_file:on_file"
43
43
  dirsql-embeddings-pre-query = "dirsql_plugin_embeddings.pre_query:main"
44
44
 
45
45
  [project.entry-points.dirsql]
@@ -0,0 +1,11 @@
1
+ """``on-file`` console script: embed one matched file into a dirsql row.
2
+
3
+ The package barrel: ``pyproject.toml`` points the ``dirsql-embeddings-on-file``
4
+ script at ``dirsql_plugin_embeddings.on_file:on_file``, which resolves here, so
5
+ this re-export is the shipped command's public surface -- moving the callable
6
+ between modules is free, dropping it from ``__all__`` breaks the install.
7
+ """
8
+
9
+ from .on_file import on_file
10
+
11
+ __all__ = ["on_file"]
@@ -0,0 +1,13 @@
1
+ """Shape one embedded file into the command hook's row array.
2
+
3
+ Annotations are evaluated at runtime (no ``from __future__ import
4
+ annotations``) so a mutated ``X | None`` union in a signature fails at import
5
+ rather than surviving as an inert string.
6
+ """
7
+
8
+ import json
9
+
10
+
11
+ def build_rows(path: str, text: str, vector: list[float]) -> list[dict]:
12
+ # The embedding is stored as JSON text, which `sqlite-vec` accepts directly.
13
+ return [{"path": path, "text": text, "embedding": json.dumps(vector)}]
@@ -0,0 +1,25 @@
1
+ """The ``on-file`` hook entry point.
2
+
3
+ Reads the file at ``argv[1]``, embeds its text, and prints a one-line JSON row
4
+ array (``path``, ``text``, ``embedding``).
5
+
6
+ Annotations are evaluated at runtime (no ``from __future__ import
7
+ annotations``) so a mutated ``X | None`` union in a signature fails at import
8
+ rather than surviving as an inert string.
9
+ """
10
+
11
+ import json
12
+ import sys
13
+
14
+ from ..embedder import embed
15
+ from .build_rows import build_rows
16
+ from .read_content import read_content
17
+
18
+
19
+ def on_file(argv: list[str] | None = None) -> int:
20
+ if argv is None:
21
+ argv = sys.argv
22
+ path = argv[1]
23
+ text = read_content(path)
24
+ print(json.dumps(build_rows(path, text, embed(text))))
25
+ return 0
@@ -0,0 +1,13 @@
1
+ """The entry point's single read seam: everything the hook reads comes through
2
+ here, so per-format handling has one place to land without touching `on_file`.
3
+
4
+ Annotations are evaluated at runtime (no ``from __future__ import
5
+ annotations``) so a mutated ``X | None`` union in a signature fails at import
6
+ rather than surviving as an inert string.
7
+ """
8
+
9
+ from .read_text import read_text
10
+
11
+
12
+ def read_content(path: str) -> str:
13
+ return read_text(path)
@@ -0,0 +1,11 @@
1
+ """Read the matched file's text off disk.
2
+
3
+ Annotations are evaluated at runtime (no ``from __future__ import
4
+ annotations``) so a mutated ``X | None`` union in a signature fails at import
5
+ rather than surviving as an inert string.
6
+ """
7
+
8
+
9
+ def read_text(path: str) -> str:
10
+ with open(path, encoding="utf-8") as handle:
11
+ return handle.read()
@@ -1,33 +0,0 @@
1
- """``on-file`` console script: embed one matched file into a dirsql row.
2
-
3
- Reads the file at ``argv[1]``, embeds its text, and prints a one-line JSON row
4
- array (``path``, ``text``, ``embedding``) -- the embedding stored as JSON text,
5
- which ``sqlite-vec`` accepts directly.
6
-
7
- Annotations are evaluated at runtime (no ``from __future__ import annotations``)
8
- so a mutated ``X | None`` union in a signature fails at import rather than
9
- surviving as an inert string.
10
- """
11
-
12
- import json
13
- import sys
14
-
15
- from .embedder import embed
16
-
17
-
18
- def _read_text(path: str) -> str:
19
- with open(path, encoding="utf-8") as handle:
20
- return handle.read()
21
-
22
-
23
- def build_rows(path: str, text: str, vector: list[float]) -> list[dict]:
24
- return [{"path": path, "text": text, "embedding": json.dumps(vector)}]
25
-
26
-
27
- def main(argv: list[str] | None = None) -> int:
28
- if argv is None:
29
- argv = sys.argv
30
- path = argv[1]
31
- text = _read_text(path)
32
- print(json.dumps(build_rows(path, text, embed(text))))
33
- return 0