diff --git a/docs/patterns/functions/triggers.mdx b/docs/patterns/functions/triggers.mdx index 297ea100544..423b7ebdd91 100644 --- a/docs/patterns/functions/triggers.mdx +++ b/docs/patterns/functions/triggers.mdx @@ -68,7 +68,7 @@ Fetch the trigger using its name and verify if it exists. ```python python -triggers = composio_client.triggers.get(trigger_ids=[trigger_name]) # Get the triggers +triggers = composio_client.triggers.get(trigger_names=[trigger_name]) # Get the triggers if len(triggers) == 0: raise Exception("Trigger not found") # Handle incorrect trigger name diff --git a/python/composio/cli/triggers.py b/python/composio/cli/triggers.py index c1a70a8a6ac..b265c039d6f 100644 --- a/python/composio/cli/triggers.py +++ b/python/composio/cli/triggers.py @@ -83,7 +83,7 @@ def _triggers( @handle_exceptions() @pass_context def _show(context: Context, name: str) -> None: - (trigger,) = context.client.triggers.get(triggers=[name]) + (trigger,) = context.client.triggers.get(trigger_names=[name]) context.console.print(f"• Showing: [green][bold]{name}[/bold][/green]") context.console.print( @@ -149,7 +149,7 @@ class EnableTriggerExamples(HelpfulCmdBase, click.Command): def _enable_trigger(context: Context, name: str) -> None: """Enable a trigger for an app""" context.console.print(f"Enabling trigger [green]{name}[/green]") - triggers = context.client.triggers.get(triggers=[name]) + triggers = context.client.triggers.get(trigger_names=[name]) if len(triggers) == 0: raise click.ClickException(f"Trigger with name {name} not found") trigger = triggers[0] diff --git a/python/composio/client/collections.py b/python/composio/client/collections.py index b958fc7409f..2565af68d61 100644 --- a/python/composio/client/collections.py +++ b/python/composio/client/collections.py @@ -725,7 +725,7 @@ def __init__(self, client: BaseClient) -> None: def get( # type: ignore self, - triggers: t.Optional[t.List[TriggerType]] = None, + trigger_names: t.Optional[t.List[TriggerType]] = None, apps: t.Optional[t.List[str]] = None, ) -> t.List[TriggerModel]: """ @@ -736,8 +736,8 @@ def get( # type: ignore :return: List of triggers filtered by provided parameters """ queries = {} - if triggers is not None and len(triggers) > 0: - queries["triggerIds"] = to_trigger_names(triggers) + if trigger_names is not None and len(trigger_names) > 0: + queries["triggerIds"] = to_trigger_names(trigger_names) if apps is not None and len(apps) > 0: queries["appNames"] = ",".join(apps) return super().get(queries=queries) diff --git a/python/composio/tools/local/base/utils/repomap.py b/python/composio/tools/local/base/utils/repomap.py index b7b41073ff3..fd865a07d00 100644 --- a/python/composio/tools/local/base/utils/repomap.py +++ b/python/composio/tools/local/base/utils/repomap.py @@ -2,7 +2,6 @@ import math import os import shutil -import warnings from collections import Counter, defaultdict, namedtuple from importlib import resources from pathlib import Path @@ -17,10 +16,6 @@ ) -# Suppress FutureWarning from tree_sitter -warnings.simplefilter("ignore", category=FutureWarning) - - # Define a named tuple for storing tag information Tag = namedtuple("Tag", ["rel_fname", "fname", "line", "name", "kind"]) diff --git a/python/composio/tools/toolset.py b/python/composio/tools/toolset.py index ec60fa8fe6e..5746c81a980 100644 --- a/python/composio/tools/toolset.py +++ b/python/composio/tools/toolset.py @@ -77,9 +77,6 @@ ProcessorType = te.Literal["pre", "post", "schema"] AuthSchemeType = t.Literal["OAUTH2", "OAUTH1", "API_KEY", "BASIC", "BEARER_TOKEN"] -# Enable deprecation warnings -warnings.simplefilter("always", DeprecationWarning) - class IntegrationParams(te.TypedDict): @@ -1071,7 +1068,7 @@ def get_action(self, action: ActionType) -> ActionModel: return self.client.actions.get(actions=[action]).pop() def get_trigger(self, trigger: TriggerType) -> TriggerModel: - return self.client.triggers.get(triggers=[trigger]).pop() + return self.client.triggers.get(trigger_names=[trigger]).pop() def get_integration(self, id: str) -> IntegrationModel: return self.client.integrations.get(id=id) diff --git a/python/composio/utils/warnings.py b/python/composio/utils/warnings.py index f0b4e6d8ea1..f7277bd2afa 100644 --- a/python/composio/utils/warnings.py +++ b/python/composio/utils/warnings.py @@ -1,22 +1,29 @@ """Composio version helpers.""" +import os + import requests import rich from semver import VersionInfo +COMPOSIO_PYPI_METADATA = "https://pypi.org/pypi/composio-core/json" + + def create_latest_version_warning_hook(version: str): def latest_version_warning() -> None: try: - request = requests.get( - "https://pypi.org/pypi/composio-core/json", - timeout=10.0, - ) + if ( + os.environ.get("COMPOSIO_DISABLE_VERSION_CHECK", "false").lower() + == "true" + ): + return + + request = requests.get(COMPOSIO_PYPI_METADATA, timeout=10.0) if request.status_code != 200: return data = request.json() - current_version = VersionInfo.parse(version) latest_version = VersionInfo.parse(data["info"]["version"])