From 2db8116a8d1e78e87d66a02e6130ca4077eabbb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Sun, 5 Jan 2020 17:39:20 +0100 Subject: [PATCH] README: Explain the new development setup. --- README.md | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index ed9ea73..43fad84 100644 --- a/README.md +++ b/README.md @@ -9,14 +9,39 @@ Python bindings for tantivy. # Installation -The bindings can be installed using setuptools: +The bindings can be installed using from pypi using pip: - python3 setup.py install --user + pip install tantivy-py -Note that this requires setuptools-rust to be installed. Another thing to note -is that the bindings are using [PyO3](https://github.com/PyO3/pyo3), which +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](https://github.com/PyO3/pyo3), which requires rust nightly and only supports python3. +# Development + +Developing tantivy-py 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 tantivy-py has a similar API to tantivy. To create a index first a schema @@ -52,7 +77,7 @@ 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) +best_doc = searcher.doc(best_doc_address) assert best_doc["title"] == ["The Old Man and the Sea"] print(best_doc) ```