Skip to content

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

fix: typing issues

angrybaybladeb7d123fa764f
diff --git a/python/config/mypy.ini b/python/config/mypy.ini
index 707cbd43a..0706bc071 100644
--- a/python/config/mypy.ini
+++ b/python/config/mypy.ini
@@ -1,4 +1,23 @@
[mypy]
+exclude=apps/composio|utils|\.nox|.*/setup\.py|.*/build/.*
strict_optional=True
-exclude=apps/composio|utils|\.nox|.*/setup\.py
disable_error_code=var-annotated
+
+; Only add packages which does not have type-stub package
+[mypy-pysher.*]
+ignore_missing_imports=true
+
+[mypy-crewai.*]
+ignore_missing_imports=true
+
+[mypy-vertexai.*]
+ignore_missing_imports=true
+
+[mypy-google.adk.*]
+ignore_missing_imports=true
+
+[mypy-google.genai.*]
+ignore_missing_imports=true
+
+[mypy-proto.marshal.collections.maps]
+ignore_missing_imports=true
diff --git a/python/examples/fastapi_app.py b/python/examples/fastapi_app.py
index ad70b2432..f9cfa796e 100644
--- a/python/examples/fastapi_app.py
+++ b/python/examples/fastapi_app.py
@@ -23,4 +23,4 @@ def authorize_app(toolkit: str):
user_id=user_id,
auth_config_id=auth_config_id,
)
- return RedirectResponse(url=connection_request.redirect_url)
+ return RedirectResponse(url=connection_request.redirect_url) # type: ignore
diff --git a/python/noxfile.py b/python/noxfile.py
index e7cdd3c21..cd11d4eec 100644
--- a/python/noxfile.py
+++ b/python/noxfile.py
@@ -12,7 +12,24 @@ modules = [
"scripts/",
]
-ruff = ["ruff", "--config", "config/ruff.toml"]
+type_stubs = [
+ "types-requests",
+ "types-protobuf",
+ "anthropic",
+ "crewai",
+ "semver",
+ "fastapi",
+ "langchain",
+ "openai-agents",
+ "langchain-openai",
+ "google-cloud-aiplatform",
+]
+
+ruff = [
+ "ruff",
+ "--config",
+ "config/ruff.toml",
+]
@nox.session
@@ -26,7 +43,7 @@ def fmt(session: Session):
@nox.session
def chk(session: Session):
"""Check for linter and type issues"""
- session.install(".", "ruff", "mypy==1.13.0", ".")
+ session.install(".", "ruff", "mypy==1.13.0", *type_stubs)
session.run(*ruff, "check", *modules)
for module in modules:
session.run("mypy", "--config-file", "config/mypy.ini", module)
diff --git a/python/providers/anthropic/composio_anthropic/py.typed b/python/providers/anthropic/composio_anthropic/py.typed
new file mode 100644
index 000000000..e69de29bb
diff --git a/python/providers/anthropic/pyproject.toml b/python/providers/anthropic/pyproject.toml
index f1c8521d4..8c8e29094 100644
--- a/python/providers/anthropic/pyproject.toml
+++ b/python/providers/anthropic/pyproject.toml
@@ -19,7 +19,3 @@ dependencies = [
[project.urls]
Homepage = "https://github.com/ComposioHQ/composio"
-
-[build-system]
-requires = ["hatchling"]
-build-backend = "hatchling.build"
\ No newline at end of file
diff --git a/python/providers/crewai/composio_crewai/py.typed b/python/providers/crewai/composio_crewai/py.typed
new file mode 100644
index 000000000..e69de29bb
diff --git a/python/providers/crewai/pyproject.toml b/python/providers/crewai/pyproject.toml
index dec57c931..890c5c284 100644
--- a/python/providers/crewai/pyproject.toml
+++ b/python/providers/crewai/pyproject.toml
@@ -19,7 +19,3 @@ dependencies = [
[project.urls]
Homepage = "https://github.com/ComposioHQ/composio"
-
-[build-system]
-requires = ["hatchling"]
-build-backend = "hatchling.build"
\ No newline at end of file
diff --git a/python/providers/gemini/composio_gemini/py.typed b/python/providers/gemini/composio_gemini/py.typed
new file mode 100644
index 000000000..e69de29bb
diff --git a/python/providers/gemini/pyproject.toml b/python/providers/gemini/pyproject.toml
index 273f10078..432eadd16 100644
--- a/python/providers/gemini/pyproject.toml
+++ b/python/providers/gemini/pyproject.toml
@@ -19,7 +19,3 @@ dependencies = [
[project.urls]
Homepage = "https://github.com/ComposioHQ/composio"
-
-[build-system]
-requires = ["hatchling"]
-build-backend = "hatchling.build"
\ No newline at end of file
diff --git a/python/providers/google/composio_google/py.typed b/python/providers/google/composio_google/py.typed
new file mode 100644
index 000000000..e69de29bb
diff --git a/python/providers/google/pyproject.toml b/python/providers/google/pyproject.toml
index 47e7f3883..4270bb943 100644
--- a/python/providers/google/pyproject.toml
+++ b/python/providers/google/pyproject.toml
@@ -19,7 +19,3 @@ dependencies = [
[project.urls]
Homepage = "https://github.com/ComposioHQ/composio"
-
-[build-system]
-requires = ["hatchling"]
-build-backend = "hatchling.build"
\ No newline at end of file
diff --git a/python/providers/google/setup.py b/python/providers/google/setup.py
index 5697fa6f8..11a993212 100644
--- a/python/providers/google/setup.py
+++ b/python/providers/google/setup.py
@@ -21,8 +21,6 @@ setup(
"Operating System :: OS Independent",
],
python_requires=">=3.9,<4",
- install_requires=[
- "google-cloud-aiplatform>=1.38.0",
- ],
+ install_requires=["google-cloud-aiplatform>=1.38.0", "vertexai"],
include_package_data=True,
)
diff --git a/python/providers/google_adk/composio_google_adk/py.typed b/python/providers/google_adk/composio_google_adk/py.typed
new file mode 100644
index 000000000..e69de29bb
diff --git a/python/providers/google_adk/pyproject.toml b/python/providers/google_adk/pyproject.toml
index ae235b05f..eb21b96f6 100644
--- a/python/providers/google_adk/pyproject.toml
+++ b/python/providers/google_adk/pyproject.toml
@@ -19,7 +19,3 @@ dependencies = [
[project.urls]
Homepage = "https://github.com/ComposioHQ/composio"
-
-[build-system]
-requires = ["hatchling"]
-build-backend = "hatchling.build"
\ No newline at end of file
diff --git a/python/providers/langchain/composio_langchain/py.typed b/python/providers/langchain/composio_langchain/py.typed
new file mode 100644
index 000000000..e69de29bb
diff --git a/python/providers/langchain/pyproject.toml b/python/providers/langchain/pyproject.toml
index cc270f76e..d0adf144b 100644
--- a/python/providers/langchain/pyproject.toml
+++ b/python/providers/langchain/pyproject.toml
@@ -19,7 +19,3 @@ dependencies = [
[project.urls]
Homepage = "https://github.com/ComposioHQ/composio"
-
-[build-system]
-requires = ["hatchling"]
-build-backend = "hatchling.build"
\ No newline at end of file
diff --git a/python/providers/openai/composio_openai/py.typed b/python/providers/openai/composio_openai/py.typed
new file mode 100644
index 000000000..e69de29bb
diff --git a/python/providers/openai/openai_assistant_demo.py b/python/providers/openai/openai_assistant_demo.py
index ca1a7b099..d8bdbc815 100644
--- a/python/providers/openai/openai_assistant_demo.py
+++ b/python/providers/openai/openai_assistant_demo.py
@@ -54,7 +54,8 @@ run = openai_client.beta.threads.runs.create(
)
# Execute function calls
-run_after_tool_calls = composio.wait_and_handle_assistant_tool_calls(
+run_after_tool_calls = composio.provider.wait_and_handle_assistant_tool_calls(
+ user_id="default",
client=openai_client,
run=run,
thread=thread,
diff --git a/python/providers/openai/pyproject.toml b/python/providers/openai/pyproject.toml
index fcd40d8fe..fe698d257 100644
--- a/python/providers/openai/pyproject.toml
+++ b/python/providers/openai/pyproject.toml
@@ -19,7 +19,3 @@ dependencies = [
[project.urls]
Homepage = "https://github.com/ComposioHQ/composio"
-
-[build-system]
-requires = ["hatchling"]
-build-backend = "hatchling.build"
\ No newline at end of file
diff --git a/python/providers/openai_agents/composio_openai_agents/py.typed b/python/providers/openai_agents/composio_openai_agents/py.typed
new file mode 100644
index 000000000..e69de29bb
diff --git a/python/providers/openai_agents/pyproject.toml b/python/providers/openai_agents/pyproject.toml
index 956d3d2e0..4d3eabbb7 100644
--- a/python/providers/openai_agents/pyproject.toml
+++ b/python/providers/openai_agents/pyproject.toml
@@ -19,7 +19,3 @@ dependencies = [
[project.urls]
Homepage = "https://github.com/ComposioHQ/composio"
-
-[build-system]
-requires = ["hatchling"]
-build-backend = "hatchling.build"
\ No newline at end of file
diff --git a/python/pyproject.toml b/python/pyproject.toml
index 07d0dadef..30a761c29 100644
--- a/python/pyproject.toml
+++ b/python/pyproject.toml
@@ -30,6 +30,3 @@ dev = [
"click>=8.2.1",
"semver>=3.0.4",
]
-[build-system]
-requires = ["hatchling"]
-build-backend = "hatchling.build"
diff --git a/python/tests/test_core.py b/python/tests/test_core.py
deleted file mode 100644
index 6d2de6c6b..000000000
--- a/python/tests/test_core.py
+++ /dev/null
@@ -1,6 +0,0 @@
-import pytest
-
-
-def test_core_imports():
- """Tests that the imports work."""
diff --git a/python/tests/test_langchain.py b/python/tests/test_langchain.py
deleted file mode 100644
index c15ee8942..000000000
--- a/python/tests/test_langchain.py
+++ /dev/null
@@ -1,6 +0,0 @@
-import pytest
-
-
-def test_langchain_get_tools():
- """we can get tools with the langchainProvider"""
diff --git a/python/tests/test_openai.py b/python/tests/test_openai.py
deleted file mode 100644
index e827a7ff5..000000000
--- a/python/tests/test_openai.py
+++ /dev/null
@@ -1,64 +0,0 @@
-import pytest
-
-
-def test_openai_get_tools():
- """we can get tools with the OpenAIProvider"""
- from composio_openai import OpenAIProvider
-
- from composio.core import Composio
-
- composio = Composio(provider=OpenAIProvider())
- # Get GitHub tools that are pre-configured
- tools = composio.tools.get(user_id="default", filters={"toolkits": ["GITHUB"]})
- assert isinstance(tools, list)
- assert "function" in tools[0]
- assert "type" in tools[0]
- assert tools[0].get("type") == "function"
-
-
-def test_openai_get_multiple_tools():
- """We can get multiple tools with the OpenAIProvider"""
- from composio_openai import OpenAIProvider
-
- from composio.core import Composio
-
- composio_openai_provider = OpenAIProvider()
- composio = Composio(provider=composio_openai_provider)
- tools = composio.tools.get(
- user_id="default", filters={"category": "search", "limit": 10}
- )
- print(tools)
-
-
-def test_openai_handle_tool_calls():
- """Handles tool calls after getting tools"""
- from composio_openai import OpenAIProvider
- from openai import OpenAI
-
- from composio.core import Composio
-
- # Initialize tools.
- openai_client = OpenAI()
- composio = Composio(provider=OpenAIProvider())
-
- # Get GitHub tools that are pre-configured
- tools = composio.tools.get(user_id="default", filters={"toolkits": ["HACKERNEWS"]})
- # Get response from the LLM
- response = openai_client.chat.completions.create(
- model="gpt-4-turbo-preview",
- tools=tools,
- messages=[
- {"role": "system", "content": "You are a helpful assistant."},
- {
- "role": "user",
- "content": "Get the user details for `dang` on Hackernews.",
- },
- ],
- )
- # Execute the function calls.
- result = composio.provider.handle_tool_calls(response=response, user_id="default")
- assert result[0].data["response_data"]["username"] == "dang"
- print(result)