diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ba73360b..3dbf3df0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,7 @@ repos: - repo: https://github.com/psf/black - rev: 24.4.2 + rev: 24.8.0 hooks: - id: black diff --git a/bin/bootstrap b/bin/bootstrap index a71af38d..f91a9cf7 100755 --- a/bin/bootstrap +++ b/bin/bootstrap @@ -35,7 +35,15 @@ logger = logging.getLogger(__name__) default=False, help="Turn on verbosity", ) -def main(teardown, config, user, password, host, port, verbose): +def main( + teardown: bool, + config: str, + user: str, + password: bool, + host: str, + port: int, + verbose: bool, +) -> None: """Application onetime Bootstrap.""" kwargs: dict = { "user": user, diff --git a/bin/es_mapping b/bin/es_mapping index f584d96b..5ef2eb4f 100755 --- a/bin/es_mapping +++ b/bin/es_mapping @@ -110,7 +110,7 @@ def create_es_mapping(index: str) -> None: help="Schema config", type=click.Path(exists=True), ) -def main(config): +def main(config: str) -> None: """Create custom NGram analyzer for the default mapping.""" config: str = get_config(config) diff --git a/pgsync/sync.py b/pgsync/sync.py index 2c875ca5..bc3bddcc 100644 --- a/pgsync/sync.py +++ b/pgsync/sync.py @@ -1414,22 +1414,22 @@ def receive(self) -> None: default=settings.NUM_WORKERS, ) def main( - config, - daemon, - host, - password, - port, - sslmode, - sslrootcert, - user, - verbose, - version, - analyze, - num_workers, - polling, - producer, - consumer, -): + config: str, + daemon: bool, + host: str, + password: bool, + port: int, + sslmode: str, + sslrootcert: str, + user: str, + verbose: bool, + version: bool, + analyze: bool, + num_workers: int, + polling: bool, + producer: bool, + consumer: bool, +) -> None: """Main application syncer.""" if version: sys.stdout.write(f"Version: {__version__}\n") diff --git a/plugins/openai_plugin.py b/plugins/openai_plugin.py index dc2e18fa..f322138f 100644 --- a/plugins/openai_plugin.py +++ b/plugins/openai_plugin.py @@ -1,7 +1,5 @@ from functools import lru_cache -from openai import OpenAI - from pgsync import plugin @@ -14,6 +12,8 @@ class OpenAIPlugin(plugin.Plugin): def __init__(self) -> None: super().__init__() + from openai import OpenAI + self.client: OpenAI = OpenAI() self.model: str = "text-embedding-3-small" # vector dims must match models input dims diff --git a/plugins/sentence_transformer_plugin.py b/plugins/sentence_transformer_plugin.py index fdefb481..28be3bdd 100644 --- a/plugins/sentence_transformer_plugin.py +++ b/plugins/sentence_transformer_plugin.py @@ -1,5 +1,3 @@ -from sentence_transformers import SentenceTransformer - from pgsync import plugin @@ -14,6 +12,8 @@ class SentenceTransformersPlugin(plugin.Plugin): def __init__(self) -> None: super().__init__() + from sentence_transformers import SentenceTransformer + self.model: SentenceTransformer = SentenceTransformer( "all-MiniLM-L6-v2" ) diff --git a/requirements/base.txt b/requirements/base.txt index 8144aacc..a850f695 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -6,9 +6,9 @@ # async-timeout==4.0.3 # via redis -boto3==1.34.153 +boto3==1.34.155 # via -r requirements/base.in -botocore==1.34.153 +botocore==1.34.155 # via # boto3 # s3transfer @@ -76,7 +76,7 @@ six==1.16.0 # opensearch-dsl # opensearch-py # python-dateutil -sqlalchemy==2.0.31 +sqlalchemy==2.0.32 # via -r requirements/base.in sqlparse==0.5.1 # via -r requirements/base.in diff --git a/requirements/dev.txt b/requirements/dev.txt index 76e38fcd..494d217f 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -8,9 +8,9 @@ async-timeout==4.0.3 # via redis black==24.8.0 # via -r requirements/dev.in -boto3==1.34.153 +boto3==1.34.155 # via -r requirements/base.in -botocore==1.34.153 +botocore==1.34.155 # via # boto3 # s3transfer @@ -27,7 +27,7 @@ click==8.1.7 # via # -r requirements/base.in # black -coverage[toml]==7.6.0 +coverage[toml]==7.6.1 # via # -r requirements/dev.in # pytest-cov @@ -47,11 +47,11 @@ events==0.5 # via opensearch-py exceptiongroup==1.2.2 # via pytest -faker==26.1.0 +faker==26.2.0 # via -r requirements/dev.in filelock==3.15.4 # via virtualenv -flake8==7.1.0 +flake8==7.1.1 # via -r requirements/dev.in freezegun==1.5.1 # via -r requirements/dev.in @@ -100,7 +100,7 @@ pre-commit==3.5.0 # via -r requirements/dev.in psycopg2-binary==2.9.9 # via -r requirements/base.in -pycodestyle==2.12.0 +pycodestyle==2.12.1 # via flake8 pyflakes==3.2.0 # via flake8 @@ -125,7 +125,7 @@ python-dotenv==1.0.1 # via # -r requirements/base.in # environs -pyyaml==6.0.1 +pyyaml==6.0.2 # via pre-commit redis==5.0.8 # via -r requirements/base.in @@ -142,7 +142,7 @@ six==1.16.0 # opensearch-dsl # opensearch-py # python-dateutil -sqlalchemy==2.0.31 +sqlalchemy==2.0.32 # via -r requirements/base.in sqlparse==0.5.1 # via -r requirements/base.in diff --git a/setup.py b/setup.py index 0533e278..f62b987e 100644 --- a/setup.py +++ b/setup.py @@ -34,6 +34,7 @@ def get_version() -> str: "pgsync", "postgres", ] +LICENSE = "MIT" CLASSIFIERS = [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", @@ -64,7 +65,7 @@ def get_version() -> str: setup( name=NAME, author=AUTHOR, - license="MIT", + license=LICENSE, maintainer=MAINTAINER, maintainer_email=MAINTAINER_EMAIL, author_email=AUTHOR_EMAIL,