Skip to main content

kelvin-app-storage

Redis-backed storage client for Kelvin applications. Keys are automatically prefixed with the application name and version derived from app.yaml.

Installation

pip install kelvin-app-storage

Prerequisites

A running Redis instance is required. For local development:

docker run -d --name redis -p 6379:6379 redis

Quick Start

from kelvin_app_storage import StorageClient

client = StorageClient()

# Store and retrieve values
client.set("sensor_id", "abc-123")
client.get("sensor_id")  # "abc-123"

# List all stored keys
client.list_keys()  # ["myapp_1.0_sensor_id"]

# Print a formatted table of all stored key-value pairs
print(client)

Disable Key Prefixing

By default, keys are prefixed with <app_name>_<app_version>_ derived from app.yaml. To store keys without a prefix:

client = StorageClient(no_prefix=True)

Supported Value Types

The client automatically serializes and deserializes the following types:

Type Storage Format
str Stored as-is
int String representation
float String representation
bool "true" / "false"
list JSON string
dict JSON string
client.set("count", 42)
client.get("count")  # 42

client.set("config", {"threshold": 0.8, "enabled": True})
client.get("config")  # {"threshold": 0.8, "enabled": True}

client.set("tags", ["pressure", "temperature"])
client.get("tags")  # ["pressure", "temperature"]

Configuration

The client is configured via environment variables:

Environment Variable Default Description
KELVIN_APP_STORAGE_HOST kelvin-app-storage.app Redis host
KELVIN_APP_STORAGE_PORT 6379 Redis port
KELVIN_APP_STORAGE_PREFIX Derived from app.yaml Custom key prefix (overrides app.yaml)
KELVIN_APP_STORAGE_LOG_LEVEL INFO Log level (DEBUG or INFO)

Key Prefix via app.yaml

When no custom prefix is set, the key prefix is derived from app.yaml in the current working directory:

info:
  name: myapp
  version: "1.0"

This produces the prefix myapp_1.0, so a key sensor_id becomes myapp_1.0_sensor_id in Redis.

If app.yaml is missing or unreadable, a random UUID is used as the fallback prefix.

API Reference

StorageClient(no_prefix: bool = False)

Creates a new storage client and connects to Redis.

  • no_prefix -- If True, keys are stored without any prefix.
  • Raises ValueError if KELVIN_APP_STORAGE_PORT is not a valid integer.
  • Raises redis.ConnectionError if Redis is unreachable.

client.get(key: str) -> Any

Retrieves and deserializes the value for the given key. Returns None if the key does not exist.

client.set(key: str, value: Any) -> bool

Serializes and stores a value. Returns True on success. Raises TypeError for unsupported value types.

client.list_keys() -> list

Returns all keys currently stored in Redis.

Metadata

Release files for kelvin-app-storage 1.0.1

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

Built distribution (wheel)

Table of built distributions (wheels) for kelvin-app-storage 1.0.1
File Interpreter ABI Platform
kelvin_app_storage-1.0.1-py3-none-any.whl Python 3 none any Details

Release files / kelvin_app_storage-1.0.1-py3-none-any.whl

Download URL kelvin_app_storage-1.0.1-py3-none-any.whl
Size 7.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
12e2e00200a4cff1bf58cffcb7da56de53abe24506109bb21b2841d740116b8a
BLAKE2b-256 checksum
How to use checksums
4a4f02f917859f1492a7c3fe60fba90f44ffd47d75ad03f3ca6109c8c63e203a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for kelvin-app-storage 1.0.1

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.

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