yukisdb 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- yukisdb-1.0.0/PKG-INFO +182 -0
- yukisdb-1.0.0/README.md +146 -0
- yukisdb-1.0.0/setup.cfg +4 -0
- yukisdb-1.0.0/setup.py +44 -0
- yukisdb-1.0.0/yukisdb/__init__.py +11 -0
- yukisdb-1.0.0/yukisdb/cli.py +180 -0
- yukisdb-1.0.0/yukisdb/client.py +170 -0
- yukisdb-1.0.0/yukisdb.egg-info/PKG-INFO +182 -0
- yukisdb-1.0.0/yukisdb.egg-info/SOURCES.txt +11 -0
- yukisdb-1.0.0/yukisdb.egg-info/dependency_links.txt +1 -0
- yukisdb-1.0.0/yukisdb.egg-info/entry_points.txt +2 -0
- yukisdb-1.0.0/yukisdb.egg-info/requires.txt +1 -0
- yukisdb-1.0.0/yukisdb.egg-info/top_level.txt +1 -0
yukisdb-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: yukisdb
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Official Python SDK & CLI for YukisDB — Unified Cloud NoSQL Database, 2GB Storage & AI Vector BaaS
|
|
5
|
+
Home-page: https://yukisdb.yukiapi.site
|
|
6
|
+
Author: SUDEEPBOTS
|
|
7
|
+
Author-email: support@yukiapi.site
|
|
8
|
+
Project-URL: Documentation, https://yukisdb.yukiapi.site/docs
|
|
9
|
+
Project-URL: Source, https://github.com/SUDEEPBOTS/yukisdb
|
|
10
|
+
Project-URL: Tracker, https://github.com/SUDEEPBOTS/yukisdb/issues
|
|
11
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Topic :: Database
|
|
14
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Operating System :: OS Independent
|
|
23
|
+
Requires-Python: >=3.8
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
Requires-Dist: requests>=2.25.0
|
|
26
|
+
Dynamic: author
|
|
27
|
+
Dynamic: author-email
|
|
28
|
+
Dynamic: classifier
|
|
29
|
+
Dynamic: description
|
|
30
|
+
Dynamic: description-content-type
|
|
31
|
+
Dynamic: home-page
|
|
32
|
+
Dynamic: project-url
|
|
33
|
+
Dynamic: requires-dist
|
|
34
|
+
Dynamic: requires-python
|
|
35
|
+
Dynamic: summary
|
|
36
|
+
|
|
37
|
+
# YukisDB Python SDK & CLI ⚡
|
|
38
|
+
|
|
39
|
+
[](https://pypi.org/project/yukisdb/)
|
|
40
|
+
[](https://opensource.org/licenses/MIT)
|
|
41
|
+
|
|
42
|
+
Official Python SDK & Developer CLI for **[YukisDB](https://yukisdb.yukiapi.site)** — Unified Cloud NoSQL JSON Document Database, 2GB Object Storage with Zero Egress Bandwidth Bills, and AI Vector Embeddings Memory.
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## 📦 Installation
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
pip install yukisdb
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## 💻 CLI Quickstart
|
|
55
|
+
|
|
56
|
+
Once installed, the `yukisdb` command is immediately available in your terminal:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
# Check cluster telemetry & health
|
|
60
|
+
yukisdb health
|
|
61
|
+
|
|
62
|
+
# View developer free tier quotas
|
|
63
|
+
yukisdb tier
|
|
64
|
+
|
|
65
|
+
# Zero-auth sandbox insert
|
|
66
|
+
yukisdb sandbox insert '{"task": "test", "completed": true}'
|
|
67
|
+
|
|
68
|
+
# Zero-auth sandbox query
|
|
69
|
+
yukisdb sandbox find '{"completed": true}'
|
|
70
|
+
|
|
71
|
+
# Generate an ephemeral API testing key
|
|
72
|
+
yukisdb anonymous-key
|
|
73
|
+
|
|
74
|
+
# Authenticated CRUD (requires export YUKISDB_API_KEY=ydb_live_...)
|
|
75
|
+
export YUKISDB_API_KEY="ydb_live_your_key_here"
|
|
76
|
+
yukisdb insert users '{"name": "Sudeep", "role": "admin"}'
|
|
77
|
+
yukisdb find users '{"role": "admin"}'
|
|
78
|
+
yukisdb upload model_checkpoint.pt
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## 🐍 Python SDK Quickstart
|
|
84
|
+
|
|
85
|
+
### 1. Initialize Client
|
|
86
|
+
|
|
87
|
+
```python
|
|
88
|
+
from yukisdb import YukisDB
|
|
89
|
+
|
|
90
|
+
# Automatically picks up YUKISDB_API_KEY environment variable if omitted
|
|
91
|
+
db = YukisDB(api_key="ydb_live_your_api_key_here")
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### 2. NoSQL Document Operations (CRUD)
|
|
95
|
+
|
|
96
|
+
```python
|
|
97
|
+
# Insert a document
|
|
98
|
+
doc = db.collection("users").insert({
|
|
99
|
+
"name": "Alice",
|
|
100
|
+
"email": "alice@example.com",
|
|
101
|
+
"tier": "developer"
|
|
102
|
+
})
|
|
103
|
+
print("Inserted ID:", doc["id"])
|
|
104
|
+
|
|
105
|
+
# Query documents
|
|
106
|
+
users = db.collection("users").find({"tier": "developer"})
|
|
107
|
+
print("Found users:", users)
|
|
108
|
+
|
|
109
|
+
# Retrieve single document by ID
|
|
110
|
+
user = db.collection("users").get(doc["id"])
|
|
111
|
+
|
|
112
|
+
# Update document
|
|
113
|
+
db.collection("users").update(doc["id"], {"tier": "pro"})
|
|
114
|
+
|
|
115
|
+
# Delete document
|
|
116
|
+
db.collection("users").delete(doc["id"])
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### 3. AI Vector Embeddings Search
|
|
120
|
+
|
|
121
|
+
```python
|
|
122
|
+
# Cosine similarity nearest-neighbor search for agent long-term memory
|
|
123
|
+
results = db.collection("agent_memory").vector_search(
|
|
124
|
+
vector=[0.12, -0.45, 0.88, 0.05],
|
|
125
|
+
field="embedding",
|
|
126
|
+
top_k=5
|
|
127
|
+
)
|
|
128
|
+
for match in results:
|
|
129
|
+
print(match["title"], match["_score"])
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### 4. 2GB Object Storage (Zero Egress Bills)
|
|
133
|
+
|
|
134
|
+
```python
|
|
135
|
+
# Upload any file up to 2GB with instant CDN streaming URL
|
|
136
|
+
file_info = db.storage.upload("video_dataset.mp4", custom_slug="dataset-2026")
|
|
137
|
+
print("Public CDN URL:", file_info["url"])
|
|
138
|
+
|
|
139
|
+
# List tenant storage files
|
|
140
|
+
files = db.storage.list()
|
|
141
|
+
print("Storage objects:", files)
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### 5. Zero-Auth Public Sandbox (Prototyping)
|
|
145
|
+
|
|
146
|
+
```python
|
|
147
|
+
# Store without registration
|
|
148
|
+
sandbox_doc = db.sandbox.insert({"experiment": "RAG pipeline test"})
|
|
149
|
+
print("Saved to sandbox:", sandbox_doc)
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## 🤖 Model Context Protocol (MCP) Integration
|
|
155
|
+
|
|
156
|
+
YukisDB runs a native Model Context Protocol (MCP 2024-11-05) server for Claude Desktop, Cursor AI, and autonomous agents:
|
|
157
|
+
|
|
158
|
+
```json
|
|
159
|
+
{
|
|
160
|
+
"mcpServers": {
|
|
161
|
+
"yukisdb": {
|
|
162
|
+
"command": "yukisdb",
|
|
163
|
+
"args": ["mcp"],
|
|
164
|
+
"env": {
|
|
165
|
+
"YUKISDB_API_KEY": "ydb_live_your_api_key_here"
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
Or connect directly to Streamable HTTP: `https://yukisdb.yukiapi.site/mcp`.
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## 🔗 Resources
|
|
177
|
+
|
|
178
|
+
- **Website & Portal:** [https://yukisdb.yukiapi.site](https://yukisdb.yukiapi.site)
|
|
179
|
+
- **Developer Documentation:** [https://yukisdb.yukiapi.site/docs](https://yukisdb.yukiapi.site/docs)
|
|
180
|
+
- **OpenAPI 3.1 Spec:** [https://yukisdb.yukiapi.site/openapi.json](https://yukisdb.yukiapi.site/openapi.json)
|
|
181
|
+
- **LLMs Knowledge Reference:** [https://yukisdb.yukiapi.site/llms.txt](https://yukisdb.yukiapi.site/llms.txt)
|
|
182
|
+
- **Support & Security:** `support@yukiapi.site`
|
yukisdb-1.0.0/README.md
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# YukisDB Python SDK & CLI ⚡
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/yukisdb/)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
|
|
6
|
+
Official Python SDK & Developer CLI for **[YukisDB](https://yukisdb.yukiapi.site)** — Unified Cloud NoSQL JSON Document Database, 2GB Object Storage with Zero Egress Bandwidth Bills, and AI Vector Embeddings Memory.
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## 📦 Installation
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
pip install yukisdb
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## 💻 CLI Quickstart
|
|
19
|
+
|
|
20
|
+
Once installed, the `yukisdb` command is immediately available in your terminal:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
# Check cluster telemetry & health
|
|
24
|
+
yukisdb health
|
|
25
|
+
|
|
26
|
+
# View developer free tier quotas
|
|
27
|
+
yukisdb tier
|
|
28
|
+
|
|
29
|
+
# Zero-auth sandbox insert
|
|
30
|
+
yukisdb sandbox insert '{"task": "test", "completed": true}'
|
|
31
|
+
|
|
32
|
+
# Zero-auth sandbox query
|
|
33
|
+
yukisdb sandbox find '{"completed": true}'
|
|
34
|
+
|
|
35
|
+
# Generate an ephemeral API testing key
|
|
36
|
+
yukisdb anonymous-key
|
|
37
|
+
|
|
38
|
+
# Authenticated CRUD (requires export YUKISDB_API_KEY=ydb_live_...)
|
|
39
|
+
export YUKISDB_API_KEY="ydb_live_your_key_here"
|
|
40
|
+
yukisdb insert users '{"name": "Sudeep", "role": "admin"}'
|
|
41
|
+
yukisdb find users '{"role": "admin"}'
|
|
42
|
+
yukisdb upload model_checkpoint.pt
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## 🐍 Python SDK Quickstart
|
|
48
|
+
|
|
49
|
+
### 1. Initialize Client
|
|
50
|
+
|
|
51
|
+
```python
|
|
52
|
+
from yukisdb import YukisDB
|
|
53
|
+
|
|
54
|
+
# Automatically picks up YUKISDB_API_KEY environment variable if omitted
|
|
55
|
+
db = YukisDB(api_key="ydb_live_your_api_key_here")
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### 2. NoSQL Document Operations (CRUD)
|
|
59
|
+
|
|
60
|
+
```python
|
|
61
|
+
# Insert a document
|
|
62
|
+
doc = db.collection("users").insert({
|
|
63
|
+
"name": "Alice",
|
|
64
|
+
"email": "alice@example.com",
|
|
65
|
+
"tier": "developer"
|
|
66
|
+
})
|
|
67
|
+
print("Inserted ID:", doc["id"])
|
|
68
|
+
|
|
69
|
+
# Query documents
|
|
70
|
+
users = db.collection("users").find({"tier": "developer"})
|
|
71
|
+
print("Found users:", users)
|
|
72
|
+
|
|
73
|
+
# Retrieve single document by ID
|
|
74
|
+
user = db.collection("users").get(doc["id"])
|
|
75
|
+
|
|
76
|
+
# Update document
|
|
77
|
+
db.collection("users").update(doc["id"], {"tier": "pro"})
|
|
78
|
+
|
|
79
|
+
# Delete document
|
|
80
|
+
db.collection("users").delete(doc["id"])
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### 3. AI Vector Embeddings Search
|
|
84
|
+
|
|
85
|
+
```python
|
|
86
|
+
# Cosine similarity nearest-neighbor search for agent long-term memory
|
|
87
|
+
results = db.collection("agent_memory").vector_search(
|
|
88
|
+
vector=[0.12, -0.45, 0.88, 0.05],
|
|
89
|
+
field="embedding",
|
|
90
|
+
top_k=5
|
|
91
|
+
)
|
|
92
|
+
for match in results:
|
|
93
|
+
print(match["title"], match["_score"])
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### 4. 2GB Object Storage (Zero Egress Bills)
|
|
97
|
+
|
|
98
|
+
```python
|
|
99
|
+
# Upload any file up to 2GB with instant CDN streaming URL
|
|
100
|
+
file_info = db.storage.upload("video_dataset.mp4", custom_slug="dataset-2026")
|
|
101
|
+
print("Public CDN URL:", file_info["url"])
|
|
102
|
+
|
|
103
|
+
# List tenant storage files
|
|
104
|
+
files = db.storage.list()
|
|
105
|
+
print("Storage objects:", files)
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### 5. Zero-Auth Public Sandbox (Prototyping)
|
|
109
|
+
|
|
110
|
+
```python
|
|
111
|
+
# Store without registration
|
|
112
|
+
sandbox_doc = db.sandbox.insert({"experiment": "RAG pipeline test"})
|
|
113
|
+
print("Saved to sandbox:", sandbox_doc)
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## 🤖 Model Context Protocol (MCP) Integration
|
|
119
|
+
|
|
120
|
+
YukisDB runs a native Model Context Protocol (MCP 2024-11-05) server for Claude Desktop, Cursor AI, and autonomous agents:
|
|
121
|
+
|
|
122
|
+
```json
|
|
123
|
+
{
|
|
124
|
+
"mcpServers": {
|
|
125
|
+
"yukisdb": {
|
|
126
|
+
"command": "yukisdb",
|
|
127
|
+
"args": ["mcp"],
|
|
128
|
+
"env": {
|
|
129
|
+
"YUKISDB_API_KEY": "ydb_live_your_api_key_here"
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Or connect directly to Streamable HTTP: `https://yukisdb.yukiapi.site/mcp`.
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## 🔗 Resources
|
|
141
|
+
|
|
142
|
+
- **Website & Portal:** [https://yukisdb.yukiapi.site](https://yukisdb.yukiapi.site)
|
|
143
|
+
- **Developer Documentation:** [https://yukisdb.yukiapi.site/docs](https://yukisdb.yukiapi.site/docs)
|
|
144
|
+
- **OpenAPI 3.1 Spec:** [https://yukisdb.yukiapi.site/openapi.json](https://yukisdb.yukiapi.site/openapi.json)
|
|
145
|
+
- **LLMs Knowledge Reference:** [https://yukisdb.yukiapi.site/llms.txt](https://yukisdb.yukiapi.site/llms.txt)
|
|
146
|
+
- **Support & Security:** `support@yukiapi.site`
|
yukisdb-1.0.0/setup.cfg
ADDED
yukisdb-1.0.0/setup.py
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
from setuptools import setup, find_packages
|
|
2
|
+
|
|
3
|
+
with open("README.md", "r", encoding="utf-8") as fh:
|
|
4
|
+
long_description = fh.read()
|
|
5
|
+
|
|
6
|
+
setup(
|
|
7
|
+
name="yukisdb",
|
|
8
|
+
version="1.0.0",
|
|
9
|
+
description="Official Python SDK & CLI for YukisDB — Unified Cloud NoSQL Database, 2GB Storage & AI Vector BaaS",
|
|
10
|
+
long_description=long_description,
|
|
11
|
+
long_description_content_type="text/markdown",
|
|
12
|
+
author="SUDEEPBOTS",
|
|
13
|
+
author_email="support@yukiapi.site",
|
|
14
|
+
url="https://yukisdb.yukiapi.site",
|
|
15
|
+
project_urls={
|
|
16
|
+
"Documentation": "https://yukisdb.yukiapi.site/docs",
|
|
17
|
+
"Source": "https://github.com/SUDEEPBOTS/yukisdb",
|
|
18
|
+
"Tracker": "https://github.com/SUDEEPBOTS/yukisdb/issues",
|
|
19
|
+
},
|
|
20
|
+
packages=find_packages(),
|
|
21
|
+
entry_points={
|
|
22
|
+
"console_scripts": [
|
|
23
|
+
"yukisdb=yukisdb.cli:main",
|
|
24
|
+
],
|
|
25
|
+
},
|
|
26
|
+
install_requires=[
|
|
27
|
+
"requests>=2.25.0",
|
|
28
|
+
],
|
|
29
|
+
python_requires=">=3.8",
|
|
30
|
+
classifiers=[
|
|
31
|
+
"Development Status :: 5 - Production/Stable",
|
|
32
|
+
"Intended Audience :: Developers",
|
|
33
|
+
"Topic :: Database",
|
|
34
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
35
|
+
"License :: OSI Approved :: MIT License",
|
|
36
|
+
"Programming Language :: Python :: 3",
|
|
37
|
+
"Programming Language :: Python :: 3.8",
|
|
38
|
+
"Programming Language :: Python :: 3.9",
|
|
39
|
+
"Programming Language :: Python :: 3.10",
|
|
40
|
+
"Programming Language :: Python :: 3.11",
|
|
41
|
+
"Programming Language :: Python :: 3.12",
|
|
42
|
+
"Operating System :: OS Independent",
|
|
43
|
+
],
|
|
44
|
+
)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"""
|
|
2
|
+
⚡ YukisDB Official Python SDK & CLI
|
|
3
|
+
Unified Cloud NoSQL Document Database, 2GB Object Storage & AI Vector Search BaaS
|
|
4
|
+
https://yukisdb.yukiapi.site
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from .client import YukisDB, Collection, Storage, Sandbox
|
|
8
|
+
from .cli import main as cli_main
|
|
9
|
+
|
|
10
|
+
__version__ = "1.0.0"
|
|
11
|
+
__all__ = ["YukisDB", "Collection", "Storage", "Sandbox", "cli_main"]
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
"""
|
|
2
|
+
YukisDB Official Developer CLI
|
|
3
|
+
https://yukisdb.yukiapi.site
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
import sys
|
|
7
|
+
import os
|
|
8
|
+
import json
|
|
9
|
+
import urllib.request
|
|
10
|
+
import urllib.parse
|
|
11
|
+
import urllib.error
|
|
12
|
+
|
|
13
|
+
API_HOST = os.getenv("YUKISDB_HOST", "https://yukisdb.yukiapi.site").rstrip("/")
|
|
14
|
+
API_KEY = os.getenv("YUKISDB_API_KEY", "")
|
|
15
|
+
|
|
16
|
+
def get_headers():
|
|
17
|
+
hdrs = {"User-Agent": "YukisDB-CLI/1.0.0"}
|
|
18
|
+
if API_KEY:
|
|
19
|
+
hdrs["Authorization"] = f"Bearer {API_KEY}"
|
|
20
|
+
hdrs["X-API-Key"] = API_KEY
|
|
21
|
+
return hdrs
|
|
22
|
+
|
|
23
|
+
def print_help():
|
|
24
|
+
print("""⚡ YukisDB Official Developer CLI v1.0.0 (yukiapi.site)
|
|
25
|
+
Portal & Documentation: https://yukisdb.yukiapi.site/docs
|
|
26
|
+
|
|
27
|
+
Usage:
|
|
28
|
+
yukisdb health Check Singapore cluster health
|
|
29
|
+
yukisdb tier View developer free tier quotas
|
|
30
|
+
yukisdb insert <collection> <json-data> Insert document into collection
|
|
31
|
+
yukisdb find <collection> [json-query] Query collection documents
|
|
32
|
+
yukisdb get <collection> <doc-id> Get single document by ID
|
|
33
|
+
yukisdb update <col> <id> <json-data> Update document by ID
|
|
34
|
+
yukisdb delete <collection> <doc-id> Delete document by ID
|
|
35
|
+
yukisdb upload <filepath> [custom-slug] Upload file to 2GB Object Storage
|
|
36
|
+
yukisdb list-files List uploaded storage objects
|
|
37
|
+
yukisdb sandbox insert <json-data> Zero-auth test document insert
|
|
38
|
+
yukisdb sandbox find [json-query] Zero-auth test document query
|
|
39
|
+
yukisdb anonymous-key Generate instant ephemeral test key
|
|
40
|
+
yukisdb mcp Run local MCP stdio server bridge
|
|
41
|
+
""")
|
|
42
|
+
|
|
43
|
+
def main():
|
|
44
|
+
global API_HOST, API_KEY
|
|
45
|
+
if len(sys.argv) < 2 or sys.argv[1] in ["-h", "--help", "help"]:
|
|
46
|
+
print_help()
|
|
47
|
+
return
|
|
48
|
+
|
|
49
|
+
cmd = sys.argv[1]
|
|
50
|
+
|
|
51
|
+
try:
|
|
52
|
+
if cmd == "health":
|
|
53
|
+
req = urllib.request.Request(f"{API_HOST}/api/v1/health", headers=get_headers())
|
|
54
|
+
with urllib.request.urlopen(req) as res:
|
|
55
|
+
print(json.dumps(json.loads(res.read().decode()), indent=2))
|
|
56
|
+
|
|
57
|
+
elif cmd == "tier":
|
|
58
|
+
req = urllib.request.Request(f"{API_HOST}/api/v1/public/tier", headers=get_headers())
|
|
59
|
+
with urllib.request.urlopen(req) as res:
|
|
60
|
+
print(json.dumps(json.loads(res.read().decode()), indent=2))
|
|
61
|
+
|
|
62
|
+
elif cmd == "anonymous-key":
|
|
63
|
+
req = urllib.request.Request(f"{API_HOST}/api/v1/auth/anonymous-key", method="POST", headers=get_headers())
|
|
64
|
+
with urllib.request.urlopen(req) as res:
|
|
65
|
+
print(json.dumps(json.loads(res.read().decode()), indent=2))
|
|
66
|
+
|
|
67
|
+
elif cmd == "sandbox":
|
|
68
|
+
if len(sys.argv) < 3:
|
|
69
|
+
print("Usage: yukisdb sandbox insert <json> | yukisdb sandbox find [json]")
|
|
70
|
+
return
|
|
71
|
+
subcmd = sys.argv[2]
|
|
72
|
+
if subcmd == "insert" and len(sys.argv) >= 4:
|
|
73
|
+
payload = json.loads(sys.argv[3])
|
|
74
|
+
req = urllib.request.Request(
|
|
75
|
+
f"{API_HOST}/api/v1/sandbox/insert",
|
|
76
|
+
data=json.dumps(payload).encode(),
|
|
77
|
+
headers={**get_headers(), "Content-Type": "application/json"},
|
|
78
|
+
method="POST"
|
|
79
|
+
)
|
|
80
|
+
with urllib.request.urlopen(req) as res:
|
|
81
|
+
print(json.dumps(json.loads(res.read().decode()), indent=2))
|
|
82
|
+
elif subcmd == "find":
|
|
83
|
+
query = json.loads(sys.argv[3]) if len(sys.argv) >= 4 else {}
|
|
84
|
+
req = urllib.request.Request(
|
|
85
|
+
f"{API_HOST}/api/v1/sandbox/find",
|
|
86
|
+
data=json.dumps(query).encode(),
|
|
87
|
+
headers={**get_headers(), "Content-Type": "application/json"},
|
|
88
|
+
method="POST"
|
|
89
|
+
)
|
|
90
|
+
with urllib.request.urlopen(req) as res:
|
|
91
|
+
print(json.dumps(json.loads(res.read().decode()), indent=2))
|
|
92
|
+
|
|
93
|
+
elif cmd == "insert" and len(sys.argv) >= 4:
|
|
94
|
+
col = sys.argv[2]
|
|
95
|
+
data = json.loads(sys.argv[3])
|
|
96
|
+
req = urllib.request.Request(
|
|
97
|
+
f"{API_HOST}/api/v1/db/{col}/insert",
|
|
98
|
+
data=json.dumps(data).encode(),
|
|
99
|
+
headers={**get_headers(), "Content-Type": "application/json"},
|
|
100
|
+
method="POST"
|
|
101
|
+
)
|
|
102
|
+
with urllib.request.urlopen(req) as res:
|
|
103
|
+
print(json.dumps(json.loads(res.read().decode()), indent=2))
|
|
104
|
+
|
|
105
|
+
elif cmd == "find" and len(sys.argv) >= 3:
|
|
106
|
+
col = sys.argv[2]
|
|
107
|
+
query = json.loads(sys.argv[3]) if len(sys.argv) >= 4 else {}
|
|
108
|
+
req = urllib.request.Request(
|
|
109
|
+
f"{API_HOST}/api/v1/db/{col}/find",
|
|
110
|
+
data=json.dumps(query).encode(),
|
|
111
|
+
headers={**get_headers(), "Content-Type": "application/json"},
|
|
112
|
+
method="POST"
|
|
113
|
+
)
|
|
114
|
+
with urllib.request.urlopen(req) as res:
|
|
115
|
+
print(json.dumps(json.loads(res.read().decode()), indent=2))
|
|
116
|
+
|
|
117
|
+
elif cmd == "get" and len(sys.argv) >= 4:
|
|
118
|
+
col = sys.argv[2]
|
|
119
|
+
doc_id = sys.argv[3]
|
|
120
|
+
req = urllib.request.Request(f"{API_HOST}/api/v1/db/{col}/{doc_id}", headers=get_headers())
|
|
121
|
+
with urllib.request.urlopen(req) as res:
|
|
122
|
+
print(json.dumps(json.loads(res.read().decode()), indent=2))
|
|
123
|
+
|
|
124
|
+
elif cmd == "update" and len(sys.argv) >= 5:
|
|
125
|
+
col = sys.argv[2]
|
|
126
|
+
doc_id = sys.argv[3]
|
|
127
|
+
data = json.loads(sys.argv[4])
|
|
128
|
+
req = urllib.request.Request(
|
|
129
|
+
f"{API_HOST}/api/v1/db/{col}/{doc_id}",
|
|
130
|
+
data=json.dumps(data).encode(),
|
|
131
|
+
headers={**get_headers(), "Content-Type": "application/json"},
|
|
132
|
+
method="PUT"
|
|
133
|
+
)
|
|
134
|
+
with urllib.request.urlopen(req) as res:
|
|
135
|
+
print(json.dumps(json.loads(res.read().decode()), indent=2))
|
|
136
|
+
|
|
137
|
+
elif cmd == "delete" and len(sys.argv) >= 4:
|
|
138
|
+
col = sys.argv[2]
|
|
139
|
+
doc_id = sys.argv[3]
|
|
140
|
+
req = urllib.request.Request(f"{API_HOST}/api/v1/db/{col}/{doc_id}", headers=get_headers(), method="DELETE")
|
|
141
|
+
with urllib.request.urlopen(req) as res:
|
|
142
|
+
print(json.dumps(json.loads(res.read().decode()), indent=2))
|
|
143
|
+
|
|
144
|
+
elif cmd == "list-files":
|
|
145
|
+
req = urllib.request.Request(f"{API_HOST}/api/v1/storage/files", headers=get_headers())
|
|
146
|
+
with urllib.request.urlopen(req) as res:
|
|
147
|
+
print(json.dumps(json.loads(res.read().decode()), indent=2))
|
|
148
|
+
|
|
149
|
+
elif cmd == "mcp":
|
|
150
|
+
while True:
|
|
151
|
+
line = sys.stdin.readline()
|
|
152
|
+
if not line:
|
|
153
|
+
break
|
|
154
|
+
try:
|
|
155
|
+
rpc_req = json.loads(line.strip())
|
|
156
|
+
req = urllib.request.Request(
|
|
157
|
+
f"{API_HOST}/mcp",
|
|
158
|
+
data=json.dumps(rpc_req).encode(),
|
|
159
|
+
headers={**get_headers(), "Content-Type": "application/json"},
|
|
160
|
+
method="POST"
|
|
161
|
+
)
|
|
162
|
+
with urllib.request.urlopen(req) as res:
|
|
163
|
+
sys.stdout.write(res.read().decode() + "\n")
|
|
164
|
+
sys.stdout.flush()
|
|
165
|
+
except Exception as e:
|
|
166
|
+
err_resp = {"jsonrpc": "2.0", "id": None, "error": {"code": -32603, "message": str(e)}}
|
|
167
|
+
sys.stdout.write(json.dumps(err_resp) + "\n")
|
|
168
|
+
sys.stdout.flush()
|
|
169
|
+
else:
|
|
170
|
+
print_help()
|
|
171
|
+
|
|
172
|
+
except urllib.error.HTTPError as he:
|
|
173
|
+
print(f"Error [{he.code}]: {he.read().decode()}", file=sys.stderr)
|
|
174
|
+
sys.exit(1)
|
|
175
|
+
except Exception as ex:
|
|
176
|
+
print(f"Error: {ex}", file=sys.stderr)
|
|
177
|
+
sys.exit(1)
|
|
178
|
+
|
|
179
|
+
if __name__ == "__main__":
|
|
180
|
+
main()
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
"""
|
|
2
|
+
YukisDB Official Python SDK
|
|
3
|
+
https://yukisdb.yukiapi.site
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
import os
|
|
7
|
+
import json
|
|
8
|
+
import requests
|
|
9
|
+
from typing import Dict, Any, List, Optional, Union
|
|
10
|
+
|
|
11
|
+
DEFAULT_HOST = "https://yukisdb.yukiapi.site"
|
|
12
|
+
|
|
13
|
+
class Collection:
|
|
14
|
+
def __init__(self, client: "YukisDB", name: str):
|
|
15
|
+
self.client = client
|
|
16
|
+
self.name = name
|
|
17
|
+
|
|
18
|
+
def insert(self, document: Dict[str, Any]) -> Dict[str, Any]:
|
|
19
|
+
"""Insert a JSON document into the collection."""
|
|
20
|
+
url = f"{self.client.base_url}/api/v1/db/{self.name}/insert"
|
|
21
|
+
resp = requests.post(url, json=document, headers=self.client.headers)
|
|
22
|
+
if resp.status_code != 200:
|
|
23
|
+
raise Exception(f"YukisDB Insert Error [{resp.status_code}]: {resp.text}")
|
|
24
|
+
return resp.json()
|
|
25
|
+
|
|
26
|
+
def find(self, query: Optional[Dict[str, Any]] = None, limit: int = 50) -> List[Dict[str, Any]]:
|
|
27
|
+
"""Query documents from the collection matching the filter."""
|
|
28
|
+
url = f"{self.client.base_url}/api/v1/db/{self.name}/find"
|
|
29
|
+
resp = requests.post(url, json=query or {}, headers=self.client.headers, params={"limit": limit})
|
|
30
|
+
if resp.status_code != 200:
|
|
31
|
+
raise Exception(f"YukisDB Find Error [{resp.status_code}]: {resp.text}")
|
|
32
|
+
return resp.json()
|
|
33
|
+
|
|
34
|
+
def get(self, doc_id: str) -> Optional[Dict[str, Any]]:
|
|
35
|
+
"""Retrieve a document by its unique ID."""
|
|
36
|
+
url = f"{self.client.base_url}/api/v1/db/{self.name}/{doc_id}"
|
|
37
|
+
resp = requests.get(url, headers=self.client.headers)
|
|
38
|
+
if resp.status_code == 404:
|
|
39
|
+
return None
|
|
40
|
+
if resp.status_code != 200:
|
|
41
|
+
raise Exception(f"YukisDB Get Error [{resp.status_code}]: {resp.text}")
|
|
42
|
+
return resp.json()
|
|
43
|
+
|
|
44
|
+
def update(self, doc_id: str, update_data: Dict[str, Any]) -> Dict[str, Any]:
|
|
45
|
+
"""Update fields of an existing document."""
|
|
46
|
+
url = f"{self.client.base_url}/api/v1/db/{self.name}/{doc_id}"
|
|
47
|
+
resp = requests.put(url, json=update_data, headers=self.client.headers)
|
|
48
|
+
if resp.status_code != 200:
|
|
49
|
+
raise Exception(f"YukisDB Update Error [{resp.status_code}]: {resp.text}")
|
|
50
|
+
return resp.json()
|
|
51
|
+
|
|
52
|
+
def delete(self, doc_id: str) -> bool:
|
|
53
|
+
"""Delete a document by ID."""
|
|
54
|
+
url = f"{self.client.base_url}/api/v1/db/{self.name}/{doc_id}"
|
|
55
|
+
resp = requests.delete(url, headers=self.client.headers)
|
|
56
|
+
if resp.status_code == 200:
|
|
57
|
+
return True
|
|
58
|
+
if resp.status_code == 404:
|
|
59
|
+
return False
|
|
60
|
+
raise Exception(f"YukisDB Delete Error [{resp.status_code}]: {resp.text}")
|
|
61
|
+
|
|
62
|
+
def aggregate(self, pipeline: List[Dict[str, Any]]) -> List[Dict[str, Any]]:
|
|
63
|
+
"""Execute a multi-stage aggregation pipeline."""
|
|
64
|
+
url = f"{self.client.base_url}/api/v1/db/{self.name}/aggregate"
|
|
65
|
+
resp = requests.post(url, json=pipeline, headers=self.client.headers)
|
|
66
|
+
if resp.status_code != 200:
|
|
67
|
+
raise Exception(f"YukisDB Aggregate Error [{resp.status_code}]: {resp.text}")
|
|
68
|
+
return resp.json()
|
|
69
|
+
|
|
70
|
+
def vector_search(self, vector: List[float], field: str = "embedding", top_k: int = 5) -> List[Dict[str, Any]]:
|
|
71
|
+
"""Execute cosine similarity vector search for AI semantic context."""
|
|
72
|
+
url = f"{self.client.base_url}/api/v1/db/{self.name}/vector-search"
|
|
73
|
+
payload = {"vector": vector, "field": field, "top_k": top_k}
|
|
74
|
+
resp = requests.post(url, json=payload, headers=self.client.headers)
|
|
75
|
+
if resp.status_code != 200:
|
|
76
|
+
raise Exception(f"YukisDB Vector Search Error [{resp.status_code}]: {resp.text}")
|
|
77
|
+
return resp.json()
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
class Storage:
|
|
81
|
+
def __init__(self, client: "YukisDB"):
|
|
82
|
+
self.client = client
|
|
83
|
+
|
|
84
|
+
def upload(self, file_path_or_bytes: Union[str, bytes], filename: Optional[str] = None, custom_slug: Optional[str] = None) -> Dict[str, Any]:
|
|
85
|
+
"""Upload a file or multimedia object (up to 2GB) to YukisDB Object Storage."""
|
|
86
|
+
url = f"{self.client.base_url}/api/v1/storage/upload"
|
|
87
|
+
headers = {"X-API-Key": self.client.api_key} if self.client.api_key else {}
|
|
88
|
+
data = {"custom_slug": custom_slug} if custom_slug else {}
|
|
89
|
+
|
|
90
|
+
if isinstance(file_path_or_bytes, str):
|
|
91
|
+
fname = filename or os.path.basename(file_path_or_bytes)
|
|
92
|
+
with open(file_path_or_bytes, "rb") as f:
|
|
93
|
+
files = {"file": (fname, f)}
|
|
94
|
+
resp = requests.post(url, files=files, data=data, headers=headers)
|
|
95
|
+
else:
|
|
96
|
+
fname = filename or "upload.bin"
|
|
97
|
+
files = {"file": (fname, file_path_or_bytes)}
|
|
98
|
+
resp = requests.post(url, files=files, data=data, headers=headers)
|
|
99
|
+
|
|
100
|
+
if resp.status_code != 200:
|
|
101
|
+
raise Exception(f"YukisDB Storage Upload Error [{resp.status_code}]: {resp.text}")
|
|
102
|
+
return resp.json()
|
|
103
|
+
|
|
104
|
+
def list(self) -> List[Dict[str, Any]]:
|
|
105
|
+
"""List all stored objects."""
|
|
106
|
+
url = f"{self.client.base_url}/api/v1/storage/files"
|
|
107
|
+
resp = requests.get(url, headers=self.client.headers)
|
|
108
|
+
if resp.status_code != 200:
|
|
109
|
+
raise Exception(f"YukisDB Storage List Error [{resp.status_code}]: {resp.text}")
|
|
110
|
+
return resp.json()
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
class Sandbox:
|
|
114
|
+
def __init__(self, client: "YukisDB"):
|
|
115
|
+
self.client = client
|
|
116
|
+
|
|
117
|
+
def insert(self, document: Dict[str, Any]) -> Dict[str, Any]:
|
|
118
|
+
"""Zero-auth test document insert."""
|
|
119
|
+
url = f"{self.client.base_url}/api/v1/sandbox/insert"
|
|
120
|
+
resp = requests.post(url, json=document, headers={"Content-Type": "application/json"})
|
|
121
|
+
if resp.status_code != 200:
|
|
122
|
+
raise Exception(f"YukisDB Sandbox Insert Error [{resp.status_code}]: {resp.text}")
|
|
123
|
+
return resp.json()
|
|
124
|
+
|
|
125
|
+
def find(self, query: Optional[Dict[str, Any]] = None) -> List[Dict[str, Any]]:
|
|
126
|
+
"""Zero-auth test document query."""
|
|
127
|
+
url = f"{self.client.base_url}/api/v1/sandbox/find"
|
|
128
|
+
resp = requests.post(url, json=query or {}, headers={"Content-Type": "application/json"})
|
|
129
|
+
if resp.status_code != 200:
|
|
130
|
+
raise Exception(f"YukisDB Sandbox Find Error [{resp.status_code}]: {resp.text}")
|
|
131
|
+
return resp.json()
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
class YukisDB:
|
|
135
|
+
"""YukisDB Unified Database, 2GB Storage & AI Vector Memory Client."""
|
|
136
|
+
def __init__(self, api_key: Optional[str] = None, base_url: Optional[str] = None):
|
|
137
|
+
self.api_key = api_key or os.getenv("YUKISDB_API_KEY", "")
|
|
138
|
+
self.base_url = (base_url or os.getenv("YUKISDB_HOST", DEFAULT_HOST)).rstrip("/")
|
|
139
|
+
self.headers = {
|
|
140
|
+
"Content-Type": "application/json",
|
|
141
|
+
"User-Agent": "YukisDB-Python-SDK/1.0.0"
|
|
142
|
+
}
|
|
143
|
+
if self.api_key:
|
|
144
|
+
self.headers["Authorization"] = f"Bearer {self.api_key}"
|
|
145
|
+
self.headers["X-API-Key"] = self.api_key
|
|
146
|
+
|
|
147
|
+
self.storage = Storage(self)
|
|
148
|
+
self.sandbox = Sandbox(self)
|
|
149
|
+
|
|
150
|
+
def collection(self, name: str) -> Collection:
|
|
151
|
+
"""Access a database collection."""
|
|
152
|
+
return Collection(self, name)
|
|
153
|
+
|
|
154
|
+
def health(self) -> Dict[str, Any]:
|
|
155
|
+
"""Check cluster operational telemetry."""
|
|
156
|
+
url = f"{self.base_url}/api/v1/health"
|
|
157
|
+
resp = requests.get(url)
|
|
158
|
+
return resp.json()
|
|
159
|
+
|
|
160
|
+
def tier(self) -> Dict[str, Any]:
|
|
161
|
+
"""Get developer tier specifications and quotas."""
|
|
162
|
+
url = f"{self.base_url}/api/v1/public/tier"
|
|
163
|
+
resp = requests.get(url)
|
|
164
|
+
return resp.json()
|
|
165
|
+
|
|
166
|
+
def generate_anonymous_key(self) -> Dict[str, Any]:
|
|
167
|
+
"""Generate an instant ephemeral API key for testing."""
|
|
168
|
+
url = f"{self.base_url}/api/v1/auth/anonymous-key"
|
|
169
|
+
resp = requests.post(url)
|
|
170
|
+
return resp.json()
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: yukisdb
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Official Python SDK & CLI for YukisDB — Unified Cloud NoSQL Database, 2GB Storage & AI Vector BaaS
|
|
5
|
+
Home-page: https://yukisdb.yukiapi.site
|
|
6
|
+
Author: SUDEEPBOTS
|
|
7
|
+
Author-email: support@yukiapi.site
|
|
8
|
+
Project-URL: Documentation, https://yukisdb.yukiapi.site/docs
|
|
9
|
+
Project-URL: Source, https://github.com/SUDEEPBOTS/yukisdb
|
|
10
|
+
Project-URL: Tracker, https://github.com/SUDEEPBOTS/yukisdb/issues
|
|
11
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Topic :: Database
|
|
14
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Operating System :: OS Independent
|
|
23
|
+
Requires-Python: >=3.8
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
Requires-Dist: requests>=2.25.0
|
|
26
|
+
Dynamic: author
|
|
27
|
+
Dynamic: author-email
|
|
28
|
+
Dynamic: classifier
|
|
29
|
+
Dynamic: description
|
|
30
|
+
Dynamic: description-content-type
|
|
31
|
+
Dynamic: home-page
|
|
32
|
+
Dynamic: project-url
|
|
33
|
+
Dynamic: requires-dist
|
|
34
|
+
Dynamic: requires-python
|
|
35
|
+
Dynamic: summary
|
|
36
|
+
|
|
37
|
+
# YukisDB Python SDK & CLI ⚡
|
|
38
|
+
|
|
39
|
+
[](https://pypi.org/project/yukisdb/)
|
|
40
|
+
[](https://opensource.org/licenses/MIT)
|
|
41
|
+
|
|
42
|
+
Official Python SDK & Developer CLI for **[YukisDB](https://yukisdb.yukiapi.site)** — Unified Cloud NoSQL JSON Document Database, 2GB Object Storage with Zero Egress Bandwidth Bills, and AI Vector Embeddings Memory.
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## 📦 Installation
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
pip install yukisdb
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## 💻 CLI Quickstart
|
|
55
|
+
|
|
56
|
+
Once installed, the `yukisdb` command is immediately available in your terminal:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
# Check cluster telemetry & health
|
|
60
|
+
yukisdb health
|
|
61
|
+
|
|
62
|
+
# View developer free tier quotas
|
|
63
|
+
yukisdb tier
|
|
64
|
+
|
|
65
|
+
# Zero-auth sandbox insert
|
|
66
|
+
yukisdb sandbox insert '{"task": "test", "completed": true}'
|
|
67
|
+
|
|
68
|
+
# Zero-auth sandbox query
|
|
69
|
+
yukisdb sandbox find '{"completed": true}'
|
|
70
|
+
|
|
71
|
+
# Generate an ephemeral API testing key
|
|
72
|
+
yukisdb anonymous-key
|
|
73
|
+
|
|
74
|
+
# Authenticated CRUD (requires export YUKISDB_API_KEY=ydb_live_...)
|
|
75
|
+
export YUKISDB_API_KEY="ydb_live_your_key_here"
|
|
76
|
+
yukisdb insert users '{"name": "Sudeep", "role": "admin"}'
|
|
77
|
+
yukisdb find users '{"role": "admin"}'
|
|
78
|
+
yukisdb upload model_checkpoint.pt
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## 🐍 Python SDK Quickstart
|
|
84
|
+
|
|
85
|
+
### 1. Initialize Client
|
|
86
|
+
|
|
87
|
+
```python
|
|
88
|
+
from yukisdb import YukisDB
|
|
89
|
+
|
|
90
|
+
# Automatically picks up YUKISDB_API_KEY environment variable if omitted
|
|
91
|
+
db = YukisDB(api_key="ydb_live_your_api_key_here")
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### 2. NoSQL Document Operations (CRUD)
|
|
95
|
+
|
|
96
|
+
```python
|
|
97
|
+
# Insert a document
|
|
98
|
+
doc = db.collection("users").insert({
|
|
99
|
+
"name": "Alice",
|
|
100
|
+
"email": "alice@example.com",
|
|
101
|
+
"tier": "developer"
|
|
102
|
+
})
|
|
103
|
+
print("Inserted ID:", doc["id"])
|
|
104
|
+
|
|
105
|
+
# Query documents
|
|
106
|
+
users = db.collection("users").find({"tier": "developer"})
|
|
107
|
+
print("Found users:", users)
|
|
108
|
+
|
|
109
|
+
# Retrieve single document by ID
|
|
110
|
+
user = db.collection("users").get(doc["id"])
|
|
111
|
+
|
|
112
|
+
# Update document
|
|
113
|
+
db.collection("users").update(doc["id"], {"tier": "pro"})
|
|
114
|
+
|
|
115
|
+
# Delete document
|
|
116
|
+
db.collection("users").delete(doc["id"])
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### 3. AI Vector Embeddings Search
|
|
120
|
+
|
|
121
|
+
```python
|
|
122
|
+
# Cosine similarity nearest-neighbor search for agent long-term memory
|
|
123
|
+
results = db.collection("agent_memory").vector_search(
|
|
124
|
+
vector=[0.12, -0.45, 0.88, 0.05],
|
|
125
|
+
field="embedding",
|
|
126
|
+
top_k=5
|
|
127
|
+
)
|
|
128
|
+
for match in results:
|
|
129
|
+
print(match["title"], match["_score"])
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### 4. 2GB Object Storage (Zero Egress Bills)
|
|
133
|
+
|
|
134
|
+
```python
|
|
135
|
+
# Upload any file up to 2GB with instant CDN streaming URL
|
|
136
|
+
file_info = db.storage.upload("video_dataset.mp4", custom_slug="dataset-2026")
|
|
137
|
+
print("Public CDN URL:", file_info["url"])
|
|
138
|
+
|
|
139
|
+
# List tenant storage files
|
|
140
|
+
files = db.storage.list()
|
|
141
|
+
print("Storage objects:", files)
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### 5. Zero-Auth Public Sandbox (Prototyping)
|
|
145
|
+
|
|
146
|
+
```python
|
|
147
|
+
# Store without registration
|
|
148
|
+
sandbox_doc = db.sandbox.insert({"experiment": "RAG pipeline test"})
|
|
149
|
+
print("Saved to sandbox:", sandbox_doc)
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## 🤖 Model Context Protocol (MCP) Integration
|
|
155
|
+
|
|
156
|
+
YukisDB runs a native Model Context Protocol (MCP 2024-11-05) server for Claude Desktop, Cursor AI, and autonomous agents:
|
|
157
|
+
|
|
158
|
+
```json
|
|
159
|
+
{
|
|
160
|
+
"mcpServers": {
|
|
161
|
+
"yukisdb": {
|
|
162
|
+
"command": "yukisdb",
|
|
163
|
+
"args": ["mcp"],
|
|
164
|
+
"env": {
|
|
165
|
+
"YUKISDB_API_KEY": "ydb_live_your_api_key_here"
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
Or connect directly to Streamable HTTP: `https://yukisdb.yukiapi.site/mcp`.
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## 🔗 Resources
|
|
177
|
+
|
|
178
|
+
- **Website & Portal:** [https://yukisdb.yukiapi.site](https://yukisdb.yukiapi.site)
|
|
179
|
+
- **Developer Documentation:** [https://yukisdb.yukiapi.site/docs](https://yukisdb.yukiapi.site/docs)
|
|
180
|
+
- **OpenAPI 3.1 Spec:** [https://yukisdb.yukiapi.site/openapi.json](https://yukisdb.yukiapi.site/openapi.json)
|
|
181
|
+
- **LLMs Knowledge Reference:** [https://yukisdb.yukiapi.site/llms.txt](https://yukisdb.yukiapi.site/llms.txt)
|
|
182
|
+
- **Support & Security:** `support@yukiapi.site`
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
setup.py
|
|
3
|
+
yukisdb/__init__.py
|
|
4
|
+
yukisdb/cli.py
|
|
5
|
+
yukisdb/client.py
|
|
6
|
+
yukisdb.egg-info/PKG-INFO
|
|
7
|
+
yukisdb.egg-info/SOURCES.txt
|
|
8
|
+
yukisdb.egg-info/dependency_links.txt
|
|
9
|
+
yukisdb.egg-info/entry_points.txt
|
|
10
|
+
yukisdb.egg-info/requires.txt
|
|
11
|
+
yukisdb.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
requests>=2.25.0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
yukisdb
|