From e1c3d216f2405afd707b80a9d3f75f8ff6c0c711 Mon Sep 17 00:00:00 2001 From: NeonKirill <74428618+NeonKirill@users.noreply.github.com> Date: Wed, 4 Dec 2024 10:28:12 +0100 Subject: [PATCH] Async consumers support (#188) * Added async consumers support * Dropped support for Python 3.7 * Updated requirements * bumped gh actions to the latest supported versions * removed support for python 3.7 * added pre-fetching punkt_tab dependency in nltk * Small fix to conflicting artifact upload --- .github/workflows/unit_tests.yml | 21 +++++++++++---------- chatbot_core/v2/__init__.py | 4 +++- requirements/requirements.txt | 8 ++++---- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index 26ef8a4..0e5c6c0 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -9,20 +9,21 @@ jobs: unit_tests: strategy: matrix: - python-version: [ 3.7, 3.8, 3.9] + python-version: [ 3.8, 3.9] # TODO: 3.10 and 3.11 need support in klat-connector runs-on: ubuntu-latest timeout-minutes: 15 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install dependencies run: | python -m pip install --upgrade pip pip install .[lang] -r requirements/test_requirements.txt + python -m nltk.downloader punkt_tab env: GITHUB_TOKEN: ${{secrets.neon_token}} - name: Test with pytest @@ -30,22 +31,22 @@ jobs: pip install pytest pytest-timeout pytest-cov pytest tests/units --doctest-modules --junitxml=tests/unit-test-results.xml - name: Upload pytest unit test results - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: - name: unit-test-results + name: unit-test-results-${{ matrix.python-version }} path: tests/unit-test-results.xml integration_tests: strategy: matrix: - python-version: [ 3.7, 3.8, 3.9 ] + python-version: [ 3.8, 3.9 ] # TODO: 3.10 and 3.11 need support in klat-connector max-parallel: 1 runs-on: ubuntu-latest timeout-minutes: 15 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install dependencies @@ -59,7 +60,7 @@ jobs: pip install pytest pytest-timeout pytest-cov pytest tests/integration --doctest-modules --junitxml=tests/integration-test-results.xml - name: Upload integration test results - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: - name: integration-test-results + name: integration-test-results-${{ matrix.python-version }} path: tests/integration-test-results.xml \ No newline at end of file diff --git a/chatbot_core/v2/__init__.py b/chatbot_core/v2/__init__.py index 9d658b7..9a7ca53 100644 --- a/chatbot_core/v2/__init__.py +++ b/chatbot_core/v2/__init__.py @@ -1,6 +1,6 @@ # NEON AI (TM) SOFTWARE, Software Development Kit & Application Development System # -# Copyright 2008-2021 Neongecko.com Inc. | All Rights Reserved +# Copyright 2008-2024 Neongecko.com Inc. | All Rights Reserved # # Notice of License - Duplicating this Notice of License near the start of any file containing # a derivative of this software is a condition of license for this software. @@ -32,6 +32,8 @@ class ChatBot(KlatAPIMQ, ChatBotABC): """MQ-based chatbot implementation""" + async_consumers_enabled = True + def __init__(self, *args, **kwargs): config, service_name, vhost, bot_type = self.parse_init(*args, **kwargs) mq_config = config.get("MQ") or config diff --git a/requirements/requirements.txt b/requirements/requirements.txt index 8a78651..cdd4559 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -1,6 +1,6 @@ +click~=8.0 +klat-connector==0.6.2a15 +neon-mq-connector==0.7.2a5 +neon_utils[network]~=1.0 ovos-bus-client~=0.0.5 -klat-connector>=0.6.2a15 psutil~=5.7 -neon_utils[network]~=1.0 -neon-mq-connector~=0.7,>=0.7.1 -click~=8.0 \ No newline at end of file