Partd is a Python library that provides appendable key-value storage, primarily for raw bytes. It excels at shuffling operations, allowing efficient appending of data to existing values associated with a key. The current version is 1.4.2, and it appears to have a stable, though not rapid, release cadence, with the latest update in May 2024.
pip install partdVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize a file-backed Partd instance, append byte data to keys, and retrieve the accumulated data. It also includes an example of using `partd.numpy.Numpy` to store and retrieve NumPy arrays, abstracting away the byte serialization. Remember to call `.drop()` to clean up file-backed Partd stores.
Use `from partd.python import Python` for general Python objects or `from partd.numpy import Numpy` for NumPy arrays, composing them with your chosen Partd implementation (e.g., `p = Python(File('my_python_data'))`).Consider using `partd.buffer.Buffer` for in-memory caching or explore `partd.zmq` (which requires `pyzmq`) for a centralized server solution when dealing with numerous small, concurrent writes to improve performance and consistency.
Always include `partd_instance.drop()` in your cleanup routine or context manager when using file-backed Partd implementations.
Install `numpy` in your environment using `pip install numpy`. Ensure your test environment or application setup includes `numpy` as a dependency if you intend to use `partd.numpy` features.
Install `numpy` using `pip install numpy` in your environment before running the tests or application.
pip install partd
from partd import File
Refer to the `partd` documentation for correct usage, typically using `p.get(key)` to retrieve data from a `partd.File` object.
from partd import File; p = File(); p.append(b'mykey', b'myvalue') # or 'myvalue'.encode('utf-8')from partd import File; store = File() # Instantiate a concrete implementation like File, Buffer, or Dict