6 Commits

Author SHA1 Message Date
6421a3923f feat!(deps): upgrade dependencies (#488)
Some checks failed
Security / sonarqube (push) Failing after 22s
Security / snyk (push) Successful in 54s
Okay, let's break down this Git diff. I'll explain the changes in the context of the overall project.

**Overall:**

This pull request appears to be updating dependencies, and making a corresponding code change to reflect an API change in one of those dependencies, `webexteamssdk`. The project seems to be a Webex bot application, utilizing the Webex Teams SDK to interact with Webex.

**File Breakdown:**

1.  `app/meme.py`

    ```diff
    --- a/app/meme.py
    +++ b/app/meme.py
    @@ -2,10 +2,10 @@

     from webex_bot.models.command import Command
     from webex_bot.models.response import Response, response_from_adaptive_card
-    from webexteamssdk.models.cards import (
+    from webexpythonsdk.models.cards import (
         AdaptiveCard,
         Choice,
-        Choices,
+        ChoiceSet,
         Column,
         ColumnSet,
         FontSize,
@@ -13,7 +13,7 @@ from webexteamssdk.models.cards import (
         Text,
         TextBlock,
     )
-    from webexteamssdk.models.cards.actions import OpenUrl, Submit
+    from webexpythonsdk.models.cards.actions import OpenUrl, Submit

     from app import img

    @@ -70,7 +70,7 @@ class MakeMemeCommand(Command):
                         Column(
                             width=1,
                             items=[
-                                Choices(
+                                ChoiceSet(
                                     id="meme_type",
                                     isMultiSelect=False,
                                     choices=[Choice(title=x["name"], value=x["choiceval"]) for x in TEMPLATES],
    ```

    *   **`import` statement update:**

        *   `webexteamssdk` is replaced with `webexpythonsdk`.  This indicates that the code is migrating to use a potentially renamed or reorganized SDK.
        *   The import paths for card models and actions are updated to reflect the new SDK structure (e.g., `webexteamssdk.models.cards` becomes `webexpythonsdk.models.cards`).
    *   **`Choices` to `ChoiceSet`:**

        *   The code changes from using a class named `Choices` to `ChoiceSet`. The `Choices` class was probably renamed to `ChoiceSet` in the new SDK.  This change is found in the `MakeMemeCommand` class, within the adaptive card definition.
        *   The purpose of this code is likely to present a user with a set of options to select a meme type, and the `ChoiceSet` renders a dropdown or radio button group in the adaptive card.

2.  `uv.lock`

    This file is a lock file for the uv package manager, similar to `requirements.txt` with hashes.  It specifies the exact versions and dependencies of Python packages used in the project. The changes in this file reflect an update to the project's dependencies. The major changes are:

    *   **Removal of `revision = 2`:** This line is removed, indicating a change in the lock file's metadata.
    *   **Version bumps:** Several packages have their versions updated. Some examples include:
        *   `certifi` updated from `2025.1.31` to `2025.4.26`
        *   `charset-normalizer` updated from `3.4.1` to `3.4.2`
        *   `click` updated from `8.1.8` to `8.2.1`
        *   `coverage` updated from `7.8.0` to `7.8.2`
        *   `dill` updated from `0.3.9` to `0.4.0`
        *   `identify` updated from `2.6.9` to `2.6.12`
        *   `mypy-extensions` updated from `1.0.0` to `1.1.0`
        *   `packaging` updated from `24.2` to `25.0`
        *   `pluggy` updated from `1.5.0` to `1.6.0`
        *   `pylint` updated from `3.3.6` to `3.3.7`
        *   `urllib3` updated to `2.4.0`
        *   `webex-bot` updated from `0.5.2` to `0.6.2`
        *   `webexteamssdk` replaced by `webexpythonsdk` updated to `2.0.4`
    *   **Removal of `future` package:** This package is removed from the dependencies.
    *   **Addition of `pygments` package:** This package is added as a dependency with version `2.19.1`.
    *   **Hash changes:**  The hashes for all the updated packages have also changed, which is expected since the package versions are different. The inclusion of hashes ensures that the correct, unaltered versions of the packages are installed.

**Impact and Justification:**

*   **Dependency Updates:** Keeping dependencies up-to-date is a standard security practice. Newer versions often include bug fixes, performance improvements, and security patches.
*   **API Alignment:** The code change in `app/meme.py` is essential. If `webexteamssdk` was indeed renamed or its API significantly altered in the newer version, the code needs to adapt to use the new class names and import paths. Failing to do so would likely break the meme-making functionality.
*   **Lockfile Integrity:** Updating the lockfile (`uv.lock`) is crucial.  It ensures that every environment where this project is deployed uses the *exact* same versions of the dependencies, preventing unexpected behavior.
*   **Removal of `future`:** The removal of `future` suggests that the code might have been updated to be fully compatible with Python 3, and the package is no longer needed.
*   **Addition of `pygments`:** The addition of `pygments` indicates that the code will now use this library.

**In Summary:**

This pull request updates dependencies, adapts the code to API changes in `webexpythonsdk`, adds `pygments` and removes the `future` package, while ensuring dependency consistency through the lockfile. It's a necessary step for maintaining the application's functionality, security, and compatibility with the latest libraries.

Reviewed-on: #488
2025-06-06 19:53:36 +02:00
13097b36fb fix(lint): Fix linting issues (#487)
Some checks failed
Security / sonarqube (push) Failing after 36s
Security / snyk (push) Successful in 1m1s
This pull request focuses on improving the documentation and readability of the Webex meme bot application by adding docstrings and minor formatting adjustments. Here's a breakdown of the changes:

*   **Docstrings:**
    *   Added module-level docstrings to `app/close.py`, `app/img.py`, and `app/main.py` providing a high-level overview of the purpose of each module.
    *   Added docstrings to classes (`ExitCommand`, `MakeMemeCommand`, `MakeMemeCallback`) describing their role.
    *   Added docstrings to methods within those classes (`__init__`, `pre_execute`, `execute`, `post_execute`) explaining their functionality, arguments, and return values where applicable. The `get_templates` and `format_meme_string` functions in `app/img.py` have been documented as well.
*   **Formatting:**
    *   Added a line break before the return type annotation in function definitions (e.g., `def execute(...) -> Response:`).
    *   Added the disable comment `# pylint: disable=line-too-long` to a line in `app/meme.py` to disable pylint for that line.
    *   Added the disable comment `# pylint: disable=unused-argument` to the `pre_execute`, `execute`, and `post_execute` methods to disable pylint checks about unused arguments. This is because these methods are part of an interface and must have the same signature even if some arguments are unused.
*   **Variable Naming:**
    *   Renamed the `vars` dictionary to `env_vars` in `tests/test_config.py` for better clarity.
*   **Test Update:**
    *   Added a docstring to the `test_config` function in `tests/test_config.py` to explain its functionality.
*   **Imports Update:**
    *   Updated imports in `tests/test_config.py` to disable pylint for wrong-import-position errors using `# pylint: disable=wrong-import-position`.

In essence, these changes enhance the maintainability and understandability of the codebase through comprehensive documentation and minor code style improvements.

Reviewed-on: #487
2025-06-06 19:39:11 +02:00
14d7cecc55 chore: add pre-commit 2024-08-04 19:04:40 +01:00
f1248df4af Explicitly return None 2024-03-26 22:29:44 +00:00
056dcf4155 Add docstrings 2024-03-26 22:29:44 +00:00
d213f1395d feature(tests): add unit tests 2023-12-14 20:55:17 +00:00