{"id":13813652,"url":"https://github.com/paxosglobal/subconscious","last_synced_at":"2026-01-16T19:37:13.787Z","repository":{"id":57472071,"uuid":"78038096","full_name":"paxosglobal/subconscious","owner":"paxosglobal","description":"redis-backed (in memory) db for python3 that is asyncio compatible","archived":false,"fork":false,"pushed_at":"2018-07-25T12:36:24.000Z","size":72,"stargazers_count":252,"open_issues_count":1,"forks_count":19,"subscribers_count":30,"default_branch":"develop","last_synced_at":"2025-10-27T05:34:59.501Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/paxosglobal.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":"2017-01-04T17:37:41.000Z","updated_at":"2024-10-15T06:13:28.000Z","dependencies_parsed_at":"2022-08-30T17:01:24.507Z","dependency_job_id":null,"html_url":"https://github.com/paxosglobal/subconscious","commit_stats":null,"previous_names":["paxos-bankchain/subconscious"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/paxosglobal/subconscious","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paxosglobal%2Fsubconscious","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paxosglobal%2Fsubconscious/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paxosglobal%2Fsubconscious/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paxosglobal%2Fsubconscious/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/paxosglobal","download_url":"https://codeload.github.com/paxosglobal/subconscious/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paxosglobal%2Fsubconscious/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28481890,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T11:59:17.896Z","status":"ssl_error","status_checked_at":"2026-01-16T11:55:55.838Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2024-08-04T04:01:24.423Z","updated_at":"2026-01-16T19:37:13.752Z","avatar_url":"https://github.com/paxosglobal.png","language":"Python","funding_links":[],"categories":["Python (1887)","Python"],"sub_categories":[],"readme":"# subconscious\n\nIn-memory database for python3.6+ only\n\n[![Build Status](https://api.travis-ci.com/paxos-bankchain/subconscious.svg?token=PA4epyQZ24dEsEEpEEEZ\u0026branch=develop)](https://travis-ci.com/paxos-bankchain/subconscious)\n\n## Install\n\nFrom [PyPi](https://pypi.python.org/pypi/subconscious):\n```bash\n$ pip3 install subconscious\n```\n\n## Quickstart\n\nLet's say you have the following in your `models.py` file:\n```python\nfrom enum import Enum\nfrom subconscious.model import RedisModel\nfrom subconscious.column import Column\n\nclass User(RedisModel):\n\n    # This can be defined inside this class (easier imports) or elsewhere\n    class Gender(Enum):\n        MALE = 'male'\n        FEMALE = 'female'\n\n    uuid = Column(type=str, primary_key=True)\n    name = Column(type=str, required=True)\n    age = Column(index=True, type=int, sort=True, required=True)\n    gender = Column(index=True, enum=Gender)\n    country_code = Column(type=str, index=True)\n```\n\nThen somewhere you can use that model like this:\n```python\nfrom aioredis import create_redis\nfrom asyncio import get_event_loop\nfrom models import User\nfrom uuid import uuid4\n\nloop = get_event_loop()\n\nasync def go():\n    db = await create_redis(('localhost', 6379), loop=loop, encoding='utf-8')\n    my_uuid = str(uuid4())\n    my_user = User(\n        uuid=my_uuid,\n        name='John Doe',\n        age=30,\n        gender=User.Gender.MALE.value,\n        country_code='USA',\n    )\n    print('Saving user with uuid {}...'.format(my_uuid))\n    await my_user.save(db)\n    retrieved_user = await User.load(db, my_uuid)\n    print('Retrieved {}'.format(retrieved_user.as_dict()))\n\nloop.run_until_complete(go())\n```\n\nWhich results in:\n```\nSaving user with uuid 153d68ff-2897-4385-af0c-fea986a68d1f...\nRetrieved {'age': 30, 'country_code': 'USA', 'gender': 'male', 'name': 'John Doe', 'uuid': '153d68ff-2897-4385-af0c-fea986a68d1f'}\n```\n\nYou can also do advanced queries like this:\n```python\nusers = await User.filter_by(\n    db=db,\n    age=[18, 19, 20, 21, 22],\n    country_code='USA',\n    gender=User.Gender.MALE,\n)\n```\n\nOr use an async generator like this:\n```python\n[user async for user in User.all(\n    db=db,\n    order_by='age',  # you can also do '-age' for reverse sort\n    limit=10,\n)]\n```\n\n## More Examples\nSee our demo app for a live example: https://github.com/paxos-bankchain/pastey\n\n## Test\n\nRun redis. We recommend using [docker](https://www.docker.com/community-edition):\n```bash\n$  docker run -p 6379:6379 redis\n```\n(you can use `-d` to daemonize this process)\n\nInstall [nose](http://nose.readthedocs.io/en/latest/]):\n```bash\n$ pip3 install nose\n```\n\nConfirm tests pass:\n```\n$ nosetests .\n```\n\n## Contribute\n\nCheck out repo:\n```bash\n$ git checkout git+https://github.com/paxos-bankchain/subconscious.git \u0026\u0026 cd subconscious\n```\n\nInstall locally\n```bash\npip3 install --editable\n```\n\nMake some changes and confirm that tests still pass\n\n---\n\n## Updating PyPi\n\nYou must have the credentials in order to push updates to [PyPi](https://pypi.python.org/pypi).\n\n### Do it Live\nCreate a `.pypirc` file in your home directory:\n```\n$ cat ~/.pypirc\n[distutils]\nindex-servers=\n    pypi\n\n[pypi]\nrepository = https://pypi.python.org/pypi\nusername = paxos\npassword = \u003cpassword goes here\u003e\n```\n\nCreate a distribution:\n```\n$ python setup.py sdist bdist_wheel\n```\n\nPush your distribution to PyPi (may need to `pip3 install twine` first):\n```\n$ twine upload dist/* -r pypi\n```\n\n### Testing\n\nTo test this process, you can use [PyPi's test server](https://testpypi.python.org/). Add an entry to `.pypirc` that looks like this with whatever creds you create for testpypi:\n```\n[testpypi]\nrepository = https://testpypi.python.org/pypi\nusername = \u003cyour user name goes here\u003e\npassword = \u003cyour password goes here\u003e\n```\n\nThen use the following command to push your distrobution to test PyPi:\n```\n$ twine upload dist/* -r testpypi\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaxosglobal%2Fsubconscious","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpaxosglobal%2Fsubconscious","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaxosglobal%2Fsubconscious/lists"}