upstash-redis
Serverless Redis SDK from Upstash
What it is and what it does
upstash-redis is a Python client library that communicates with Redis through HTTP requests to the Upstash REST API rather than establishing direct TCP connections. It's purpose-built for serverless platforms where persistent TCP connections are impractical or unavailable, such as AWS Lambda, Vercel, and Google Cloud Functions. The library provides both synchronous and asynchronous interfaces, supporting standard Redis commands including streams, pipelines, transactions, and custom commands.
The package depends only on httpx for HTTP communication and requires Python 3.8 or later. It handles connection credentials via environment variables or explicit parameters, includes automatic retry logic with configurable intervals, and supports optional base64 encoding for data serialization. The library is in GA stage and receives regular maintenance and bug fixes from Upstash's professional support team.
Use it for:
- Cache layer in AWS Lambda functions where TCP connections are ephemeral or cost-prohibitive.
- Session storage in Vercel serverless functions using Redis Streams for real-time data handling.
- Distributed task queues in Google Cloud Functions leveraging Redis pipelines and transactions.
- Rate limiting and counters in serverless APIs without managing persistent connection pools.
- Real-time event processing with Redis Streams consumer groups in containerized serverless environments.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
HTTP-based Redis client for Python that connects to Upstash Redis via REST API instead of TCP, designed for serverless environments like AWS Lambda and Google Cloud Functions.
Yes. The package is actively maintained, has no known vulnerabilities, installs with minimal friction (one dependency), and fills a genuine gap for serverless Python applications needing Redis. The MIT license imposes no restrictions. Install it if you're building on serverless platforms and need Redis caching or data structures; skip it if you have persistent TCP connectivity and prefer the lower latency of direct Redis connections.
Install
upstash-redis on PyPI
pip
pip install upstash-redisuv
uv add upstash-redispoetry
poetry add upstash-redisInstalling upstash-redis
Before you install
Low friction: single runtime dependency (httpx), pure Python wheel, actively maintained with recent commits and regular updates under Upstash Professional Support.
License in practice
MIT license permits commercial and private use with minimal restrictions; you may use, modify, and distribute this package freely provided you include the license notice.
Quickstart
pip install upstash-redis
from upstash_redis import Redis
redis = Redis.from_env()
redis.set("key", "value")
print(redis.get("key"))
Requires UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN environment variables or explicit url/token parameters; an active Upstash Redis database is required.
Verify before relying
- Performance characteristics compared to TCP-based Redis clients in non-serverless environments.
- Whether the retry mechanism (default: one retry after 3 seconds) is configurable for specific use cases.
- Telemetry data collection scope and whether it impacts privacy-sensitive deployments.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (<4.0,>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — httpx |
| Maintenance | actively maintained — 149 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 814,749/month — #4,991 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: upstash_redis-1.7.0-py3-none-any.whl
Keywords: Upstash Redis, Serverless Redis
Tags
More Libraries packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
python-dateutilProvides parsing, arithmetic, and recurrence…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
qstashPython SDK for publishing and receiving…
permissive · top 15,000 on PyPI
upstash-ratelimitProvides connectionless rate limiting for…
permissive · top 15,000 on PyPI
upstash-vectorPython client for Upstash Vector, a serverless…
permissive · top 15,000 on PyPI
redis-cliProvides a lightweight wrapper around redis-py…
permissive · top 15,000 on PyPI
powerbot-clientPowerBot client library for synchronous…
unclear · top 15,000 on PyPI
aioredisAn asyncio-based Redis client library providing…
permissive · top 5,000 on PyPI
pydocketDocket is a distributed background task system…
permissive · top 5,000 on PyPI
fakeredisfakeredis provides an in-memory, pure-Python…
permissive · top 1,000 on PyPI
redisPython client library for connecting to and…
permissive · top 1,000 on PyPI
google-cloud-redis-clusterPython client library for creating and managing…
permissive · top 15,000 on PyPI