Official Python SDK for Prithvi in-memory key-value database.
Project description
Prithvi Python SDK
Official Python SDK for Prithvi — a fast, in-memory key-value database built from scratch in Java.
This SDK allows Python developers to easily connect and interact with a running Prithvi server over TCP.
Features
- Easy connection to Prithvi server over TCP
- Support for all major commands:
SET,GET,DEL,EXISTS,KEYS- List ops:
LPUSH,RPUSH,LPOP,RPOP,GETLIST - Set ops:
SADD,SREM,SMEMBERS - Persistence:
SAVE,LOAD,FLUSH - Auth:
AUTH,TOKEN
- Auto-reconnect with retry logic
- Token storage and reuse
- Tiny and dependency-free
Installation
pip install prithvi-py-sdk
Usage
from prithvi_client import PrithviClient
client = PrithviClient("127.0.0.1", 1902)
client.connect()
print(client.auth("sidharth")) # Authenticate and store token
print(client.token()) # Send stored token for verification
print(client.set("mykey", "myvalue")) # Store key
print(client.get("mykey")) # Retrieve key
print(client.lpush("mylist", "1")) # Push to list
print(client.get_list("mylist")) # Get list
client.close() # Close connection
Auth Flow
client.auth("your-username") # Receives and stores JWT-style token
client.token() # Verifies with stored token
Available Commands
| Type | Methods |
|---|---|
| Keys | set, get, del, exists, keys |
| Lists | lpush, rpush, lpop, rpop, get_list |
| Sets | sadd, srem, smembers |
| Auth | auth, token, get_stored_token |
| System | save, load, flush, quit, help, close |
Requirements
- Python 3.7+
- A running Prithvi Server on port
1902
Contributing
Pull requests are welcome. For major changes, open an issue first to discuss what you want to change.
License
💡 About Prithvi
Prithvi is a custom-built, lightweight, Redis-like in-memory key-value store with TTL, LRU cache, multithreading, authentication, and persistence.
🔗 GitHub: github.com/psidh/prithvi
---
Project details
Release history Release notifications | RSS feed
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 prithvi_py_sdk-0.1.0.tar.gz.
File metadata
- Download URL: prithvi_py_sdk-0.1.0.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
754a793b052c1e18299778da4649beb7f7f6cc68167f872d9718185eb1a9c98e
|
|
| MD5 |
dad2b644a1840c6fb625011663c1e96d
|
|
| BLAKE2b-256 |
c25a3d2a030306bfb0377391226da7b5f68821bfc9807c2e5003d4c00dc384bd
|
File details
Details for the file prithvi_py_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: prithvi_py_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1ea6cf7a653d6782ebf7897bf5bc995235b581807f44113bb63754a555e3c0da
|
|
| MD5 |
5e0d064bffa6490bebd97275043d1c20
|
|
| BLAKE2b-256 |
d1cebcbed69222162753792bc314ae9be9f946ec94944dea5b96700c667f4554
|