Python SDK (PyO3)
Installation
Section titled “Installation”pip install ebook-rsUsage Example
Section titled “Usage Example”from ebook_rs import PyBook
# Open book from file path or byte bufferbook = PyBook.open("sample.epub")
print(f"Title: {book.title}")print(f"Authors: {', '.join(book.authors)}")print(f"Sections count: {book.section_count}")
# Extract plain text from chapter 0text = book.get_section_text(0)
# Full text searchhits = book.search("wonderland")for hit in hits: print(f"Spine: {hit.spine_index} | CFI: {hit.cfi}")
# Export RAG chunksrag_data = book.to_rag_chunks_json(max_tokens=256)```\n