Skip to content

Commit

Permalink
fix: move to dataclass + requirements.txt (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
JarbasAl authored Dec 29, 2024
1 parent 4d2c482 commit 043ec60
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
9 changes: 7 additions & 2 deletions hivemind_sqlite_database/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,20 @@

from hivemind_plugin_manager.database import Client, AbstractDB

from dataclasses import dataclass


@dataclass
class SQLiteDB(AbstractDB):
"""Database implementation using SQLite."""
name: str = "clients"
subfolder: str = "hivemind-core"

def __init__(self, name="clients", subfolder="hivemind-core"):
def __post_init__(self):
"""
Initialize the SQLiteDB connection.
"""
db_path = os.path.join(xdg_data_home(), subfolder, name + ".db")
db_path = os.path.join(xdg_data_home(), self.subfolder, self.name + ".db")
LOG.debug(f"sqlite database path: {db_path}")
os.makedirs(os.path.dirname(db_path), exist_ok=True)

Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
hivemind-plugin-manager>=0.1.0,<1.0.0
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def required(requirements_file):
url='https://github.com/JarbasHiveMind/hivemind-sqlite-database',
license='Apache-2.0',
author='jarbasAi',
# install_requires=required("requirements.txt"),
install_requires=required("requirements.txt"),
entry_points={'hivemind.database': PLUGIN_ENTRY_POINT},
author_email='[email protected]',
description='sqlite database plugin for hivemind-core'
Expand Down

0 comments on commit 043ec60

Please sign in to comment.