Metadata-Version: 2.1
Name: sqlite-dic
Version: 0.0.0
Summary: A lightweight SQLite-backed database that can be used like a Python dictionary.
Home-page: https://github.co.jp/
Author: bib_inf
Author-email: contact.bibinf@gmail.com
License: CC0 v1.0
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development :: Libraries
Classifier: License :: CC0 1.0 Universal (CC0 1.0) Public Domain Dedication
Description-Content-Type: text/markdown
Requires-Dist: ezpip

English description follows Japanese.

---

Pythonの辞書のように使える、SQLiteバックエンドの軽量キーバリューストアです。

## 概要
- `sqlite-dic` は、SQLiteデータベースをPythonの辞書と同じ感覚で操作できるライブラリです。値にはJSONシリアライズ可能な任意の型（文字列、数値、真偽値、リスト、辞書、`None`）を格納できます。
- 内部ではSQLiteのWAL（Write-Ahead Logging）モードを使用しており、読み書きの並列アクセスが可能です。すべての操作はスレッドセーフです。
- AIでのコーディングにおいてこのツールを使用するときは、そのままこのドキュメントをプロンプトに含めることで、AIにこのDBを使ってコーディングしてもらうことが可能です。

## インストール

```bash
pip install sqlite-dic
```

## 使い方

```python
import sqlite_dic

# データベースを開く（存在しなければ自動作成）
db = sqlite_dic("./sample.db")

# 値の追加・更新 — 辞書と同じ書き方
db["count"] = 33
db["config"] = {"theme": "dark", "lang": "ja"}

# 値の取得
print(db["count"])    # 33
print(db["config"])   # {'theme': 'dark', 'lang': 'ja'}

# エントリの削除
del db["count"]

# 格納数の確認
print(len(db))        # 1
```

## 制約
- **キー** は文字列のみ使用可能です。
- **値** はJSONシリアライズ可能な型（`dict`、`list`、`str`、`int`、`float`、`bool`、`None`）に限ります。
- 同時書き込みはSQLiteのファイルロックにより直列化されます（busy timeout: 30秒）。

---

A lightweight key-value store backed by SQLite, with a Python `dict`-like interface.

## Overview
- `sqlite-dic` lets you use an SQLite database as if it were a regular Python dictionary. Values can be any JSON-serializable type, so you can store strings, numbers, booleans, lists, dicts, and `None` without any extra setup.
- Under the hood, SQLite's WAL (Write-Ahead Logging) mode provides concurrent read/write access, and all operations are thread-safe.

## Installation
```bash
pip install sqlite-dic
```

## Quick Start
```python
import sqlite_dic

# Open (or create) a database
db = sqlite_dic("./sample.db")

# Set values — just like a dict
db["count"] = 33
db["config"] = {"theme": "dark", "lang": "en"}

# Get values
print(db["count"])    # 33
print(db["config"])   # {'theme': 'dark', 'lang': 'en'}

# Delete an entry
del db["count"]

# Check the number of stored entries
print(len(db))        # 1
```

## Constraints
- **Keys** must be strings.
- **Values** must be JSON-serializable (`dict`, `list`, `str`, `int`, `float`, `bool`, or `None`).
- Concurrent writes are serialized by SQLite's file lock (busy timeout: 30 seconds).
