This release has been yanked by its maintainers, and will be ignored by installers, except when explicitly specified.
Consider using release 0.1.1 instead.
Reason given by maintainers: Default storage configuration fell back to JSON instead of .yny binary persistence. Fixed in v0.1.1.
🌐 Language / Idioma: English | Español
A lightweight toolkit for building custom search systems in Python.
"An easy way to build search engines in Python."
Yeny is a lightweight, production-oriented search toolkit that helps you build full-text search features quickly, while still giving you advanced controls when your dataset grows.
It follows a progressive-power philosophy:
- Start with pure Python and zero mandatory external dependencies.
- Scale to SQL-backed persistence and temporal sharding when needed.
- Keep API ergonomics simple through a single high-level
Yenyentrypoint.
Table of Contents
- Features
- Installation
- Quick Start
- Examples
- Architecture Snapshot
- Why Yeny?
- Documentation
- Benchmarks
- Testing
- Sponsor
- Contributing
- Roadmap
- Dedication
- License
Features
- Pure Python engines (
coreandlite) - Built-in NLP preprocessors and tokenizers
- Ranked retrieval with structured response models
- Binary persistence (
.yny) — memory-mapped index files for near-zero RAM loading, plus lightweight SQLite metadata (WAL mode). Persistence is automatic —from_dict(),from_list(), andfrom_table()all save without calling.save(). - Direct DB ingestion — read from SQLite, MySQL, or PostgreSQL tables without polluting your database (read-only adapters, zero
yeny_*tables on your DB) - Versioned index persistence with rollback support
- Temporal sharding for large time-series corpora
- Background reindexing with
IndexWorker(zero-downtime) - Health and diagnostics reporting
- Standalone utility functions for indexing and vector math
- Optional JSON or full-SQL storage backends for simpler use cases
Installation
Install from PyPI:
pip install yeny
Optional SQL support:
# Generic SQLAlchemy support
pip install yeny[alchemy]
# MySQL
pip install yeny[mysql]
# PostgreSQL
pip install yeny[postgresql]
Alternatively, install from source:
git clone https://github.com/Ariiies/yeny.git
cd yeny
pip install .
Quick Start
from yeny import Yeny
documents = {
"doc1": "Python is a versatile language for backend systems",
"doc2": "JavaScript dominates modern frontend development",
"doc3": "Yeny makes search implementation straightforward",
}
searcher = Yeny.from_dict(documents, name="demo_index", engine="core")
response = searcher.search("python frontend", top_k=2)
print(response)
# Output:
# SearchResponse(
# query='python frontend',
# tokens=['python', 'frontend'],
# engine='CoreEngine',
# total_results=2,
# search_time_ms=0.14,
# results=[
# SearchResult(doc_id='doc1', score=0.2757, rank=1),
# SearchResult(doc_id='doc2', score=0.2414, rank=2)
# ]
# )
Factories persist automatically. Reload later with the same logical name:
loaded = Yeny(name="demo_index")
response = loaded.search("python")
Advanced infrastructure stays optional and typed:
from yeny import Yeny
from yeny.config import YenyOptions, TableConfig, TableSource
options = YenyOptions(storage_dir="search_data", memory_limit_mb=512)
searcher = Yeny.from_table(
TableSource(
table="articles",
connection_url=DB_URL,
text_columns=["title", "body"],
id_column="id",
date_column="created_at",
),
engine="lite",
config=TableConfig(where_clause="published = 1"),
options=options,
)
YenyOptions.binary_dir accepts "auto" (derive <storage_dir>/yny),
None (disable .yny persistence), or an explicit directory.
Examples
Runnable, documented end-to-end scenarios live in examples/:
- Encrypted search over MySQL —
full-text search over Fernet-encrypted columns (
name/email/number) using a blind index of HMAC-trigrams, temporal sharding,.ynypersistence and an interactive playground. The whole Yeny integration fits in ~15 lines insideplayground.py.
cd examples/encrypted_search
pip install "../..[encrypted-search-example]"
python seed_controlled_data.py && python playground.py
See examples/encrypted_search/README.md
for setup, security model and adaptation guide.
Architecture Snapshot
┌──────────────────┐
│ DatabaseReader │ ← read-only (your DB)
│ SQLite / MySQL / │
│ PostgreSQL │
└────────┬─────────┘
│ data ingestion
▼
Documents → Preprocessors → Engine → Storage
│ │
▼ ▼
Tokenizers ┌──────────────┐
(word, char, │ .yny binaries │ ← mmap (index data)
n-gram) │ + SQLite WAL │ ← metadata & aliases
└──────────────┘
yeny.main.Yeny: high-level API and orchestration (Facade pattern)yeny.engines:CoreEngine: TF-IDF + cosine similarityLiteEngine: lightweight normalized TF approach
yeny.storage:MetadataStorage(recommended): SQLite WAL for metadata +.ynybinaries for index dataJSONStorage: plain.jsonfiles (simple / debugging)SQLiteStorage: full index serialized in SQLite tablesAlchemyStorage: full index serialized via SQLAlchemy (MySQL, PostgreSQL, etc.)
yeny.storage.DatabaseReader: read-only adapter for ingesting from your DB without creating anyyeny_*tablesyeny.worker: async/periodic reindex worker (zero-downtime)yeny.health: system and index health reportingyeny.utils: NLP, indexing helpers, math, serialization, mmap helpers
Why Yeny?
Note: The comparison below is qualitative. Yeny benchmarks compare its own
coreandliteengines; they do not benchmark external projects.
| Feature | Yeny | Whoosh | Meilisearch | Elasticsearch |
|---|---|---|---|---|
| Pure Python (zero deps) | ✅ | ✅ | ❌ (Rust) | ❌ (Java) |
| Direct DB table ingestion | ✅ | ❌ | ❌ | ❌ |
| Temporal sharding | ✅ | ❌ | ❌ | ✅ |
| Background worker | ✅ | ❌ | ❌ | ✅ |
| Rollback / versioning | ✅ | ❌ | ❌ | ✅ |
| Bilingual docs (EN + ES) | ✅ | ❌ | ❌ | ❌ |
| Zero external services | ✅ | ✅ | ❌ | ❌ |
Where Yeny shines:
Yeny is built for small to medium projects that need search without the overhead of a full-blown search infrastructure. You don't need to spin up a separate server, configure clusters, or learn a new query DSL — just pip install yeny and you're done.
- Small projects & prototypes — When your dataset is in the thousands or low millions of documents, Yeny gives you production-quality search without standing up an Elasticsearch or Meilisearch instance.
- Embedded use cases — Ideal for CLI tools, desktop apps, or Python backends (Flask, FastAPI) that need search as a library, not a service.
- High customizability — Swap tokenizers, inject your own preprocessors, or even bring external NLP libraries (spaCy, NLTK). Yeny adapts to your domain, not the other way around.
- SQL-native data — If your data already lives in SQLite, MySQL, or PostgreSQL, Yeny ingests directly from tables or queries — no ETL pipeline needed.
- Time-series corpora — Temporal sharding lets you query logs, emails, or articles by date range without loading everything into RAM.
Documentation
Yeny includes full documentation in Spanish and English.
Useful entry points:
- Getting started: English, Español
- Yeny object reference: English, Español
- API reference: English, Español
- Testing guide: English, Español
- Benchmark guide: English, Español
Benchmarks
Yeny includes a deterministic local suite for comparing CoreEngine and
LiteEngine with the same generated corpus, queries, and tokenizer:
python -m benchmarks run --profile tiny
It measures index construction, public search latency, JSON/SQLite
persistence, .yny serialization and mmap loading, artifact size, and
available RSS memory. Results are saved as timestamped JSON so runs can be
validated and compared without overwriting previous data.
These benchmarks measure speed, resource use, and persistence fidelity—not search relevance or performance against other projects. See the English guide, the guía en español, or the runner quick reference. The published cross-platform campaign, raw results, generated reports, and presentation are available in the benchmark documentation package.
Testing
python -m pytest -q
Sponsor
Yeny is an open-source project. If this toolkit has saved you time or helped you build robust search features, consider supporting its ongoing development and maintenance.
Contributing
Contributions are welcome. Open an issue or submit a pull request.
Roadmap
Development moves step by step—prioritizing pure-Python ergonomics first, while progressively building optional native acceleration in parallel.
Planned Engines (Pure Python)
| Engine | Status | Description |
|---|---|---|
| BM25Engine | 🧪 Planned | BM25 relevance scoring — better IDF saturation and document length normalization than TF-IDF. Ideal for general-purpose search. |
| NanoEngine / CountEngine | 🧪 Planned | Ultra-lightweight raw term-frequency (bag-of-words) engine with zero normalization overhead. Built for maximum speed in simple keyword-matching scenarios alongside LiteEngine. |
Parallel Track: Rust Acceleration
| Component | Status | Description |
|---|---|---|
| Rust Core & Tokenizers | 🦀 In Progress | Gradual integration of optional Rust bindings (via PyO3) developed in parallel to accelerate tokenization, inverted index construction, and scoring kernels while keeping the pure-Python fallback intact. |
Tentative / Future Exploration
- 🔬 Fuzzy & typo-tolerant search: Built-in Levenshtein/Damerau-Levenshtein matching integrated into the search pipeline.
- 🔬 Faceted search: Filter results by metadata fields (category, date, author) alongside full-text scoring.
- 🔬 Multi-language stemming: Optional stemming support for Spanish, English, and more.
Legend: 🧪 Planned = next in the pipeline · 🦀 In Progress = parallel track · 🔬 Tentative = long-term exploration
Dedication
In loving memory of my mother, Yeny.
This project is named after her as a tribute to her life, her warmth, and everything she taught me. Every line of code in Yeny is shared freely with the developer community in her honor—so that her name continues to build, connect, and help others create. ❤️
License
Metadata
Release files for yeny 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| yeny-0.1.0.tar.gz | 127.9 kB | Without provenance | Details for yeny-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| yeny-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for yeny-0.1.0-py3-none-any.whl |
Total release size: 276.6 kB
Release files / yeny-0.1.0.tar.gz
| Download URL | yeny-0.1.0.tar.gz |
|---|---|
| Size | 127.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7ef2cb416ee2d2588d6b2df1b057d9a0bdfd854e29c55092367c484d76b99aa8
|
|
BLAKE2b-256 checksum How to use checksums |
18a81c5124a8bd114d39778e8dc34669d0a193908f35e5f5beb94906fcadb153
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.6
|
Release files / yeny-0.1.0-py3-none-any.whl
| Download URL | yeny-0.1.0-py3-none-any.whl |
|---|---|
| Size | 148.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
54e80131abb8e073a1be0bc7727adfc6d1f412db77e9cdb2f4fb98314c57888f
|
|
BLAKE2b-256 checksum How to use checksums |
c1a970dffa407b65b7e33ee625bfe5551c2659088a90b804b84596be34f8c5d1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.6
|
Security for yeny 0.1.0
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.