Skip to content

polykv/polykv-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PolyKV - Python

PyPI version License Stars

Native Key-Value Store for Python.

A lightweight, modern persistence layer. Perfect for CLI tools, bots, and small web services that need simple state management without a heavy database.

One API, Everywhere. This library is part of the PolyKV ecosystem. Use the same consistent API across 12+ languages.

✨ Why PolyKV Python?

  • ⚡️ Flexible I/O Supports both asyncio for modern apps and synchronous mode for simple scripts.

  • 🐍 Pure Python Zero binary dependencies. easy to install, easy to bundle, works everywhere Python works.

  • 📂 XDG Compliant Automatically respects standard configuration paths (XDG on Linux, Library on macOS) so your app behaves like a good citizen.

📦 Installation

pip install polykv

🚀 Usage

Complete Async Example

import asyncio
from polykv import PolyKV

async def main():
    # Zero Config - just give it a namespace
    db = PolyKV("BotConfig")

    # 1. Save
    await db.set_string("token", "secret-123")
    await db.set_number("retries", 5)

    # 2. Read
    token = await db.get_string("token")
    print(f"Token: {token}")

    # 3. Clear
    await db.clear()

if __name__ == "__main__":
    asyncio.run(main())

Synchronous Example

from polykv import PolyKVSync

def main():
    db = PolyKVSync("MyScript")
    db.set_string("mode", "batch")
    print(db.get_string("mode"))

if __name__ == "__main__":
    main()

📂 Storage Locations

  • macOS: ~/Library/Preferences/BotConfig/BotConfig.json
  • Linux: ~/.config/BotConfig/BotConfig.json
  • Windows: %APPDATA%\BotConfig\BotConfig.json

🌍 Platform Support

Language Verified Runtime (✅) Build Only (🛠)
TypeScript CLI (Node.js), Browser, React Native (iOS/Android) -
Dart Flutter (iOS/Android/macOS), CLI -
Go macOS, Linux, Windows, iOS, Android, CLI -
Rust macOS, iOS, Android, CLI Linux, Windows
Swift iOS, macOS, CLI -
C++ macOS, iOS, Android, CLI -
Python CLI, Web, Android -
Kotlin CLI, Web, Android -
C# CLI Android, Windows
Java CLI, Android -
Ruby CLI -
PHP CLI -

✅ Runtime Verified: Full CRUD operations verified via automated tests on actual devices/simulators.

📜 License

MIT

About

Zero-Config, Native Key-Value Store for Python

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages