Skip to main content

narsil-client

narsil-client calls a Narsil search server, or every node of a Narsil cluster, from Python 3.11 or later. It holds a typed method for every route that the server documents in its OpenAPI file, in a blocking form and in an async form with the same names.

This package sends HTTP requests to a server that the TypeScript package serves. To search an index inside the Python process with no server, install delali-narsil, which wraps the Rust crate.

pip install narsil-client
from narsil_client import NarsilClient

with NarsilClient("http://localhost:9876") as client:
    client.create_index({"name": "movies", "config": {"schema": {"title": "string", "year": "number"}}})
    client.insert("movies", {"id": "the-matrix", "document": {"title": "The Matrix", "year": 1999}})
    results = client.query("movies", {"term": "matrix"})
    print([hit.id for hit in results.hits])

AsyncNarsilClient takes the same settings, and each of its methods is a coroutine that you await under asyncio or trio.

When you pass a list of addresses, the client moves a read to the next node after a refused or broken connection, a timeout, or an answer of 502, 503, or 504. It moves a write only when the request never left the client or when the node answers NODE_NOT_READY, so the client never sends a second copy of a write that a node may have applied. Every failure raises NarsilError, under the code that the server sent or under a CLIENT_ code for a failure on this side.

To follow every change to an index over the server's change feed, install the changes extra with pip install "narsil-client[changes]", which adds the WebSocket and MessagePack libraries that follow_changes needs. A program that never follows a feed can leave the extra out, because the client imports those libraries only when you call follow_changes.

The Python client guide covers the settings, the helpers, streaming a snapshot or an export, and the failover rules in full.

License

Apache-2.0

Metadata

Release files for narsil-client 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for narsil-client 0.2.0
File Size Uploaded Provenance Actions
narsil_client-0.2.0.tar.gz 82.7 kB With provenance Details for narsil_client-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for narsil-client 0.2.0
File Interpreter ABI Platform Actions
narsil_client-0.2.0-py3-none-any.whl Python 3 none any Details for narsil_client-0.2.0-py3-none-any.whl

Total release size: 196.2 kB

Release files / narsil_client-0.2.0.tar.gz

Download URL narsil_client-0.2.0.tar.gz
Size 82.7 kB
Tags Source
SHA-256 checksum
How to use checksums
aa7d0cf3a9b003e9392b9996b2d554a61859e4d0f1f8cb7f33e735c4ae920613
BLAKE2b-256 checksum
How to use checksums
166c8589599d00c258c2a650cd10c876551006c383ba190cba0a038f0f9bced5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 14, 2026.

Transparency log

Release files / narsil_client-0.2.0-py3-none-any.whl

Download URL narsil_client-0.2.0-py3-none-any.whl
Size 113.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b23e7f41d378cae512532ac9fa488f0677a48d4e3ae3fdaa52e3eb2ff41bee17
BLAKE2b-256 checksum
How to use checksums
2ac12e38615ea5dfdda6f8adc25bea508d46f438eb0fe5e18d825cf819d1968f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 14, 2026.

Transparency log

Security for narsil-client 0.2.0

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.

Select from 2 files

Attestation for narsil_client-0.2.0.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 Nov 14, 2026.

Transparency log

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page