Lupyne is a search engine based on PyLucene, the Python extension for accessing Java Lucene. Lucene is a relatively low-level toolkit, and PyLucene wraps it through automatic code generation. So although Java idioms are translated to Python idioms where possible, the resulting interface is far from Pythonic. See examples for comparisons with the Lucene API.
Lupyne also provides GraphQL and RESTful search services, based on Starlette. Note Solr and Elasticsearch are popular options for Lucene-based search, if no further (Python) customization is needed. So while the services are suitable for production usage, their primary motivation is to be an extensible example.
Not having to initially choose between an embedded library and a server not only provides greater flexibility, it can provide better performance, e.g., batch indexing offline and remote searching live. Additionally only lightweight wrappers with extended behavior are used wherever possible, so falling back to using PyLucene directly is always an option, but should never be necessary for performance.
Usage
PyLucene requires initializing the VM.
import lucene
lucene.initVM()
Indexes are accessed through an IndexSearcher (read-only), IndexWriter, or the combined Indexer.
from lupyne import engine
searcher = engine.IndexSearcher("index/path")
hits = searcher.search("text:query", count=None)
See ./lupyne/services/README.md for services usage.
Installation
pip install lupyne[graphql,rest]
PyLucene is not pip installable.
- Install instructions
- Docker image:
docker pull coady/pylucene - Homebrew formula:
brew install coady/tap/pylucene
Dependencies
- PyLucene >=10
- strawberry-graphql (if graphql option)
- fastapi (if rest option)
Tests
100% branch coverage.
pytest [--cov]
Release files for lupyne 3.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| lupyne-3.4.tar.gz | 33.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| lupyne-3.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 60.5 kB
Release files / lupyne-3.4.tar.gz
| Download URL | lupyne-3.4.tar.gz |
|---|---|
| Size | 33.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
10b8b4e57ffe88e31048733af5e2dbee3f9fcc16431d102e40e9d10bf7a29b6a
|
|
BLAKE2b-256 checksum How to use checksums |
eff2e71adf9f494609432d3deb1c6546bf9d405d176271e7423395a44fbda9f9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
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 Jul 25, 2026.
Transparency logRelease files / lupyne-3.4-py3-none-any.whl
| Download URL | lupyne-3.4-py3-none-any.whl |
|---|---|
| Size | 27.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
55ea46d5e62ab9ebe4ce325ea0062d87f4abb249580e144ddc7d9eff0a9fc78e
|
|
BLAKE2b-256 checksum How to use checksums |
884a493ffbc23f542c8f7c762bd17b09d7765407491dc9fa08c52f4e49da5373
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
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 Jul 25, 2026.
Transparency log