Skip to main content

fastfoundry-redis

Redis connection building blocks for the fastfoundry ecosystem.

Part of the fastfoundry.* namespace (fastfoundry-settings, fastfoundry-postgres, …).

An async redis-py connection pool and client lifecycle for a single Redis server, and a configuration model that plugs into fastfoundry.settings.

Install

pip install fastfoundry-redis
# or
uv add fastfoundry-redis

Requires Python 3.12+.

Configuration

RedisCfg holds the connection parameters. It is designed to nest inside a fastfoundry.settings.BaseAppSettings subclass, so the values load from the environment with the rest of your service configuration, then get handed to redis_pool_ctx:

from fastfoundry.settings import BaseAppSettings
from fastfoundry.redis import RedisCfg


class Settings(BaseAppSettings):
    redis: RedisCfg


settings = Settings()

With the FF_ prefix and __ nested delimiter that BaseAppSettings applies, the fields are read from the environment as FF_REDIS__HOST, FF_REDIS__PORT, FF_REDIS__DB, and so on. password is optional (omit it for a server without auth).

Connection pool & client lifecycle

Open redis_pool_ctx(settings.redis) once for the application lifetime — it builds the connection pool, publishes it for ambient access (get_pool() and redis_cfg()), and disconnects it on exit. For FastAPI, wire it into the lifespan:

from contextlib import asynccontextmanager
from collections.abc import AsyncGenerator

from fastapi import FastAPI
from fastfoundry.redis import redis_pool_ctx

from app.settings import settings


@asynccontextmanager
async def lifespan(_: FastAPI) -> AsyncGenerator[None, None]:
    async with redis_pool_ctx(settings.redis):
        yield


app = FastAPI(lifespan=lifespan)

Acquire a client with redis_client; it draws a connection from the pool and returns it on exit. Responses are decoded to str by default (decode_responses=True):

from fastfoundry.redis import redis_client


async with redis_client() as rc:
    await rc.set("key", "value")
    value = await rc.get("key")

Development

mise run install     # uv sync --dev
mise run lint        # ruff check
mise run typecheck   # mypy --strict
mise run test        # pytest
mise run build       # uv build (sdist + wheel)

License

MIT

Metadata

Release files for fastfoundry-redis 1.0.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 fastfoundry-redis 1.0.1
File Size Uploaded Provenance Actions
fastfoundry_redis-1.0.1.tar.gz 5.5 kB With provenance Details for fastfoundry_redis-1.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for fastfoundry-redis 1.0.1
File Interpreter ABI Platform Actions
fastfoundry_redis-1.0.1-py3-none-any.whl Python 3 none any Details for fastfoundry_redis-1.0.1-py3-none-any.whl

Total release size: 11.8 kB

Release files / fastfoundry_redis-1.0.1.tar.gz

Download URL fastfoundry_redis-1.0.1.tar.gz
Size 5.5 kB
Tags Source
SHA-256 checksum
How to use checksums
12deeb93c040d8eace8449ad81bf2dfbbf95e034853cba8789adc71c32e595fb
BLAKE2b-256 checksum
How to use checksums
0765d322ef69489915c678978d65cc606f973429e4366ef3c4370480f8935330
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 14, 2026.

Transparency log

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

Download URL fastfoundry_redis-1.0.1-py3-none-any.whl
Size 6.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ba725e57db7ec6f591812d507c0174247f20c705f3aa95bb82a213c87c694e22
BLAKE2b-256 checksum
How to use checksums
377ddf9a82c560e0479d8e0f56c086c5a02845b79246b0e85f5d82fdc384ad1b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 14, 2026.

Transparency log

Security for fastfoundry-redis 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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for fastfoundry_redis-1.0.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 14, 2026.

Transparency log

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files Full 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