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.12.0-rc.2

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.12.0-rc.2
File Size Uploaded Provenance Actions
tantivy-0.12.0_rc.2.tar.gz 24.8 kB Without provenance Details for tantivy-0.12.0_rc.2.tar.gz

Built distributions (wheels)

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

Total release size: 10.8 MB

Release files / tantivy-0.12.0_rc.2.tar.gz

Download URL tantivy-0.12.0_rc.2.tar.gz
Size 24.8 kB
Tags Source
SHA-256 checksum
How to use checksums
de39606b4b0be23c742ea9fe2094d4e6b1a14737a0e371bd5e7b8ac4d69fa2c1
BLAKE2b-256 checksum
How to use checksums
9d73494899587611ff0c09efa136c429f75413a5f876a40b9c8c96dc022d4e3e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/0.8.0

Release files / tantivy-0.12.0_rc.2-cp38-none-win_amd64.whl

Download URL tantivy-0.12.0_rc.2-cp38-none-win_amd64.whl
Size 2.3 MB
Tags CPython 3.8 Windows x86-64
SHA-256 checksum
How to use checksums
4ee4968163fa702d12f9e3e0227c8c00acb6e32fbbd7cbd651a739789923cae7
BLAKE2b-256 checksum
How to use checksums
2a754554c1b7a5848d09b9ac7a2fa94ec8fc08f16b8eda1f81e992d5bad6f630
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/0.8.0

Release files / tantivy-0.12.0_rc.2-cp38-cp38-manylinux1_x86_64.whl

Download URL tantivy-0.12.0_rc.2-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
a8b4d03253319108956f5b0fef7a56ee6287c28ff1cb1bc1d48b3d006a19fee9
BLAKE2b-256 checksum
How to use checksums
8ac2bfc646d16d57c47fae02c4bc6327700e7b47222492cd7ab142bbb3387df7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/0.8.0

Release files / tantivy-0.12.0_rc.2-cp38-cp38-macosx_10_7_x86_64.whl

Download URL tantivy-0.12.0_rc.2-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
8b4dbf3b60bf149476b18ae3880a99e2a3c0b3ef8a8886594f269aaf81b8ed2f
BLAKE2b-256 checksum
How to use checksums
ef9813648b3958394124945298c7f0ae9dfea17303db58853148eadab620bef9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/0.8.0

Release files / tantivy-0.12.0_rc.2-cp37-none-win_amd64.whl

Download URL tantivy-0.12.0_rc.2-cp37-none-win_amd64.whl
Size 2.3 MB
Tags CPython 3.7 Windows x86-64
SHA-256 checksum
How to use checksums
ed29f3d3eed2e87557c46baac75261c05490cd01012139e75a214bffb709465d
BLAKE2b-256 checksum
How to use checksums
ceeedabc7795e1e9432279403c3703b7fd5ac77d45b05d1f5f20797663f5bfcd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/0.8.0

Release files / tantivy-0.12.0_rc.2-cp37-cp37m-manylinux1_x86_64.whl

Download URL tantivy-0.12.0_rc.2-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
dd6477a172a91bfe887b64269ce529af9b03479b8cf367cd1e17e970ad06c921
BLAKE2b-256 checksum
How to use checksums
3d4fd9f1defee3667a65fcb0076982280f0a07f79b62af3411a19e67e35af494
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/0.8.0

Release files / tantivy-0.12.0_rc.2-cp37-cp37m-macosx_10_7_x86_64.whl

Download URL tantivy-0.12.0_rc.2-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
94e54239535cd850cb9220821eec0756470302b60a88fced7c6a515f7c1f6a3f
BLAKE2b-256 checksum
How to use checksums
11c5f7392f9ae965998b5b0eec28ea897eaf99449edda0f34129d95b194ac87e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/0.8.0

Security for tantivy 0.12.0-rc.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.

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