Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Build Status License: MIT

tantivy-py

Python bindings for Tantivy.

Installation

The bindings can be installed using from pypi using pip:

pip install tantivy

If no binary wheel is present for your operating system the bindings will be build from source, this means that Rust needs to be installed before building can succeed.

Note that the bindings are using PyO3, which requires rust nightly and only supports python3.

Development

Setting up a development enviroment can be done in a virtual environment using pipenv or using local packages using the provided Makefile.

For the pipenv setup install the virtual environment and build the bindings using:

pipenv install --dev
pipenv run maturin develop

After the bindings are build, the tests can be run using:

pipenv run python -m pytest

For the Makefile based setup run:

make

Running the tests is done using:

make test

Usage

The Python bindings have a similar API to Tantivy. To create a index first a schema needs to be built. After that documents can be added to the index and a reader can be created to search the index.

import tantivy

# Declaring our schema.
schema_builder = tantivy.SchemaBuilder()
schema_builder.add_text_field("title", stored=True)
schema_builder.add_text_field("body", stored=True)
schema = schema_builder.build()

# Creating our index (in memory, but filesystem is available too)
index = tantivy.Index(schema)


# Adding one document.
writer = index.writer()
writer.add_document(tantivy.Document(
    title=["The Old Man and the Sea"],
    body=["""He was an old man who fished alone in a skiff in the Gulf Stream and he had gone eighty-four days now without taking a fish."""],
))
# ... and committing
writer.commit()


# Reload the index to ensure it points to the last commit.
index.reload()
searcher = index.searcher()
query = index.parse_query("fish days", ["title", "body"])

(best_score, best_doc_address) = searcher.search(query, 3).hits[0]
best_doc = searcher.doc(best_doc_address)
assert best_doc["title"] == ["The Old Man and the Sea"]
print(best_doc)

Metadata

Release files for tantivy 0.13.1-rc.1

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

Source distribution (sdist)

Source distribution for tantivy 0.13.1-rc.1
File Size Uploaded Provenance Actions
tantivy-0.13.1_rc.1.tar.gz 24.9 kB Without provenance Details for tantivy-0.13.1_rc.1.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for tantivy 0.13.1-rc.1
File Actions
tantivy-0.13.1_rc.1-cp38-none-win_amd64.whl CPython 3.8 none Windows x86-64 Details for tantivy-0.13.1_rc.1-cp38-none-win_amd64.whl
tantivy-0.13.1_rc.1-cp38-cp38-manylinux1_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.5+ x86-64 Details for tantivy-0.13.1_rc.1-cp38-cp38-manylinux1_x86_64.whl
tantivy-0.13.1_rc.1-cp38-cp38-macosx_10_7_x86_64.whl CPython 3.8 CPython 3.8 macOS 10.7+ x86-64 Details for tantivy-0.13.1_rc.1-cp38-cp38-macosx_10_7_x86_64.whl
tantivy-0.13.1_rc.1-cp37-none-win_amd64.whl CPython 3.7 none Windows x86-64 Details for tantivy-0.13.1_rc.1-cp37-none-win_amd64.whl
tantivy-0.13.1_rc.1-cp37-cp37m-manylinux1_x86_64.whl CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.5+ x86-64 Details for tantivy-0.13.1_rc.1-cp37-cp37m-manylinux1_x86_64.whl
tantivy-0.13.1_rc.1-cp37-cp37m-macosx_10_7_x86_64.whl CPython 3.7 CPython 3.7 pymalloc macOS 10.7+ x86-64 Details for tantivy-0.13.1_rc.1-cp37-cp37m-macosx_10_7_x86_64.whl

Total release size: 9.2 MB

Release files / tantivy-0.13.1_rc.1.tar.gz

Download URL tantivy-0.13.1_rc.1.tar.gz
Size 24.9 kB
Tags Source
SHA-256 checksum
How to use checksums
48374b5ac4e4b33a691bd5dfb32bea44ada6ebaee1cd529f1ff08a0f2e429842
BLAKE2b-256 checksum
How to use checksums
8fd86ce7117f4d71a1a562f8c1ddabd60ddce77fd41ad89838df166cb6baf194
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/0.8.3

Release files / tantivy-0.13.1_rc.1-cp38-none-win_amd64.whl

Download URL tantivy-0.13.1_rc.1-cp38-none-win_amd64.whl
Size 1.5 MB
Tags CPython 3.8 Windows x86-64
SHA-256 checksum
How to use checksums
b759054bf275cf76b8798923bff1460b2981e289f52054c2e24d51a86367ee3f
BLAKE2b-256 checksum
How to use checksums
74d2973a78f9f4e92efb9c56c1eb64465fc64e230bf67805c9ed2846d0f029f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/0.8.3

Release files / tantivy-0.13.1_rc.1-cp38-cp38-manylinux1_x86_64.whl

Download URL tantivy-0.13.1_rc.1-cp38-cp38-manylinux1_x86_64.whl
Size 1.6 MB
Tags CPython 3.8 Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
58226ec8b137a99dbf3c28507222d14bf6ab0d1a3c3d0e3992d451b2bd16cf5d
BLAKE2b-256 checksum
How to use checksums
74429bbcf90723a7632e141becebf0fa82aa55a866bf23fb1d38c3728709b480
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/0.8.3

Release files / tantivy-0.13.1_rc.1-cp38-cp38-macosx_10_7_x86_64.whl

Download URL tantivy-0.13.1_rc.1-cp38-cp38-macosx_10_7_x86_64.whl
Size 1.4 MB
Tags CPython 3.8 macOS 10.7+ x86-64
SHA-256 checksum
How to use checksums
ec5dbf64bd1b2d8a27719feb722a1c5824793b69c052a16eadc036a342ab969c
BLAKE2b-256 checksum
How to use checksums
190021d39099183ff5ad833c52bd37f38fa9dbca4b84ac15e76d575c8311391a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/0.8.3

Release files / tantivy-0.13.1_rc.1-cp37-none-win_amd64.whl

Download URL tantivy-0.13.1_rc.1-cp37-none-win_amd64.whl
Size 1.5 MB
Tags CPython 3.7 Windows x86-64
SHA-256 checksum
How to use checksums
c7013c30ff66ca1417b36496b9b5ff296f5c01f087bc8745fec289da3e732386
BLAKE2b-256 checksum
How to use checksums
1df1f296e5ba7ddddb5084b1633529d419b47bdf1fac6de1ed77c64285231d48
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/0.8.3

Release files / tantivy-0.13.1_rc.1-cp37-cp37m-manylinux1_x86_64.whl

Download URL tantivy-0.13.1_rc.1-cp37-cp37m-manylinux1_x86_64.whl
Size 1.6 MB
Tags CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
46bb17e531f20289b83f6499a270d78ef48803e6c97d21ae839bddf5270ec56c
BLAKE2b-256 checksum
How to use checksums
204544ae0e279ec79f50818c22561bd569260e265851baff18fa7836bb66c1ce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/0.8.3

Release files / tantivy-0.13.1_rc.1-cp37-cp37m-macosx_10_7_x86_64.whl

Download URL tantivy-0.13.1_rc.1-cp37-cp37m-macosx_10_7_x86_64.whl
Size 1.4 MB
Tags CPython 3.7 CPython 3.7 pymalloc macOS 10.7+ x86-64
SHA-256 checksum
How to use checksums
84a3821de63ec7857c999c754fd906392039a38a5efc2de26a27f44ebb6bca31
BLAKE2b-256 checksum
How to use checksums
a4e6dbc933a7de291bef6cbf8c050c075e8b463a64946d4494a2451aebd5a011
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/0.8.3

Security for tantivy 0.13.1-rc.1

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.

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