Metadata-Version: 2.4
Name: diskstore
Version: 0.6.0
Summary: Simple MutableMapping compatible SQLite based disk storage.
Keywords: sqlite,diskstore,disk,storage,cache,key-value,kv,database,mutablemapping,apsw,pydantic,dataclasses
Author: tds333
Author-email: tds333 <tds333@mailbox.org>
License-Expression: BSD-3-Clause
License-File: LICENSE.txt
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3.15
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Topic :: Database
Classifier: Topic :: Database :: Database Engines/Servers
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: System :: Filesystems
Classifier: Typing :: Typed
Requires-Dist: apsw>=3.51.3 ; extra == 'apsw'
Requires-Python: >=3.10
Project-URL: Homepage, https://github.com/tds333/diskstore
Project-URL: Documentation, https://tds333.github.io/diskstore/
Project-URL: Source, https://github.com/tds333/diskstore
Project-URL: Changelog, https://github.com/tds333/diskstore/blob/main/docs/CHANGELOG.md
Project-URL: Issues, https://github.com/tds333/diskstore/issues
Project-URL: CI, https://github.com/tds333/diskstore/actions
Provides-Extra: apsw
Description-Content-Type: text/markdown

# DiskStore Sqlite based disk store

`DiskStore` is a BSD-3-Clause licensed disk storage library, written
in pure Python.

Inspired by DiskCache library it implements a MutableMapping compatible sqlite
based disk storage. Easy interface and very fast. Keys can be of basic sqlite storage
classes defined by Python types `int`, `float`, `str`, `bytes`. Values can be of basic sqlite
type or with custom configuration, supproting dataclasses, structtype, pydantic, ...


## Features

- Pure-Python
- nearly 100% test coverage
- Performance matters
- Thread-safe and process-safe
- Developed on Python 3.15
- Tested on CPython 3.10, 3.11, 3.12, 3.13, 3.14, 3.15
- Optional performance improved implementation bases on apsw.


## Quickstart

Installing `DiskStore`:

  $ uv pip install diskstore

or

  $ uv add diskstore

There are three basic storage classes available.
`DiskStore`, `DiskRead` and `DiskCache`.

## User Guide

Work in progress, look at unit tests for examples.

Example:

```python

from diskstore import DiskStore

ds = DiskStore("/tmp/diskstore.db")
ds["key"] = "my value"
print(ds["key"])

```

See the `docs/` directory for the user guide and API reference.

### Timings

These are rough measurements. Compared to Diskcache library.

Diskstore library:

set: 28.8 µs
get: 3.23 µs
set/delete: 84 µs

Diskcache library:

set: 196 µs
get: 15.5 µs
set/delete: 535 µs


Why is the Diskstore library faster than others. Overhead is eliminated and 
operations where optimized. If [APSW](https://rogerbinns.github.io/apsw/)
is installed (`pip install diskstore[apsw]`) it is used automatically
for furhter performance improvements.


License
-------

`DiskStore` is distributed under the terms of the
[BSD-3-Clause](https://spdx.org/licenses/BSD-3-Clause.html) license.

Copyright 2025-2026 Wolfgang Langner
