Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: missing hivemind entrypoint in setup.py #4

Merged
merged 2 commits into from
Dec 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 14 additions & 11 deletions hivemind_redis_database/__init__.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
from dataclasses import dataclass
from typing import List, Union, Optional, Iterable

import redis
from ovos_utils.log import LOG

from hivemind_plugin_manager.database import Client, AbstractDB, cast2client
from hivemind_plugin_manager.database import Client, AbstractRemoteDB, cast2client


class RedisDB(AbstractDB):
@dataclass
class RedisDB(AbstractRemoteDB):
"""Database implementation using Redis with RediSearch support."""

def __init__(self, host: str = "127.0.0.1", port: int = 6379, password: Optional[str] = None, redis_db: int = 0):
host: str = "127.0.0.1"
port: int = 6379
name: str = "clients"
subfolder: str = "hivemind-core"
password: Optional[str] = None
database_id: Optional[int] = None

def __post_init__(self):
"""
Initialize the RedisDB connection.

Args:
host: Redis server host.
port: Redis server port.
redis_db: Redis database index.
"""
self.redis = redis.StrictRedis(host=host, port=port, db=redis_db,
password=password if password else None,
self.redis = redis.StrictRedis(host=self.host, port=self.port, db=self.database_id,
password=self.password if self.password else None,
decode_responses=True)
# TODO - support for a proper search index

Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
py-redis
py-redis
hivemind-plugin-manager>=0.1.0,<1.0.0
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def required(requirements_file):
if pkg.strip() and not pkg.startswith("#")]


PLUGIN_ENTRY_POINT = 'hivemind-redis-db-plugin=hivemind_redis_database:RedisDB'

setup(
name='hivemind-redis-database',
Expand All @@ -48,6 +49,7 @@ def required(requirements_file):
license='Apache-2.0',
author='jarbasAi',
install_requires=required("requirements.txt"),
entry_points={'hivemind.database': PLUGIN_ENTRY_POINT},
author_email='[email protected]',
description='redis database plugin for hivemind-core'
)
Loading