dirsql-plugin-embeddings 0.1.1__tar.gz → 0.1.2__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.
- {dirsql_plugin_embeddings-0.1.1 → dirsql_plugin_embeddings-0.1.2}/.gitignore +3 -0
- {dirsql_plugin_embeddings-0.1.1 → dirsql_plugin_embeddings-0.1.2}/PKG-INFO +1 -1
- dirsql_plugin_embeddings-0.1.1/e2e-attestations/claude-open-issues-review-le8hm5-531.json → dirsql_plugin_embeddings-0.1.2/e2e-attestations/claude-on-file-integration-e2e-lpeicb.json +3 -3
- {dirsql_plugin_embeddings-0.1.1 → dirsql_plugin_embeddings-0.1.2}/pyproject.toml +1 -1
- dirsql_plugin_embeddings-0.1.2/src/dirsql_plugin_embeddings/on_file/__init__.py +11 -0
- dirsql_plugin_embeddings-0.1.2/src/dirsql_plugin_embeddings/on_file/build_rows.py +13 -0
- dirsql_plugin_embeddings-0.1.2/src/dirsql_plugin_embeddings/on_file/on_file.py +25 -0
- dirsql_plugin_embeddings-0.1.2/src/dirsql_plugin_embeddings/on_file/read_text.py +11 -0
- dirsql_plugin_embeddings-0.1.1/src/dirsql_plugin_embeddings/on_file.py +0 -33
- {dirsql_plugin_embeddings-0.1.1 → dirsql_plugin_embeddings-0.1.2}/README.md +0 -0
- {dirsql_plugin_embeddings-0.1.1 → dirsql_plugin_embeddings-0.1.2}/src/dirsql_plugin_embeddings/__init__.py +0 -0
- {dirsql_plugin_embeddings-0.1.1 → dirsql_plugin_embeddings-0.1.2}/src/dirsql_plugin_embeddings/dirsql.toml +0 -0
- {dirsql_plugin_embeddings-0.1.1 → dirsql_plugin_embeddings-0.1.2}/src/dirsql_plugin_embeddings/embedder.py +0 -0
- {dirsql_plugin_embeddings-0.1.1 → dirsql_plugin_embeddings-0.1.2}/src/dirsql_plugin_embeddings/pre_query.py +0 -0
- {dirsql_plugin_embeddings-0.1.1 → dirsql_plugin_embeddings-0.1.2}/testing-conventions.toml +0 -0
- {dirsql_plugin_embeddings-0.1.1 → dirsql_plugin_embeddings-0.1.2}/tests/conftest.py +0 -0
- {dirsql_plugin_embeddings-0.1.1 → dirsql_plugin_embeddings-0.1.2}/tests/e2e/__init__.py +0 -0
- {dirsql_plugin_embeddings-0.1.1 → dirsql_plugin_embeddings-0.1.2}/tests/integration/__init__.py +0 -0
|
@@ -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":
|
|
3
|
+
"ran_at": 1785323892,
|
|
4
4
|
"exit_code": 0,
|
|
5
|
-
"commit": "
|
|
6
|
-
"branch": "claude/
|
|
5
|
+
"commit": "35c1c6929c4a8b517032cc51e0cc6720f43b58f4",
|
|
6
|
+
"branch": "claude/on-file-integration-e2e-lpeicb"
|
|
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:
|
|
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_text import read_text
|
|
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_text(path)
|
|
24
|
+
print(json.dumps(build_rows(path, text, embed(text))))
|
|
25
|
+
return 0
|
|
@@ -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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dirsql_plugin_embeddings-0.1.1 → dirsql_plugin_embeddings-0.1.2}/tests/integration/__init__.py
RENAMED
|
File without changes
|