Skip to main content

Keeper is a filesystem-based, content-addressable value store for Python 3.

Installation

$ pip install keeper

Using Keeper

Keeper is constructed with a Storage object. This example uses FileStorage:

from keeper import FileStorage, Keeper

Pass a directory path to a FileStorage instance, and then pass the Storage instance to the Keeper:

with FileStorage("/some/directory/") as storage:
     with Keeper(storage) as k:
        ...

Add string or bytes objects, and get a key in return:

key = self.keeper.add("The quick brown fox jumped over the lazy dog")

Use the key to retrieve the string:

value = keeper[key].as_string()

Add another string with some metadata:

key = keeper.add(text, mime="text/plain", filename="foo.txt", author="Joe Bloggs")

Retrieve metadata:

print(keeper[key].meta.mime)

Add a binary stream you can write to:

with keeper.add_stream() as stream:
     stream.write(b'A large number of bytes')

After the stream has closed, retrieve the key:

key = stream.key

Write cacheing

On slow filesystems, such as USB flash drives, it’s possible to buffer writes in RAM, using a storage intermediary called WriteCacheStorage. Use it like this:

from keeper import FileStorage, WriteCacheStorage, Keeper

with FileStorage("/some/directory/") as file_storage:
    with WriteCacheStorage(file_storage) as cached_storage:
        with Keeper(cached_storage) as k:
            ...

Closing the WriteCacheStorage instance will block until all pending writes have been committed to the underlying FileStorage.

Deployment

To build and deploy a package to PyPI:

$ bumpversion patch
$ python setup.py sdist bdist_wheel
$ twine upload dist/*

Metadata

Release files for keeper 1.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for keeper 1.1.1
File Size Uploaded
keeper-1.1.1.tar.gz 10.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for keeper 1.1.1
File Interpreter ABI Platform
keeper-1.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 22.5 kB

Release files / keeper-1.1.1.tar.gz

Download URL keeper-1.1.1.tar.gz
Size 10.4 kB
Tags Source
SHA-256 checksum
How to use checksums
f3a72d9ac0b6a6f4ab075ff670c3f77b66fc27f173c2479e7ff21afb10568f9a
BLAKE2b-256 checksum
How to use checksums
e233bdf9caa4fdced1d668f7fd91b3d898b275c0549d89e193c4c2be4d8ad8d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.0

Release files / keeper-1.1.1-py3-none-any.whl

Download URL keeper-1.1.1-py3-none-any.whl
Size 12.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dc7570038615adc0a2b6f25df1c06680a963af57f73fdf0901eaad8dcad97010
BLAKE2b-256 checksum
How to use checksums
29857e50d0ee83885ce6ee9b7ad2d0c0d6f77a0f4a6e6c962f55568ee251fc9e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.0

Release history Release notifications | RSS feed

This release

1.1.1 This release

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.97.3

2 release files

0.97.2

2 release files

0.97.1

2 release files

0.97.0

2 release files

0.96.2

2 release files

0.96.1

2 release files

0.96.0

2 release files

0.95

1 release file

0.94

1 release file

0.93

1 release file

0.92

1 release file

0.91

1 release file

0.9

2 release files

0.6.1

2 release files

0.5

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page