Metadata-Version: 2.4
Name: coffy
Version: 0.1.2
Summary: Lightweight local NoSQL, SQL, and Graph embedded database engine
Author: nsarathy
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: networkx>=3.0
Dynamic: author
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: license-file
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# ☕ Coffy

**Coffy** is a lightweight embedded database engine for Python, designed for local-first apps, scripts, and tools. It includes:

- `coffy.nosql`: A simple JSON-backed NoSQL engine with a fluent, chainable query interface  
- `coffy.sql`: A wrapper over SQLite for executing raw SQL with clean tabular results  
- `coffy.graph`: An graph engine built on `networkx` with advanced filtering and logic-based querying

No dependencies (except `networkx`). No boilerplate. Just data.

---

## 🔧 Install

```bash
pip install coffy
```

---

## 📂 Modules

### `coffy.nosql`

- JSON-based collections with fluent `.where().eq().gt()...` query chaining  
- Joins, updates, filters, aggregation, export/import  
- All data saved to human-readable `.json` files  

📄 [NoSQL Documentation →](https://github.com/nsarathy/Coffy/blob/main/NOSQL_DOCS.md)

---

### `coffy.sql`

- SQLite-backed engine with raw SQL query support  
- Outputs as readable tables or exportable lists  
- Uses in-memory DB by default, or json-based if initialized with a path  

📄 [SQL Documentation →](https://github.com/nsarathy/Coffy/blob/main/SQL_DOCS.md)

---

### `coffy.graph`

- Wrapper around `networkx` with simplified node/relationship API  
- Query nodes and relationships using filters like `gt`, `lt`, `eq`, `or`, `not`  
- Uses in-memory DB by default, or json-based if initialized with a path  

📄 [Graph Documentation →](https://github.com/nsarathy/Coffy/blob/main/GRAPH_DOCS.md)

---

## 🧪 Example

```python
from coffy.nosql import db

users = db("users", path="users.json")
users.add({"id": 1, "name": "Neel"})
print(users.where("name").eq("Neel").first())
```

```python
from coffy.sql import init, query

init("app.db")
query("CREATE TABLE test (id INT, name TEXT)")
query("INSERT INTO test VALUES (1, 'Neel')")
print(query("SELECT * FROM test"))
```

```python
from coffy.graph import GraphDB

g = GraphDB(directed=True)
g.add_nodes([{"id": 1, "name": "Neel"}, {"id": 2, "name": "Tanaya"}])
g.add_relationships([{"source": 1, "target": 2, "type": "friend"}])
print(g.find_relationships(type="friend"))
```

---

## 📄 License

MIT © 2025 nsarathy
