diff --git a/python/.pylintrc b/python/.pylintrc index 71745024d86..9fa84070333 100644 --- a/python/.pylintrc +++ b/python/.pylintrc @@ -3,7 +3,7 @@ ignore-patterns= ignore= [MESSAGES CONTROL] -disable=C0114,C0115,C0116,C0301,C0103,W0603,R1715,W0621,R0903,W0237,W0511,W0622,R0913,R0902,W0221,C0302,R0801,C0411,C0412,W0719,W0718,R0914,R0916,R0912,R0911,W0102,C0325,E0401,W0246,E0611 +disable=C0114,C0115,C0116,C0301,C0103,W0603,R1715,W0621,R0903,W0237,W0511,W0622,R0913,R0902,W0221,C0302,R0801,C0411,C0412,W0719,W0718,R0914,R0916,R0912,R0911,W0102,C0325,E0401,W0246,E0611,R0401 # To discuss # W0621: redefined-outer-name @@ -19,6 +19,7 @@ disable=C0114,C0115,C0116,C0301,C0103,W0603,R1715,W0621,R0903,W0237,W0511,W0622, # E0401: import-error # W0246: useless-parent-delegation # E0611: no-name-in-module +# R0401: cyclic-import # Design issues to discuss # R0914: too-many-locals diff --git a/python/composio/__init__.py b/python/composio/__init__.py index 36d700e213f..74bb7c6620f 100644 --- a/python/composio/__init__.py +++ b/python/composio/__init__.py @@ -37,4 +37,4 @@ "action", ) -__version__ = "0.4.4" +__version__ = "0.4.5" diff --git a/python/composio/client/enums/base.py b/python/composio/client/enums/base.py index 0f050ea55fb..373a4e56dbe 100644 --- a/python/composio/client/enums/base.py +++ b/python/composio/client/enums/base.py @@ -11,6 +11,7 @@ from composio.constants import LOCAL_CACHE_DIRECTORY from composio.exceptions import ComposioSDKError from composio.storage.base import LocalStorage +from composio.utils.logging import get_logger _model_cache: t.Dict[str, LocalStorage] = {} @@ -152,10 +153,18 @@ def load(self) -> EntityType: if self._slug in _runtime_actions: return _runtime_actions[self._slug] # type: ignore if not (self._path / self._slug).exists(): - raise MetadataFileNotFound( - f"Metadata file for `{self._slug}` not found, " - "Please run `composio apps update` to fix this" + from composio.cli.apps import ( # pylint: disable=import-outside-toplevel + update, ) + from composio.cli.context import ( # pylint: disable=import-outside-toplevel + get_context, + ) + + logger = get_logger() + logger.debug( + f"Metadata file for `{self._slug}` not found, updating metadata" + ) + update(context=get_context()) if self._slug not in _model_cache: _model_cache[self._slug] = self._model.load(self._path / self._slug) return t.cast(EntityType, _model_cache[self._slug]) diff --git a/python/composio/tools/local/base/decorators.py b/python/composio/tools/local/base/decorators.py index ff2d52b49e6..8c39e05c4f0 100644 --- a/python/composio/tools/local/base/decorators.py +++ b/python/composio/tools/local/base/decorators.py @@ -128,7 +128,9 @@ def _parse_docstring( ) -> t.Tuple[str, t.Dict[str, str], t.Optional[t.Tuple[str, str]],]: """Parse docstring for descriptions.""" if docstr is None: - raise ValueError("Docstring is None, Please provide a docstring for runtime tools") + raise ValueError( + "Docstring is None, Please provide a docstring for runtime tools" + ) header, *descriptions = docstr.lstrip().rstrip().split("\n") params = {} returns = None diff --git a/python/composio/tools/toolset.py b/python/composio/tools/toolset.py index 85fd2484e57..fce50c1182f 100644 --- a/python/composio/tools/toolset.py +++ b/python/composio/tools/toolset.py @@ -498,13 +498,9 @@ def execute_action( action = Action(action) is_runtime = action.is_runtime self.logger.debug(f"Action: {action}, runtime: {is_runtime}") + params = self._serialize_execute_params(param=params) if not is_runtime: - params = self._process_request( - action=action, - request=self._serialize_execute_params( - param=params, - ), - ) + params = self._process_request(action=action, request=params) metadata = self._add_metadata(action=action, metadata=metadata) response = ( self._execute_local( @@ -582,6 +578,7 @@ def action_preprocessing(self, action_item: ActionModel) -> ActionModel: if param_details.get("properties") == FileType.schema().get("properties"): action_item.parameters.properties[param_name].pop("properties") action_item.parameters.properties[param_name] = { + "default": param_details.get("default"), "type": "string", "format": "file-path", "description": f"File path to {param_details.get('description', '')}", @@ -592,6 +589,7 @@ def action_preprocessing(self, action_item: ActionModel) -> ActionModel: action_item.parameters.properties[param_name].pop("allOf") action_item.parameters.properties[param_name].update( { + "default": param_details.get("default"), "type": "string", "format": "file-path", "description": f"File path to {param_details.get('description', '')}", diff --git a/python/composio/utils/logging.py b/python/composio/utils/logging.py index 342a5a99c08..887dc0050a0 100644 --- a/python/composio/utils/logging.py +++ b/python/composio/utils/logging.py @@ -106,3 +106,6 @@ def __init__( def logger(self) -> logging.Logger: """Get the component logger.""" return t.cast(logging.Logger, self._logger) + + +get_logger = get diff --git a/python/dockerfiles/Dockerfile b/python/dockerfiles/Dockerfile index e268a371045..4aae440c7c2 100644 --- a/python/dockerfiles/Dockerfile +++ b/python/dockerfiles/Dockerfile @@ -19,7 +19,7 @@ RUN /bin/python3 -m venv .composio/venv RUN export PATH=$PATH:$(pwd)/.composio/venv/bin # Install composio -RUN python -m pip install composio-core[all]==0.4.4 fastapi playwright uvicorn +RUN python -m pip install composio-core[all]==0.4.5 fastapi playwright uvicorn # Install playwright deps RUN playwright install-deps diff --git a/python/dockerfiles/Dockerfile.dev b/python/dockerfiles/Dockerfile.dev index b5eff21cc6b..af06b3d81c6 100644 --- a/python/dockerfiles/Dockerfile.dev +++ b/python/dockerfiles/Dockerfile.dev @@ -20,7 +20,7 @@ RUN export PATH=$PATH:$(pwd)/.composio/venv/bin # Install composio for dependency caching # Install composio -RUN python -m pip install composio-core[all]==0.4.4 fastapi playwright uvicorn +RUN python -m pip install composio-core[all]==0.4.5 fastapi playwright uvicorn # Install playwright deps RUN playwright install-deps diff --git a/python/plugins/autogen/setup.py b/python/plugins/autogen/setup.py index ef839b7aba9..0faa2fdcf8c 100644 --- a/python/plugins/autogen/setup.py +++ b/python/plugins/autogen/setup.py @@ -9,7 +9,7 @@ setup( name="composio_autogen", - version="0.4.4", + version="0.4.5", author="Sawradip", author_email="sawradip@composio.dev", description="Use Composio to get an array of tools with your Autogen agent.", @@ -22,6 +22,6 @@ "Operating System :: OS Independent", ], python_requires=">=3.9,<4", - install_requires=["composio_core==0.4.4", "pyautogen>=0.2.19"], + install_requires=["composio_core==0.4.5", "pyautogen>=0.2.19"], include_package_data=True, ) diff --git a/python/plugins/camel/setup.py b/python/plugins/camel/setup.py index 739b00fbb27..481226b2fbf 100644 --- a/python/plugins/camel/setup.py +++ b/python/plugins/camel/setup.py @@ -9,7 +9,7 @@ setup( name="composio_camel", - version="0.4.4", + version="0.4.5", author="Sawradip", author_email="sawradip@composio.dev", description="Use Composio to get an array of tools with your Claude LLMs.", @@ -22,6 +22,6 @@ "Operating System :: OS Independent", ], python_requires=">=3.9,<4", - install_requires=["composio_core==0.4.4", "camel-ai>=0.1.5.7"], + install_requires=["composio_core==0.4.5", "camel-ai>=0.1.5.7"], include_package_data=True, ) diff --git a/python/plugins/claude/setup.py b/python/plugins/claude/setup.py index b433097925c..3af179525c8 100644 --- a/python/plugins/claude/setup.py +++ b/python/plugins/claude/setup.py @@ -9,7 +9,7 @@ setup( name="composio_claude", - version="0.4.4", + version="0.4.5", author="Sawradip", author_email="sawradip@composio.dev", description="Use Composio to get an array of tools with your Claude LLMs.", @@ -22,6 +22,6 @@ "Operating System :: OS Independent", ], python_requires=">=3.9,<4", - install_requires=["composio_openai==0.4.4", "anthropic>=0.25.7"], + install_requires=["composio_openai==0.4.5", "anthropic>=0.25.7"], include_package_data=True, ) diff --git a/python/plugins/crew_ai/setup.py b/python/plugins/crew_ai/setup.py index 573c869764e..7366460669d 100644 --- a/python/plugins/crew_ai/setup.py +++ b/python/plugins/crew_ai/setup.py @@ -9,7 +9,7 @@ setup( name="composio_crewai", - version="0.4.4", + version="0.4.5", author="Himanshu", author_email="himanshu@composio.dev", description="Use Composio to get an array of tools with your CrewAI agent.", @@ -22,6 +22,6 @@ "Operating System :: OS Independent", ], python_requires=">=3.9,<4", - install_requires=["composio_langchain==0.4.4", "crewai"], + install_requires=["composio_langchain==0.4.5", "crewai"], include_package_data=True, ) diff --git a/python/plugins/griptape/setup.py b/python/plugins/griptape/setup.py index cbf7a8321af..647ec6aea32 100644 --- a/python/plugins/griptape/setup.py +++ b/python/plugins/griptape/setup.py @@ -9,7 +9,7 @@ setup( name="composio_griptape", - version="0.4.4", + version="0.4.5", author="Sawradip", author_email="sawradip@composio.dev", description="Use Composio to get an array of tools with your Griptape wokflow.", @@ -22,6 +22,6 @@ "Operating System :: OS Independent", ], python_requires=">=3.9,<4", - install_requires=["composio_core==0.4.4", "griptape>=0.24.2"], + install_requires=["composio_core==0.4.5", "griptape>=0.24.2"], include_package_data=True, ) diff --git a/python/plugins/julep/setup.py b/python/plugins/julep/setup.py index 61c9318c38b..9cda9c410db 100644 --- a/python/plugins/julep/setup.py +++ b/python/plugins/julep/setup.py @@ -9,7 +9,7 @@ setup( name="composio_julep", - version="0.4.4", + version="0.4.5", author="Sawradip", author_email="sawradip@composio.dev", description="Use Composio to get an array of tools with your Julep wokflow.", @@ -22,6 +22,6 @@ "Operating System :: OS Independent", ], python_requires=">=3.9,<4", - install_requires=["composio_openai==0.4.4", "julep>=0.3.2"], + install_requires=["composio_openai==0.4.5", "julep>=0.3.2"], include_package_data=True, ) diff --git a/python/plugins/langchain/setup.py b/python/plugins/langchain/setup.py index d839ea6c25c..11e52713b29 100644 --- a/python/plugins/langchain/setup.py +++ b/python/plugins/langchain/setup.py @@ -9,7 +9,7 @@ setup( name="composio_langchain", - version="0.4.4", + version="0.4.5", author="Karan", author_email="karan@composio.dev", description="Use Composio to get an array of tools with your LangChain agent.", @@ -27,7 +27,7 @@ "langchain-openai>=0.0.2.post1", "pydantic>=2.6.4", "langchainhub>=0.1.15", - "composio_core==0.4.4", + "composio_core==0.4.5", ], include_package_data=True, ) diff --git a/python/plugins/langgraph/setup.py b/python/plugins/langgraph/setup.py index 8c2488ddf3e..690b68fca95 100644 --- a/python/plugins/langgraph/setup.py +++ b/python/plugins/langgraph/setup.py @@ -9,7 +9,7 @@ setup( name="composio_langgraph", - version="0.4.4", + version="0.4.5", author="Sawradip", author_email="sawradip@composio.dev", description="Use Composio to get array of tools with LnagGraph Agent Workflows", @@ -23,7 +23,7 @@ ], python_requires=">=3.9,<4", install_requires=[ - "composio_langchain==0.4.4", + "composio_langchain==0.4.5", "langgraph", ], include_package_data=True, diff --git a/python/plugins/llamaindex/setup.py b/python/plugins/llamaindex/setup.py index ffcec917c4d..e34e04da59d 100644 --- a/python/plugins/llamaindex/setup.py +++ b/python/plugins/llamaindex/setup.py @@ -9,7 +9,7 @@ setup( name="composio_llamaindex", - version="0.4.4", + version="0.4.5", author="Sawradip", author_email="sawradip@composio.dev", description="Use Composio to get an array of tools with your LlamaIndex agent.", @@ -24,7 +24,7 @@ python_requires=">=3.9,<4", install_requires=[ "llama_index>=0.10.43", - "composio_langchain==0.4.4", + "composio_langchain==0.4.5", ], include_package_data=True, ) diff --git a/python/plugins/lyzr/setup.py b/python/plugins/lyzr/setup.py index 8569bcfe787..60d7610d2b8 100644 --- a/python/plugins/lyzr/setup.py +++ b/python/plugins/lyzr/setup.py @@ -9,7 +9,7 @@ setup( name="composio_lyzr", - version="0.4.4", + version="0.4.5", author="Sawradip", author_email="sawradip@composio.dev", description="Use Composio to get an array of tools with your Lyzr workflow.", @@ -25,7 +25,7 @@ install_requires=[ "lyzr-automata>=0.1.3", "pydantic>=2.6.4", - "composio_core==0.4.4", + "composio_core==0.4.5", "langchain>=0.1.0", ], include_package_data=True, diff --git a/python/plugins/openai/setup.py b/python/plugins/openai/setup.py index 537fbfd25af..20f0f397c16 100644 --- a/python/plugins/openai/setup.py +++ b/python/plugins/openai/setup.py @@ -9,7 +9,7 @@ setup( name="composio_openai", - version="0.4.4", + version="0.4.5", author="Sawradip", author_email="sawradip@composio.dev", description="Use Composio to get an array of tools with your OpenAI Function Call.", @@ -22,6 +22,6 @@ "Operating System :: OS Independent", ], python_requires=">=3.9,<4", - install_requires=["composio_core==0.4.4"], + install_requires=["composio_core==0.4.5"], include_package_data=True, ) diff --git a/python/plugins/phidata/setup.py b/python/plugins/phidata/setup.py index e0502b5945a..5f5a58d1c7b 100644 --- a/python/plugins/phidata/setup.py +++ b/python/plugins/phidata/setup.py @@ -9,7 +9,7 @@ setup( name="composio_phidata", - version="0.4.4", + version="0.4.5", author="Sawradip", author_email="sawradip@composio.dev", description="Use Composio to get an array of tools with your Phidata Plugin.", @@ -23,8 +23,8 @@ ], python_requires=">=3.9,<4", install_requires=[ - "composio_core==0.4.4", - "composio_openai==0.4.4", + "composio_core==0.4.5", + "composio_openai==0.4.5", "phidata", ], include_package_data=True, diff --git a/python/plugins/praisonai/setup.py b/python/plugins/praisonai/setup.py index 2d3d1566a1a..73401926f6f 100644 --- a/python/plugins/praisonai/setup.py +++ b/python/plugins/praisonai/setup.py @@ -9,7 +9,7 @@ setup( name="composio_praisonai", - version="0.4.4", + version="0.4.5", author="Sawradip", author_email="sawradip@composio.dev", description="Use Composio Tools to enhance your PraisonAI agents capabilities.", @@ -22,6 +22,6 @@ "Operating System :: OS Independent", ], python_requires=">=3.9", - install_requires=["composio_core==0.4.4", "PraisonAI>=0.0.2"], + install_requires=["composio_core==0.4.5", "PraisonAI>=0.0.2"], include_package_data=True, ) diff --git a/python/setup.py b/python/setup.py index 149f39f5c76..d2aa1f52e9f 100644 --- a/python/setup.py +++ b/python/setup.py @@ -73,7 +73,7 @@ def scan_for_package_data( setup( name="composio_core", - version="0.4.4", + version="0.4.5", author="Utkarsh", author_email="utkarsh@composio.dev", description="Core package to act as a bridge between composio platform and other services.", diff --git a/python/swe/examples/langgraph_agent/benchmark.py b/python/swe/examples/langgraph_agent/benchmark.py index a1fcd9c8875..2f2edda4459 100644 --- a/python/swe/examples/langgraph_agent/benchmark.py +++ b/python/swe/examples/langgraph_agent/benchmark.py @@ -1,6 +1,5 @@ import argparse -from agent import composio_toolset, graph from langchain_core.messages import HumanMessage from composio_langgraph import Action @@ -8,6 +7,8 @@ from swekit.benchmark.run_evaluation import evaluate from swekit.config.store import IssueConfig +from agent import composio_toolset, graph + def bench(workspace_id: str, issue_config: IssueConfig) -> str: """Run benchmark on the agent.""" diff --git a/python/swe/examples/langgraph_agent/inputs.py b/python/swe/examples/langgraph_agent/inputs.py index e8d357bf49b..7c26c8dd2a4 100644 --- a/python/swe/examples/langgraph_agent/inputs.py +++ b/python/swe/examples/langgraph_agent/inputs.py @@ -2,10 +2,10 @@ import typing as t from pathlib import Path -from agent import composio_toolset - from composio import Action +from agent import composio_toolset + InputType = t.TypeVar("InputType") diff --git a/python/swe/examples/langgraph_agent/main.py b/python/swe/examples/langgraph_agent/main.py index 454488be53b..f4e2eca13f1 100644 --- a/python/swe/examples/langgraph_agent/main.py +++ b/python/swe/examples/langgraph_agent/main.py @@ -1,9 +1,10 @@ -from agent import composio_toolset, graph from inputs import from_github from langchain_core.messages import HumanMessage from composio_langgraph import Action +from agent import composio_toolset, graph + def main() -> None: """Run the agent.""" diff --git a/python/swe/setup.py b/python/swe/setup.py index 0a909e42841..21ed43b1e63 100644 --- a/python/swe/setup.py +++ b/python/swe/setup.py @@ -35,7 +35,7 @@ def scan_for_package_data( setup( name="swekit", - version="0.1.9", + version="0.1.10", author="Shubhra", author_email="shubhra@composio.dev", description="Tools for running a SWE agent using Composio platform", diff --git a/python/tox.ini b/python/tox.ini index 46e46184420..9a2c716111a 100644 --- a/python/tox.ini +++ b/python/tox.ini @@ -124,7 +124,7 @@ skip=plugins/langchain/langchain_demo.py known_first_party=composio known_plugins=composio_langchain,composio_crewai,composio_autogen,composio_lyzr,composio_openai,composio_claude,composio_griptape,composio_langgraph,composio_praisonai,composio_camel known_packages=swekit -known_local_folder=tests +known_localfolder=tests,examples,agent sections=FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,PLUGINS,PACKAGES,LOCALFOLDER [flake8]