dirsql-plugin-embeddings
A first-party dirsql plugin that
adds semantic search over a directory of documents -- Markdown, plain
text, reStructuredText and PDFs. It is the worked
implementation behind the Search documents by
meaning how-to,
swapping that guide's local model2vec model for any OpenAI-compatible
/v1/embeddings endpoint.
uvx --with dirsql-plugin-embeddings dirsql
Deliberately minimal (v0.1): one embedding provider shape, one table, no chunking, no config surface beyond three environment variables.
How it works
The plugin ships a dirsql.toml fragment that dirsql discovers when the package
is installed alongside it. The fragment declares:
- the
sqlite-vecextension, forvec_distance_cosine(); - a
documentstable whoseon-filehook embeds each**/*.{md,markdown,mdx,rst,txt,pdf}file into a TEXTembeddingcolumn; - a
pre-queryhook that embeds the incoming question and emits the nearest-neighbor SQL.
Both hooks are console scripts that call the same embedder.
Every matched extension except .pdf is read as UTF-8 text; a .pdf is read with
pypdf, whose per-page extracted text is joined
and embedded like any other document. The extension check is case-insensitive
(.PDF is a PDF), though the glob above is not — globset matches case-sensitively,
so an uppercase-suffixed file needs its own glob entry to be picked up at all.
The glob is an allowlist rather than **/* for a reason worth knowing: a hook
that exits non-zero aborts the entire scan
(dirsql#697), and reading a
PNG as UTF-8 does exactly that. Matching everything would mean one image anywhere
under the root produces no index at all, so the list stays limited to what the
plugin can actually read.
A PDF that cannot be parsed aborts the scan rather than being skipped: the hook
exits non-zero and dirsql reports the path and the pypdf reason. A scanned,
image-only PDF is not a failure — pypdf yields no text, and the file is indexed
with an empty text, exactly like an empty .md.
Configuration
The embedder reads three environment variables (point them at any hosted or self-managed OpenAI-compatible inference server):
| Variable | Meaning |
|---|---|
DIRSQL_EMBEDDINGS_BASE_URL |
Base URL; /v1/embeddings is appended. |
DIRSQL_EMBEDDINGS_MODEL |
Model name sent in the request. |
DIRSQL_EMBEDDINGS_API_KEY |
Bearer token for Authorization. |
Console scripts
| Script | Hook | Input | Output |
|---|---|---|---|
dirsql-embeddings-on-file |
on-file |
a file's absolute path (argv[1]), text or PDF |
one-line JSON row array with path, text, embedding |
dirsql-embeddings-pre-query |
pre-query |
a raw request body (argv[1]) |
nearest-neighbor SQL over documents |
pre-query accepts both a verbatim server body ({"q": ...}) and the CLI
query subcommand's {"sql": <arg>} wrapper, so dirsql query '{"q": ...}' and
a real POST /query both work.
Tests
Three tiers, per the dirsql testing conventions:
- unit (colocated, mocked seams) —
src/dirsql_plugin_embeddings/*_test.py - integration (
tests/integration/) — each console script as a real subprocess against a local stub/v1/embeddingsserver - e2e (
tests/e2e/) — the full loop through the real launcher +dirsqlbinary +sqlite-vec, nothing mocked but the embedding endpoint
Metadata
Release files for dirsql-plugin-embeddings 0.1.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dirsql_plugin_embeddings-0.1.8.tar.gz | 9.9 kB | With provenance | Details for dirsql_plugin_embeddings-0.1.8.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dirsql_plugin_embeddings-0.1.8-py3-none-any.whl | Python 3 | none | any | Details for dirsql_plugin_embeddings-0.1.8-py3-none-any.whl |
Total release size: 21.4 kB
Release files / dirsql_plugin_embeddings-0.1.8.tar.gz
| Download URL | dirsql_plugin_embeddings-0.1.8.tar.gz |
|---|---|
| Size | 9.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
94476ffd4203a90854c3057dc2eba08408ea17c5ef5ae4ddebbca10975e8dcc1
|
|
BLAKE2b-256 checksum How to use checksums |
ab0f3943a07cd88b5fa8f39c45ebdceb146989140b4ecf83281e59ef3f70eba4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 29, 2026.
Transparency logRelease files / dirsql_plugin_embeddings-0.1.8-py3-none-any.whl
| Download URL | dirsql_plugin_embeddings-0.1.8-py3-none-any.whl |
|---|---|
| Size | 11.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4d37ef023c7ecbb63330c48c65ed7f7e553453da51f095b26e4356304e047529
|
|
BLAKE2b-256 checksum How to use checksums |
17d6d235cf7ee4bfa4f43e073c14a0bd8737f8362f4b00881eaf0091e26f225a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 29, 2026.
Transparency logSecurity for dirsql-plugin-embeddings 0.1.8
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for dirsql_plugin_embeddings-0.1.8.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 29, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.