fakeredis 2.37.0


pip install fakeredis

  Latest version

Released: Jul 22, 2026


Meta
Author: Daniel Moran, Bruce Merry, James Saryerwinnie
Maintainer: Daniel Moran
Requires Python: >=3.7

Classifiers

Development Status
  • 5 - Production/Stable
  • 6 - Mature

Intended Audience
  • Developers

License
  • OSI Approved :: BSD License

Operating System
  • OS Independent

Programming Language
  • Python
  • Python :: 3.9
  • Python :: 3.10
  • Python :: 3.11
  • Python :: 3.12
  • Python :: 3.13
  • Python :: 3.14
  • Python :: 3.15

Topic
  • Software Development :: Libraries :: Python Modules
fakeredis

A fast, pure-Python implementation of the Redis protocol — no server required.

PyPI version CI Coverage Downloads Python versions License Open Source Helpers

Documentation · Supported commands · Changelog · Sponsor


fakeredis is a drop-in replacement for redis-py and valkey-py that runs entirely in-memory. Write tests that depend on Redis, Valkey, DragonflyDB, or KeyDB — without spinning up a real server, a container, or a network connection.

import fakeredis

r = fakeredis.FakeStrictRedis()
r.set("foo", "bar")
r.get("foo")  # b'bar'

That's it. No server to install, no port to manage, no teardown.

✨ Why fakeredis?

  • 🚀 Zero setup — no Redis server, Docker, or network required. Pure Python.
  • 🔌 Drop-in compatible — same API as redis.Redis and redis.asyncio.Redis.
  • Fast & isolated — in-memory, so tests run quickly and start from a clean slate.
  • 🧩 Multi-backend — emulate Redis, Valkey, DragonflyDB, or KeyDB, and pin a specific server version.
  • 📦 Redis Stack support — JSON, Bloom/Cuckoo filters, TimeSeries, and Geo commands.
  • 🤝 Share or isolate state — one shared in-memory server across clients, or independent servers per test.

📥 Installation

pip install fakeredis

Optional extras enable additional command families:

pip install "fakeredis[lua]"          # EVAL / EVALSHA scripting
pip install "fakeredis[json]"         # JSON.* commands
pip install "fakeredis[bf]"           # Bloom / Cuckoo / Count-Min / Top-K filters
pip install "fakeredis[probabilistic]"  # alias for the probabilistic filters
pip install "fakeredis[valkey]"       # Valkey client compatibility

🚀 Quickstart

Use it like redis.Redis:

import fakeredis

r = fakeredis.FakeStrictRedis()
r.lpush("queue", "a", "b", "c")
r.lrange("queue", 0, -1)  # [b'c', b'b', b'a']

Share one in-memory server between clients:

server = fakeredis.FakeServer()
r1 = fakeredis.FakeStrictRedis(server=server)
r2 = fakeredis.FakeStrictRedis(server=server)

r1.set("greeting", "hello")
r2.get("greeting")  # b'hello' — same underlying data

Async is supported too:

import fakeredis

async def main():
    r = fakeredis.FakeAsyncRedis()
    await r.set("foo", "bar")
    await r.get("foo")  # b'bar'

Pin a server type and version:

# Behave like Redis 6...
r = fakeredis.FakeStrictRedis(version=6)
# ...or like Valkey
r = fakeredis.FakeStrictRedis(server_type="valkey")

Using it in tests (pytest)

import pytest
import fakeredis

@pytest.fixture
def redis_client():
    return fakeredis.FakeStrictRedis()

def test_cache_set(redis_client):
    redis_client.set("user:1", "alice")
    assert redis_client.get("user:1") == b"alice"

See the official documentation for the full list of supported commands and configuration options.

❤️ Sponsor

fakeredis-py is developed and maintained for free. If it saves you time, please consider becoming a sponsor — it directly supports continued development.

🤝 Contributing

Contributions are welcome! Check out the contributing guide and the open issues to get started.

2.37.0 Jul 22, 2026
2.36.2 Jun 17, 2026
2.36.1 Jun 07, 2026
2.36.0 May 29, 2026
2.35.1 Apr 12, 2026
2.35.0 Apr 09, 2026
2.34.1 Feb 25, 2026
2.34.0 Feb 16, 2026
2.33.0 Dec 16, 2025
2.32.1 Nov 06, 2025
2.32.0 Oct 07, 2025
2.31.3 Sep 22, 2025
2.31.1 Aug 31, 2025
2.31.0 Aug 11, 2025
2.30.3 Jul 29, 2025
2.30.2 Jul 28, 2025
2.30.1 Jun 19, 2025
2.30.0 Jun 16, 2025
2.29.0 May 06, 2025
2.28.1 Apr 02, 2025
2.28.0 Mar 29, 2025
2.27.0 Feb 11, 2025
2.26.2 Dec 17, 2024
2.26.1 Oct 28, 2024
2.26.0 Oct 24, 2024
2.25.1 Sep 30, 2024
2.25.0 Sep 28, 2024
2.24.1 Aug 26, 2024
2.24.0 Aug 24, 2024
2.23.5 Aug 03, 2024
2.23.4 Jul 30, 2024
2.23.3 Jun 29, 2024
2.23.2 May 18, 2024
2.23.1 May 12, 2024
2.23.0 May 07, 2024
2.22.0 Apr 19, 2024
2.21.3 Mar 12, 2024
2.21.2 Mar 10, 2024
2.21.1 Feb 15, 2024
2.21.0 Jan 31, 2024
2.20.1 Dec 13, 2023
2.20.0 Oct 21, 2023
2.19.0 Sep 25, 2023
2.18.1 Sep 08, 2023
2.18.0 Aug 14, 2023
2.17.0 Jul 18, 2023
2.16.0 Jul 04, 2023
2.15.0 Jun 19, 2023
2.14.1 Jun 06, 2023
2.14.0 Jun 05, 2023
2.13.0 May 22, 2023
2.12.1 May 11, 2023
2.12.0 May 08, 2023
2.11.2 Apr 29, 2023
2.11.1 Apr 25, 2023
2.11.0 Apr 22, 2023
2.10.3 Apr 03, 2023
2.10.2 Mar 22, 2023
2.10.1 Mar 15, 2023
2.10.0 Mar 04, 2023
2.9.2 Feb 20, 2023
2.9.1 Feb 20, 2023
2.9.0 Feb 14, 2023
2.8.0 Feb 11, 2023
2.7.1 Feb 04, 2023
2.7.0 Feb 03, 2023
2.6.0 Jan 27, 2023
2.5.1 Jan 27, 2023
2.5.0 Jan 22, 2023
2.4.0 Dec 24, 2022
2.3.0 Dec 15, 2022
2.2.0 Dec 04, 2022
2.1.0 Dec 01, 2022
2.0.0 Nov 18, 2022
1.10.2 Apr 03, 2023
1.10.1 Nov 08, 2022
1.10.0 Oct 25, 2022
1.9.4 Oct 15, 2022
1.9.3 Sep 27, 2022
1.9.2 Sep 27, 2022
1.9.1 Sep 04, 2022
1.9.0 Jul 31, 2022
1.8.2 Jul 23, 2022
1.8.1 Jun 09, 2022
1.8 May 27, 2022
1.7.6 May 25, 2022
1.7.5 May 14, 2022
1.7.4 May 07, 2022
1.7.1 Feb 14, 2022
1.7.0 Nov 28, 2021
1.6.1 Sep 08, 2021
1.6.0 Aug 16, 2021
1.5.2 Jun 07, 2021
1.5.1 May 27, 2021
1.5.0 Mar 24, 2021
1.4.5 Nov 24, 2020
1.4.4 Oct 19, 2020
1.4.3 Aug 18, 2020
1.4.2 Aug 04, 2020
1.4.1 May 04, 2020
1.4.0 Apr 02, 2020
1.3.1 Mar 30, 2020
1.3.0 Mar 17, 2020
1.2.1 Feb 14, 2020
1.2.0 Feb 04, 2020
1.1.1 Feb 03, 2020
1.1.0 Nov 29, 2019
1.0.5 Sep 05, 2019
1.0.4 Aug 14, 2019
1.0.3 Mar 25, 2019
1.0.2 Feb 18, 2019
1.0.1 Feb 14, 2019
1.0 Jan 24, 2019
1.0rc1 Jan 14, 2019
1.0b1 Jan 07, 2019
0.16.0 Nov 28, 2018
0.15.0 Nov 08, 2018
0.14.0 Sep 25, 2018
0.13.1 Sep 10, 2018
0.12.0 Aug 02, 2018
0.11.0 Jun 21, 2018
0.10.3 May 10, 2018
0.10.2 Apr 03, 2018
0.10.1 Mar 22, 2018
0.9.0 Oct 13, 2017
0.8.2 Dec 07, 2016
0.8.1 Aug 16, 2016
0.8.0 Aug 16, 2016
0.7.0 Mar 17, 2016
0.6.2 Jul 06, 2015
0.6.1 Mar 12, 2015
0.6.0 Feb 20, 2015
0.5.1 Aug 28, 2014
0.5.0 Aug 28, 2014
0.4.3 Aug 01, 2014
0.4.2 Feb 20, 2014
0.4.1 Oct 19, 2013
0.4.0 Aug 06, 2013
0.3.1 Mar 10, 2013
0.3.0 Nov 18, 2012
0.2.0 Apr 18, 2012
0.1.1 Mar 14, 2012
0.1 Mar 14, 2012

Wheel compatibility matrix

Platform Python 3
any

Files in release

Extras:
Dependencies:
redis (<7.2)
redis (>=4.3)
redis (>=4)
sortedcontainers (>=2)
typing-extensions (>=4.7)