Zimantic
Zimantic is an offline search engine for Kiwix ZIM files and configured directory trees, such as an offline /library/www/html/modules. Semantic search finds articles from questions and descriptions, including misspellings and queries in another language. Zimantic runs offline on devices as small as a Raspberry Pi Zero 2 W.
Semantic search performs best in widely spoken languages. Coverage varies by language; see Compared with Kiwix search.
| Query | Kiwix search | Zimantic |
|---|---|---|
| "what causes lockjaw" | Tetanus not in the top 20 | Tetanus at #1 |
| "diabetis" (misspelled) | Diabetes not in the top 20 | Diabetes at #1 |
| "糖尿病" (Chinese for "diabetes") | Diabetes not in the top 20 | Diabetes at #1 |
Searched in WikiMed, the Wikipedia medical encyclopedia ZIM.
Features
- Semantic search matches articles from questions and descriptions, even when the query and title share no words.
- Alternate names and misspellings work: "diabetis" finds Diabetes, and "Leber's disease" finds Leber's hereditary optic neuropathy.
- Multilingual queries use one model that covers more than 100 languages. A query in one language can find articles written in another. Results are strongest in widely used languages; see Compared with Kiwix search.
- Collections and sources provide several scopes. Browse the library by collection and provider, search one collection as a unit, or combine individual sources. See Source selection.
- Files collections search and serve a configured directory tree, such as an offline copy of
/library/www/html/modules, as one bounded collection. See Files collections. - Kolibri installations are searched and served directly. Each installed channel is one collection, and each top-level topic is one source. See Kolibri installations.
- Combined ranking orders semantic, title, and full-text results together. The full-text list combines SQLite body search with archive-native search when available.
- Merged results collapse redirects into their target article, so each article appears once. Each result carries a bounded excerpt as its preview.
- Progressive results run sources in parallel. The page shows a provisional merged list as each source finishes, then reranks it deterministically.
- The library view at
/libraryshows ZIM collections, files collections, Kolibri channels, and remote Kiwix books, grouped by collection with provider and media-type filters. See Library view. - Low resource use supports devices such as a Raspberry Pi Zero 2 W (512 MB RAM), which uses about 250–325 MB while serving. See Measured memory use.
- Search without vectors uses the indexes that exist. Title and body search work when their indexes exist. A ZIM without a Zimantic index can use its archive full-text index. If a model or FAISS file is unavailable, or model probes do not match, Zimantic uses the available lexical search. An invalid archive full-text index affects only that archive; the server logs the error and continues. Use
zimantic diagnoseto check suspect files without affecting the server. - Concurrent searches are bounded by
max_concurrent_searches. A request waits up toslot_wait_secondsfor a free slot before it reports busy, so overlapping searches queue on slow hardware instead of failing immediately. An abandoned browser stream skips queued source work and returns its slot. Identical in-flight queries share one computation. An in-memory cache bounded bycache_sizeandcache_bytesanswers repeated queries. Explicit source and collection scopes are cached by their expanded source keys and publication generation. See Source selection. - Built-in article serving opens result links directly from the ZIM archives, including redirects, assets, and each ZIM's homepage, without
kiwix-serve. - The web interface and JSON API support browsers and custom programs. Routes use short paths such as
/search,/suggest,/library,/collections.json,/content/<source-key>/<path>,/article/<source-key>/<path>, and/health.
Zimantic searches local ZIM archives directly and does not need a separate Kiwix index. zimantic build creates semantic vectors and a SQLite title index. zimantic serve also searches an unbuilt ZIM through its archive full-text index. Zimantic serves articles, assets, and homepages directly from each archive. Use kiwix-serve only for remote Kiwix sources.
Requirements
- Python 3.11–3.14 with native dependency wheels available for the interpreter.
libzimpublishes wheels for specific Python ABIs and platforms, so select an interpreter with a compatible wheel. Update this range when the native dependencies support a newer Python version. - On 32-bit Linux platforms (armhf/armv7), the native dependencies have no prebuilt wheels. They work as distribution packages. Debian 13 (trixie) or newer provides
python3-onnxruntime,python3-faiss,python3-libzim,python3-sentencepiece, andpython3-pymupdffor armhf. Create the environment with--system-site-packagesso Zimantic can use them. Known 32-bit machine names accept python-libzim 3 or newer; other machines require 4.1 or newer. Python package markers report the machine name, not interpreter bitness, so a 32-bit interpreter that reports a 64-bit machine name requires 4.1. - About 120 MB for the default embedding model, plus the ZIM files. The English-only
e5-small-v2model is about 35 MB on disk. - Wikipedia-style ZIM files. Zimantic relies on their predictable HTML structure to locate useful content blocks.
- One provider seam covers ZIM, remote Kiwix, files, and Kolibri. Source identity is a stable, URL-safe
key;provideris the only discriminator. - Configured collections are declared with
[[collections]]entries for ZIM roots, Kiwix servers, files trees, and Kolibri installations. - Local sources do not need
kiwix-serve. A Kiwix[[collections]]entry discovers remote books and opens their results through links returned by the kiwix-serve search API.
Install
-
Clone the repository into the data directory. Configuration lives at
$XDG_CONFIG_HOME/zimantic/config.toml(normally~/.config/zimantic/config.toml); omitted settings use hardware and XDG defaults.data_home="${XDG_DATA_HOME:-$HOME/.local/share}" config_home="${XDG_CONFIG_HOME:-$HOME/.config}" mkdir -p "$data_home" "$config_home/zimantic" git clone https://github.com/OscSanto/zimantic.git "$data_home/zimantic" cd "$data_home/zimantic" if [ ! -e "$config_home/zimantic/config.toml" ]; then cp config.toml "$config_home/zimantic/config.toml" fi
-
Install the CLI with uv. This command installs the locked runtime dependencies without the development tools and creates the executable at
~/.local/bin/zimantic.uv sync --locked --no-dev --no-editable ln -sfn "$PWD/.venv/bin/zimantic" ~/.local/bin/zimantic
For development, run
uv syncand activate the environment with. .venv/bin/activate.On 32-bit armhf, where the native dependencies have no wheels, install the distribution packages and let the environment use them:
sudo apt install python3-venv python3-numpy python3-tqdm python3-onnxruntime \ python3-sentencepiece python3-faiss python3-libzim python3-pymupdf \ python3-fastapi python3-uvicorn python3 -m venv --system-site-packages .venv .venv/bin/pip install 'puremagic>=1.30' .venv/bin/pip install --no-deps . ln -sfn "$PWD/.venv/bin/zimantic" ~/.local/bin/zimantic
-
Download the default multilingual model.
zimantic modelThe command downloads the int8 export to
$XDG_DATA_HOME/zimantic/model/int8/model.onnxand its tokenizer vocabulary. On a GPU host, usezimantic model fp16instead; fp16 is faster on CUDA, ROCm, DirectML, and OpenVINO, while int8 is the smallest CPU-oriented default. Setmodel_dir = "model/fp16"in the XDG config in that case.zimantic model --listshows the other supported e5 models, andzimantic model --helpshows the options. To download manually:data_home="${XDG_DATA_HOME:-$HOME/.local/share}" mkdir -p "$data_home/zimantic/model/int8" curl -L -o "$data_home/zimantic/model/int8/model.onnx" https://huggingface.co/Xenova/multilingual-e5-small/resolve/main/onnx/model_quantized.onnx curl -L -o "$data_home/zimantic/model/int8/sentencepiece.bpe.model" https://huggingface.co/intfloat/multilingual-e5-small/resolve/main/sentencepiece.bpe.model
English-only and larger multilingual models use the same layout; see Using a different embedding model. Zimantic warns when
model.onnxorsentencepiece.bpe.modeldiffers from a documented checksum, but continues to run. -
Put ZIM files in
$XDG_DATA_HOME/zimantic/zims/. Download them from library.kiwix.org or download.kiwix.org/zim. -
Add a collection and check the XDG config. There is no implicit library, so uncomment or add the
[[collections]]ZIM entry fromconfig.toml. Use an absolutepath, because provider paths resolve from the config file's directory. Relativemodel_dirandindex_diroverrides resolve under$XDG_DATA_HOME/zimantic; omit them to use the defaults. Add Kiwix, files, or Kolibri entries only for those sources. -
Verify the installation.
zimantic --helpFor a development runtime check, follow Development install and run
python -m pytest tests/test_runtime_api.py. Usepython -m pytestfor the full suite.
Windows
Zimantic supports 64-bit Windows (x86-64) on Python 3.11–3.14. Windows ARM64 and 32-bit Windows are not supported because libzim, faiss-cpu, and onnxruntime do not publish wheels for those targets.
Use these Windows equivalents:
git clone https://github.com/OscSanto/zimantic.git zimantic
cd zimantic
uv sync --locked --no-dev
.venv\Scripts\activate
zimantic --help
Download the default model with the CLI:
zimantic model
On Windows, the default model_dir is ./model/int8. On a GPU host, use zimantic model fp16 and set model_dir = "./model/fp16" in config.toml. To download the int8 model manually:
New-Item -ItemType Directory -Force model\int8 | Out-Null
Invoke-WebRequest -Uri https://huggingface.co/Xenova/multilingual-e5-small/resolve/main/onnx/model_quantized.onnx -OutFile model\int8\model.onnx
Invoke-WebRequest -Uri https://huggingface.co/intfloat/multilingual-e5-small/resolve/main/sentencepiece.bpe.model -OutFile model\int8\sentencepiece.bpe.model
zimantic reload is unavailable on Windows because it relies on SIGHUP. Restart zimantic serve to reload. Stop the server before you replace or delete a ZIM or index file. Windows does not allow an open file to be replaced in place.
Optional dependencies
Core search does not require external tools. Local caption extraction, OCR, ASR, and remote Kiwix support are optional; see the dependency and derived-text guide.
Configuration and collections
Zimantic uses explicit [[collections]] entries for ZIM archives, remote Kiwix, files trees, and Kolibri installations. The collections guide has minimal examples, path behavior, provider limits, and advanced overrides.
Usage
zimantic build
zimantic serve
zimantic open zims/example.zim
zimantic reload
A build with no arguments indexes configured local collections. For command options, build behavior, GPU setup, hardware tuning, and systemd examples, see Usage and operations. The web interface guide covers source selection and the library. The API reference documents the HTTP endpoints.
Security and limitations
See Limitations for operational constraints and Architecture for provider boundaries and content safety.
Search details
The search examples in this README are a brief illustration, not a universal benchmark. See Search, models, and ranking for model selection, ranking behavior, measured performance, and the detailed Kiwix comparison.
Metadata
Release files for zimantic 1.0.2
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 |
|---|---|---|---|---|
| zimantic-1.0.2.tar.gz | 1.0 MB | Without provenance | Details for zimantic-1.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| zimantic-1.0.2-py3-none-any.whl | Python 3 | none | any | Details for zimantic-1.0.2-py3-none-any.whl |
Total release size: 1.9 MB
Release files / zimantic-1.0.2.tar.gz
| Download URL | zimantic-1.0.2.tar.gz |
|---|---|
| Size | 1.0 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7632a705245ad41192e5e6f18a508dade6a9d91911706e04bb2d20f8bf4a09d2
|
|
BLAKE2b-256 checksum How to use checksums |
318e719a0d3041dde7fd82963e2caccbe211728f7d3c25066d808b8cffe585b1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / zimantic-1.0.2-py3-none-any.whl
| Download URL | zimantic-1.0.2-py3-none-any.whl |
|---|---|
| Size | 905.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
55a07e7b67303ff17bed683c8423a1d12ff40869f89c014f8b00b5c29ee167a9
|
|
BLAKE2b-256 checksum How to use checksums |
7c8d0bc65b66fcd6fb88ff8eed3ff1cfa30fc48336d100095a6a4f73c2f03516
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for zimantic 1.0.2
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.