{"id":18234089,"url":"https://github.com/chekart/rediserver","last_synced_at":"2025-10-27T09:51:45.538Z","repository":{"id":57460667,"uuid":"121253838","full_name":"chekart/rediserver","owner":"chekart","description":"Pure Python Redis server implementation","archived":false,"fork":false,"pushed_at":"2019-05-10T22:24:57.000Z","size":19,"stargazers_count":27,"open_issues_count":2,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-22T20:57:42.188Z","etag":null,"topics":["asyncio","pure-python","python","redis","redis-server"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chekart.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-02-12T14:05:17.000Z","updated_at":"2024-10-18T23:29:46.000Z","dependencies_parsed_at":"2022-09-01T20:22:49.567Z","dependency_job_id":null,"html_url":"https://github.com/chekart/rediserver","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/chekart/rediserver","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chekart%2Frediserver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chekart%2Frediserver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chekart%2Frediserver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chekart%2Frediserver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chekart","download_url":"https://codeload.github.com/chekart/rediserver/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chekart%2Frediserver/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280982873,"owners_count":26424653,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-25T02:00:06.499Z","response_time":81,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asyncio","pure-python","python","redis","redis-server"],"created_at":"2024-11-04T17:03:33.347Z","updated_at":"2025-10-27T09:51:45.503Z","avatar_url":"https://github.com/chekart.png","language":"Python","readme":"[![Build Status](https://travis-ci.org/chekart/rediserver.svg?branch=dev)](https://travis-ci.org/chekart/rediserver)\n\n# rediserver\n\nPure Python Redis server implementation\n\n## Getting Started\n\nIt is possible to use Redis server as standalone redis installation,\nhowever the main goal of the project is to have an in-mem lightweight Redis for python Unit Tests.\n\nThe package provides context manager named local_redis which created separate thread running fresh new redis on enter\nand stops on exit. Context manager returns proxy object to access redis data\n\n```python\nimport redis\nfrom rediserver.test import local_redis\n\n# start redis server\nwith local_redis() as redis_proxy:\n    # redis_proxy contains sock property a tempfile path to redis unix socket\n    # pass it to python redis client\n    client = redis.StrictRedis(unix_socket_path=redis_proxy.sock)\n    client.set('key1', 1)\n    # dict property returns a deepcopy of redis keys, feel free to modify it\n    # and check whether data is created\n    # please note that data stored as bytes\n    assert redis_proxy.dict == {b'key1': b'1'}\n```\n\n### pytest\n\nThe package provides pytest fixture, use it like this\n\n```python\n# in conftest.py\npytest_plugins = 'rediserver.test.pytest',\n\ndef test_ok(local_redis):\n    client = redis.StrictRedis(unix_socket_path=local_redis.sock)\n    ...\n```\n\n## Compatibility\n\nCurrently redis server supports the following methods:\n\n* Keys\n  * GET, SET, DEL, INCRBY, DECRBY, SCAN\n* Sets\n  * SADD, SPOP, SCARD\n* Scripts\n  * SCRIPT LOAD, EVALSHA\n* Transactions:\n  * MULTI, WATCH, EXEC\n\n## Embedded Redis\n\nNeed a real redis instance to be flushed for each test? Say no more.\nYou can use `EmbeddedRedis` and `EmbeddedRedisSession` context managers\n\nEmbeddedRedis context manager runs a docker redis container on enter and\nstops it on exit. The return value of the container is a temporary socket file\nto use for connecting server. It's also possible to use start and stop methods of\nEmbeddedRedis directly\n\n```python\nimport redis\nfrom rediserver import EmbeddedRedis\n\nwith EmbeddedRedis() as socket_file:\n    client = redis.StrictRedis(unix_socket_path=embedded_redis_server)\n    client.set('some_key', 'some_value')\n```\n\nEmbeddedRedisSession is a context manager that flushes current redis db on exit\nIn case of multithreaded testing, each thread has to run session using separate db\n(the current redis db limit if using EmbeddedRedis is set to 100). Returned value is\na redis proxy object similar to `local_redis`\n\n```python\nredis_server = EmbeddedRedis()\nsocket = redis_server.start()\n\nclient = redis.StrictRedis(unix_socket_path=redis_proxy.sock, db=thread_db)\n\nwith EmbeddedRedisSession(socket_file=socket, db=thread_db) as redis_proxy:\n    client.set('some_key', 'some_value')\n\nclient.get('some_key') # value is None\nredis_server.stop()\n```\n\n### pytest\n\nThe package provides the following pytest fixtures to use.\n\nembedded_redis_server - creates redis server instance, with the scope of session\n\nembedded_redis - flushes redis db before and after the test\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchekart%2Frediserver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchekart%2Frediserver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchekart%2Frediserver/lists"}