Modern Python client for Apache Solr built with httpx and Pydantic.
Project description
Taiyo
Taiyo is a Python client for Apache Solr built with httpx and Pydantic.
The library provides a type-safe interface for interacting with Apache Solr, supporting both synchronous and asynchronous operations. It includes comprehensive support for Solr's query parsers, schema management, and vector search capabilities.
Features
- Synchronous and asynchronous client implementations with httpx
- Type safety with Pydantic for runtime validation and IDE support
- Support for Solr query parsers for sparse (standard, dismax, edismax), dense vector and spatial search
- Pythonic method chains for grouping/faceting/highlighting search results
- Programmatic schema definition for indexing
- Authentication via Basic Auth, Bearer Token, and OAuth2
Installation
pip install taiyo
Or using uv:
uv add taiyo
Quick Start
from typing import Optional
from taiyo import SolrClient, SolrDocument
from taiyo.parsers import StandardQueryParser
class Passenger(SolrDocument):
name: str
sex: str
age: Optional[float] = None
survived: int
pclass: int
fare: Optional[float] = None
embarked: Optional[str] = None
with SolrClient("http://localhost:8983/solr") as client:
client.set_collection("titanic")
passenger = Passenger(
name="Braund, Mr. Owen Harris",
sex="male",
age=22.0,
survived=0,
pclass=3,
fare=7.25,
embarked="S"
)
client.add(passenger, commit=True)
parser = StandardQueryParser(
query="sex:male AND pclass:3",
filter_queries=["age:[20 TO 30]"]
)
results: list[Passenger] = client.search(parser, rows=10, document_model=Passenger)
print(f"Found {results.num_found} passengers")
for doc in results.documents:
print(f"{passenger.name}, Age: {passenger.age}, Class: {passenger.pclass}")
Async Support
from typing import Optional
from taiyo import AsyncSolrClient, SolrDocument
from taiyo.parsers import StandardQueryParser
class Passenger(SolrDocument):
name: str
sex: str
age: Optional[float] = None
survived: int
pclass: int
fare: Optional[float] = None
async with AsyncSolrClient("http://localhost:8983/solr") as client:
client.set_collection("titanic")
# Batch indexing
passengers = [
Passenger(name="Allen, Miss. Elisabeth", sex="female", age=29.0, survived=1, pclass=1, fare=211.34),
Passenger(name="Moran, Mr. James", sex="male", age=None, survived=0, pclass=3, fare=8.46)
]
await client.add(passengers, commit=True)
# Search with filtering
parser = StandardQueryParser(
query="pclass:1 AND survived:1",
filter_queries=["sex:female"]
)
results = await client.search(parser)
# Type-safe result processing
for doc in results.documents:
p = Passenger.model_validate(doc)
print(f"{p.name} survived, paid ${p.fare}")
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file taiyo-0.1.1.tar.gz.
File metadata
- Download URL: taiyo-0.1.1.tar.gz
- Upload date:
- Size: 54.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0bd15887ef3ea694fa2794f98bb835746cbcf043df1b46b7e369e19d51ede7ba
|
|
| MD5 |
7f4333cec9cbae090653b2f4c59bcc43
|
|
| BLAKE2b-256 |
0615c70863780a53083654ce82281f700508964a3562ba2d1cc84d91e829bb35
|
Provenance
The following attestation bundles were made for taiyo-0.1.1.tar.gz:
Publisher:
publish.yml on KengoA/taiyo
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
taiyo-0.1.1.tar.gz -
Subject digest:
0bd15887ef3ea694fa2794f98bb835746cbcf043df1b46b7e369e19d51ede7ba - Sigstore transparency entry: 715897533
- Sigstore integration time:
-
Permalink:
KengoA/taiyo@e7e5ce456ab20dffaa8c6af09db90ded95369444 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/KengoA
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e7e5ce456ab20dffaa8c6af09db90ded95369444 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file taiyo-0.1.1-py3-none-any.whl.
File metadata
- Download URL: taiyo-0.1.1-py3-none-any.whl
- Upload date:
- Size: 71.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c57ebac101826f5291f6f3b7f485ef3b33e6a4b32b89e385ad8d75ee301d604d
|
|
| MD5 |
8a8af9302cf0d774e62d0510ec875c8a
|
|
| BLAKE2b-256 |
e4858099148bc76f237da18da89bb97e8d9aadbfd894b2d138e838cdff713f2c
|
Provenance
The following attestation bundles were made for taiyo-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on KengoA/taiyo
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
taiyo-0.1.1-py3-none-any.whl -
Subject digest:
c57ebac101826f5291f6f3b7f485ef3b33e6a4b32b89e385ad8d75ee301d604d - Sigstore transparency entry: 715897534
- Sigstore integration time:
-
Permalink:
KengoA/taiyo@e7e5ce456ab20dffaa8c6af09db90ded95369444 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/KengoA
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e7e5ce456ab20dffaa8c6af09db90ded95369444 -
Trigger Event:
workflow_dispatch
-
Statement type: