{"id":105,"library":"upstash","title":"Upstash Python SDK","description":"Unified Python SDK for Upstash cloud services including Redis, Vector, QStash, and Workflow. Provides serverless-friendly clients optimized for edge and serverless environments with HTTP-based connections. Replaces the older individual packages (upstash-redis, upstash-vector, upstash-qstash).","status":"active","version":"1.2.0","language":"python","source_language":"en","source_url":"https://github.com/upstash/upstash-python","tags":["upstash","redis","vector","qstash","serverless","edge","database","python"],"install":[{"cmd":"pip install upstash","lang":"bash","label":"Python (unified SDK)"},{"cmd":"pip install upstash-redis","lang":"bash","label":"Python (Redis only, legacy)"},{"cmd":"pip install upstash-vector","lang":"bash","label":"Python (Vector only, legacy)"},{"cmd":"pip install upstash-qstash","lang":"bash","label":"Python (QStash only, legacy)"}],"dependencies":[{"reason":"Used as the HTTP transport layer for all Upstash API calls.","package":"httpx","optional":false}],"imports":[{"note":"Redis client is imported from upstash_redis, not from the top-level upstash module.","wrong":"from upstash import Redis","symbol":"Redis","correct":"from upstash_redis import Redis"},{"note":"Vector client is the Index class from upstash_vector.","wrong":"from upstash import Vector","symbol":"Index","correct":"from upstash_vector import Index"},{"note":"QStash client is imported from upstash_qstash submodule.","symbol":"QStash","correct":"from upstash_qstash import QStash"}],"quickstart":{"code":"import os\nfrom upstash_redis import Redis\n\nredis = Redis(\n    url=os.environ.get('UPSTASH_REDIS_REST_URL', ''),\n    token=os.environ.get('UPSTASH_REDIS_REST_TOKEN', '')\n)\n\nredis.set('greeting', 'Hello from Upstash!')\nvalue = redis.get('greeting')\nprint(value)","lang":"python","description":"Minimal Redis set/get using the Upstash Redis client with HTTP-based connection."},"warnings":[{"fix":"Use QStash for pub/sub messaging patterns instead of Redis SUBSCRIBE.","message":"Upstash Redis uses HTTP REST calls, not the Redis wire protocol. Standard redis-py commands that rely on persistent TCP connections (SUBSCRIBE, BLPOP, WATCH) are not supported.","severity":"gotcha","affected_versions":"all"},{"fix":"Use the REST URL from the Upstash console (https://...upstash.io), not the redis:// connection string.","message":"Redis.from_env() reads UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN from environment. These must be the REST endpoint, not the standard Redis port 6379 URL.","severity":"gotcha","affected_versions":"all"},{"fix":"from upstash_redis import Redis","message":"The unified 'upstash' package changed internal module structure. Imports like 'from upstash.redis import Redis' do not work. Use 'from upstash_redis import Redis'.","severity":"breaking","affected_versions":"all"},{"fix":"Always check for None when reading keys: value = redis.get('key') or 'default'","message":"Redis.get() returns None for missing keys, not raising a KeyError. Pipeline results are returned as a list, not individual values.","severity":"gotcha","affected_versions":"all"},{"fix":"pipe = redis.pipeline(); pipe.set('a', '1'); pipe.get('a'); results = pipe.execute()","message":"Each Redis command makes an individual HTTP request. Use pipelines to batch multiple commands and reduce latency.","severity":"gotcha","affected_versions":"all"},{"fix":"Continue to use 'pip install upstash-redis' (or other specific Upstash SDKs like upstash-vector, upstash-qstash) until the unified 'upstash' package is officially released and available for your platform.","message":"While the separate upstash-redis, upstash-vector, and upstash-qstash packages are being consolidated, the unified 'upstash' package is not yet available for installation on PyPI or for the specified Python environment (python:3.13-alpine). Attempting 'pip install upstash' will result in 'No matching distribution found'.","severity":"breaking","affected_versions":"all"}],"env_vars":[{"name":"UPSTASH_REDIS_REST_URL","required":true,"description":"REST URL for your Upstash Redis database. Found in the Upstash console."},{"name":"UPSTASH_REDIS_REST_TOKEN","required":true,"description":"REST token for authenticating with your Upstash Redis database."},{"name":"UPSTASH_VECTOR_REST_URL","required":false,"description":"REST URL for your Upstash Vector index."},{"name":"UPSTASH_VECTOR_REST_TOKEN","required":false,"description":"REST token for authenticating with your Upstash Vector index."},{"name":"QSTASH_TOKEN","required":false,"description":"Authentication token for QStash messaging service."}],"search_vec":"'base':31 'client':21 'cloud':9 'connect':32 'databas':53 'edg':24,52 'environ':27 'friend':20 'http':30 'http-base':29 'includ':11 'individu':36 'older':35 'optim':22 'packag':37 'provid':17 'python':2,5,54 'qstash':14,46,50 'redi':12,40,48 'replac':33 'sdk':3,6 'serverless':19,26,51 'serverless-friend':18 'servic':10 'unifi':4 'upstash':1,8,39,42,45,47 'upstash-qstash':44 'upstash-redi':38 'upstash-vector':41 'vector':13,43,49 'workflow':16","created_at":"2026-03-18T02:51:47.771114+00:00","updated_at":"2026-04-16T23:59:06.949848+00:00","problems":{"verify_error":"× No solution found when resolving dependencies:\n  ╰─▶ Because upstash was not found in the package registry and you require upstash, we can conclude that your requirements are unsatisfiable."},"ecosystem":"pypi","meta_description":null,"install_score":100,"quickstart_score":0,"quickstart_tag":"stale","pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":"https://upstash.com","github":null,"docs":null,"changelog":null,"pypi":null,"npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["database","vector-search","workflow","devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-27","last_verified":"2026-08-26","next_check":"2026-07-04","install_tag":"verified"}}