Registry / database / redislite

redislite

JSON →
library6.2.912183pypypi✓ verified 86d ago

redislite embeds a Redis server into a Python package, allowing you to run Redis without a separate server process. Current version 6.2.912183 supports Python >=3.8.0 and is actively maintained. It provides a drop-in replacement for redis-py's StrictRedis and Redis classes.

pip install redislite
INSTALL
IMPORT
SIG · REDISLITE
R
redislite
databasepythonv6.2.912183
Install
2.5s avg
Import
643ms
Disk
33MB
Pass rate
4/ 10
Env Coverage4 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v6.2.912183 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✕ build_error
✓ 2.3s
py 3.11
✕ build_error
✓ 2.4s
py 3.12
✕ build_error
✓ 2.7s
py 3.13
✕ build_error
✕ build_error
py 3.9
✕ build_error
✓ 2.5s
33MB installed
● package 33MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

StrictRedis
from redislite import StrictRedis
from redis import StrictRedis
redislite replaces the standard redis-py client; importing from redis will not use the embedded server.
Redis
from redislite import Redis
from redis import Redis
Same as above; always import from redislite to get the embedded server behavior.

Create a Redis client with an embedded server. The first argument is an optional path to a database file.

from redislite import StrictRedis # Creates a Redis instance with an embedded server; data stored in a temp file r = StrictRedis() r.set('foo', 'bar') print(r.get('foo')) # b'bar' # Custom path for persistence r2 = StrictRedis('mydata.db') r2.set('key', 'value')
Debug
Known issues
breakingIn redislite, the `from_url` classmethod is not available. Use `StrictRedis.from_url()` does not exist; configure via constructor arguments instead.
fix
Initialize with parameters directly: `StrictRedis(host='localhost', port=6379)` or use `StrictRedis()` for embedded server.
affects: all
gotcharedislite does not support Redis Sentinel or Redis Cluster. Trying to use sentinel-related classes will fail or behave unexpectedly.
fix
Use standard redis-py with a real Redis server if you need Sentinel or Cluster.
affects: all
deprecatedPython 3.7 and earlier are no longer supported in redislite >=6.0.0.
fix
Upgrade to Python >=3.8 or pin redislite to <6.0.0.
affects: >=6.0.0
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'redislite'
redislite is not installed.
fix
Run `pip install redislite`.
AttributeError: module 'redislite' has no attribute 'Redis'
Import error: using `import redislite` and then `redislite.Redis` instead of `from redislite import Redis`.
fix
Use `from redislite import Redis`.
ValueError: The 'db' argument is not supported by redislite. Use a file path.
Passing a Redis database number (e.g., db=0) to the constructor, which is not supported.
fix
Pass a file path string as the first argument to persist data, or use no argument for a temporary database.
Upgrade
Version history
6.2.912183latest on PyPI · released Dec 1, 2023
Audit
Dependencies

No dependency data recorded yet.

Agent activity
13 hits · last 30 days
node
10
Resources
redislite — pip install redislite · libregistry