Skip to main content

prefect-kv

PyPI

Welcome!

A simple key-value store for use with Prefect.

Getting Started

Python setup

Requires an installation of Python 3.7+.

We recommend using a Python virtual environment manager such as pipenv, conda or virtualenv.

These tasks are designed to work with Prefect 2.0. For more information about how to use Prefect, please refer to the Prefect documentation.

Installation

Install prefect-kv with pip:

pip install prefect-kv

Using a key-value store

The entire store is saved to Prefect's API each time a key is updated. Each time a key is read, the entire store is loaded from Prefect's API. This exposes a simple way to persist and retrieve values across flow runs and tasks, independently of your dataflow.

from prefect_kv import KVStore

# Create a new KV store named 'demo-store'
store = KVStore(name="demo-store")

# Set a value in the store
store.set("foo", "test")

# Get a value from the store
print(store.get("foo"))

# Get a value from the store with a default
print(store.get("does-not-exist, "that's okay!"))

# Set a value in the store using item syntax
store["bar"] = "another test"

# Get a value from the store using item syntax
print(store["bar"])

# View the whole store
print(f"Here's the whole thing: {store.dict()}")

If you exit the process and create a new store object with same name, you will still be able to access your values:

from prefect_kv import KVStore

# Get the existing KV store named 'demo-store'
store = KVStore(name="demo-store")

print(store["foo"])
print(store["bar"])

Resources

If you encounter any bugs while using prefect-kv, feel free to open an issue in the prefect-kv repository.

If you have any questions or issues while using prefect-kv, you can find help in either the Prefect Discourse forum or the Prefect Slack community.

Feel free to ⭐️ or watch prefect-kv for updates too!

Development

If you'd like to install a version of prefect-kv for development, clone the repository and perform an editable install with pip:

git clone https://github.com/madkinsz/prefect-kv.git

cd prefect-kv/

pip install -e ".[dev]"

# Install linting pre-commit hooks
pre-commit install

Metadata

Release files for prefect-kv 0.1.0

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

Source distribution (sdist)

Source distribution for prefect-kv 0.1.0
File Size Uploaded Provenance
prefect-kv-0.1.0.tar.gz 26.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for prefect-kv 0.1.0
File Interpreter ABI Platform
prefect_kv-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 35.7 kB

Release files / prefect-kv-0.1.0.tar.gz

Download URL prefect-kv-0.1.0.tar.gz
Size 26.2 kB
Tags Source
SHA-256 checksum
How to use checksums
6bbb35c817cd79d0a9b4b423a0548aad9440ca41fe3aeb36dea5acaf713fc83b
BLAKE2b-256 checksum
How to use checksums
3918eb2a0ffb24935778a331e6ae6bfdf667d29abd874b01ce9059f4155876b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.15

Release files / prefect_kv-0.1.0-py3-none-any.whl

Download URL prefect_kv-0.1.0-py3-none-any.whl
Size 9.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9461ac38a3cc7fba4803e186a3aee4f9dc4ebbb58a88bf4b2e22e048e7e8496a
BLAKE2b-256 checksum
How to use checksums
432ac11fa87f0eda6229b23a8b49cb74f000a6e9446f39be555cfb87fd5bfac5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.15

Security for prefect-kv 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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