Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
Mirrored from https://github.com/Camo67/composio.git
Synced Nov 22, 23:15 UTC
fix: typing issues
angrybayblade committed
Jun 25, 2025 at 10:37 UTC
b7d123fa764f5a0a48990e0af5c92d8a17817609
25 files changed
+43
-119
python/config/mypy.ini
+20
-1
@@ -1,4 +1,23 @@
1
[mypy]
2
+exclude=apps/composio|utils|\.nox|.*/setup\.py|.*/build/.*
3
strict_optional=True
3
-exclude=apps/composio|utils|\.nox|.*/setup\.py
4
disable_error_code=var-annotated
5
+
6
+; Only add packages which does not have type-stub package
7
+[mypy-pysher.*]
8
+ignore_missing_imports=true
9
+
10
+[mypy-crewai.*]
11
+ignore_missing_imports=true
12
+
13
+[mypy-vertexai.*]
14
+ignore_missing_imports=true
15
+
16
+[mypy-google.adk.*]
17
+ignore_missing_imports=true
18
+
19
+[mypy-google.genai.*]
20
+ignore_missing_imports=true
21
+
22
+[mypy-proto.marshal.collections.maps]
23
+ignore_missing_imports=true
python/examples/fastapi_app.py
+1
-1
@@ -23,4 +23,4 @@ def authorize_app(toolkit: str):
23
user_id=user_id,
24
auth_config_id=auth_config_id,
25
)
26
- return RedirectResponse(url=connection_request.redirect_url)
26
+ return RedirectResponse(url=connection_request.redirect_url) # type: ignore
python/noxfile.py
+19
-2
@@ -12,7 +12,24 @@ modules = [
12
"scripts/",
13
]
14
15
-ruff = ["ruff", "--config", "config/ruff.toml"]
15
+type_stubs = [
16
+ "types-requests",
17
+ "types-protobuf",
18
+ "anthropic",
19
+ "crewai",
20
+ "semver",
21
+ "fastapi",
22
+ "langchain",
23
+ "openai-agents",
24
+ "langchain-openai",
25
+ "google-cloud-aiplatform",
26
+]
27
+
28
+ruff = [
29
+ "ruff",
30
+ "--config",
31
+ "config/ruff.toml",
32
+]
33
34
35
@nox.session
@@ -26,7 +43,7 @@ def fmt(session: Session):
43
@nox.session
44
def chk(session: Session):
45
"""Check for linter and type issues"""
29
- session.install(".", "ruff", "mypy==1.13.0", ".")
46
+ session.install(".", "ruff", "mypy==1.13.0", *type_stubs)
47
session.run(*ruff, "check", *modules)
48
for module in modules:
49
session.run("mypy", "--config-file", "config/mypy.ini", module)
python/providers/anthropic/composio_anthropic/py.typed
python/providers/anthropic/pyproject.toml
-4
@@ -19,7 +19,3 @@ dependencies = [
19
20
[project.urls]
21
Homepage = "https://github.com/ComposioHQ/composio"
22
-
23
-[build-system]
24
-requires = ["hatchling"]
25
-build-backend = "hatchling.build"
\ No newline at end of file
python/providers/crewai/composio_crewai/py.typed
python/providers/crewai/pyproject.toml
-4
@@ -19,7 +19,3 @@ dependencies = [
19
20
[project.urls]
21
Homepage = "https://github.com/ComposioHQ/composio"
22
-
23
-[build-system]
24
-requires = ["hatchling"]
25
-build-backend = "hatchling.build"
\ No newline at end of file
python/providers/gemini/composio_gemini/py.typed
python/providers/gemini/pyproject.toml
-4
@@ -19,7 +19,3 @@ dependencies = [
19
20
[project.urls]
21
Homepage = "https://github.com/ComposioHQ/composio"
22
-
23
-[build-system]
24
-requires = ["hatchling"]
25
-build-backend = "hatchling.build"
\ No newline at end of file
python/providers/google/composio_google/py.typed
python/providers/google/pyproject.toml
-4
@@ -19,7 +19,3 @@ dependencies = [
19
20
[project.urls]
21
Homepage = "https://github.com/ComposioHQ/composio"
22
-
23
-[build-system]
24
-requires = ["hatchling"]
25
-build-backend = "hatchling.build"
\ No newline at end of file
python/providers/google/setup.py
+1
-3
@@ -21,8 +21,6 @@ setup(
21
"Operating System :: OS Independent",
22
],
23
python_requires=">=3.9,<4",
24
- install_requires=[
25
- "google-cloud-aiplatform>=1.38.0",
26
- ],
24
+ install_requires=["google-cloud-aiplatform>=1.38.0", "vertexai"],
25
include_package_data=True,
26
)
python/providers/google_adk/composio_google_adk/py.typed
python/providers/google_adk/pyproject.toml
-4
@@ -19,7 +19,3 @@ dependencies = [
19
20
[project.urls]
21
Homepage = "https://github.com/ComposioHQ/composio"
22
-
23
-[build-system]
24
-requires = ["hatchling"]
25
-build-backend = "hatchling.build"
\ No newline at end of file
python/providers/langchain/composio_langchain/py.typed
python/providers/langchain/pyproject.toml
-4
@@ -19,7 +19,3 @@ dependencies = [
19
20
[project.urls]
21
Homepage = "https://github.com/ComposioHQ/composio"
22
-
23
-[build-system]
24
-requires = ["hatchling"]
25
-build-backend = "hatchling.build"
\ No newline at end of file
python/providers/openai/composio_openai/py.typed
python/providers/openai/openai_assistant_demo.py
+2
-1
@@ -54,7 +54,8 @@ run = openai_client.beta.threads.runs.create(
54
)
55
56
# Execute function calls
57
-run_after_tool_calls = composio.wait_and_handle_assistant_tool_calls(
57
+run_after_tool_calls = composio.provider.wait_and_handle_assistant_tool_calls(
58
+ user_id="default",
59
client=openai_client,
60
run=run,
61
thread=thread,
python/providers/openai/pyproject.toml
-4
@@ -19,7 +19,3 @@ dependencies = [
19
20
[project.urls]
21
Homepage = "https://github.com/ComposioHQ/composio"
22
-
23
-[build-system]
24
-requires = ["hatchling"]
25
-build-backend = "hatchling.build"
\ No newline at end of file
python/providers/openai_agents/composio_openai_agents/py.typed
python/providers/openai_agents/pyproject.toml
-4
@@ -19,7 +19,3 @@ dependencies = [
19
20
[project.urls]
21
Homepage = "https://github.com/ComposioHQ/composio"
22
-
23
-[build-system]
24
-requires = ["hatchling"]
25
-build-backend = "hatchling.build"
\ No newline at end of file
python/pyproject.toml
-3
@@ -30,6 +30,3 @@ dev = [
30
"click>=8.2.1",
31
"semver>=3.0.4",
32
]
33
-[build-system]
34
-requires = ["hatchling"]
35
-build-backend = "hatchling.build"
python/tests/test_core.py
deleted
-6
@@ -1,6 +0,0 @@
1
-import pytest
2
-
3
-
4
-@pytest.mark.core
5
-def test_core_imports():
6
- """Tests that the imports work."""
python/tests/test_langchain.py
deleted
-6
@@ -1,6 +0,0 @@
1
-import pytest
2
-
3
-
4
-@pytest.mark.langchain
5
-def test_langchain_get_tools():
6
- """we can get tools with the langchainProvider"""
python/tests/test_openai.py
deleted
-64
@@ -1,64 +0,0 @@
1
-import pytest
2
-
3
-
4
-@pytest.mark.openai
5
-def test_openai_get_tools():
6
- """we can get tools with the OpenAIProvider"""
7
- from composio_openai import OpenAIProvider
8
-
9
- from composio.core import Composio
10
-
11
- composio = Composio(provider=OpenAIProvider())
12
- # Get GitHub tools that are pre-configured
13
- tools = composio.tools.get(user_id="default", filters={"toolkits": ["GITHUB"]})
14
- assert isinstance(tools, list)
15
- assert "function" in tools[0]
16
- assert "type" in tools[0]
17
- assert tools[0].get("type") == "function"
18
-
19
-
20
-@pytest.mark.openai
21
-def test_openai_get_multiple_tools():
22
- """We can get multiple tools with the OpenAIProvider"""
23
- from composio_openai import OpenAIProvider
24
-
25
- from composio.core import Composio
26
-
27
- composio_openai_provider = OpenAIProvider()
28
- composio = Composio(provider=composio_openai_provider)
29
- tools = composio.tools.get(
30
- user_id="default", filters={"category": "search", "limit": 10}
31
- )
32
- print(tools)
33
-
34
-
35
-@pytest.mark.openai
36
-def test_openai_handle_tool_calls():
37
- """Handles tool calls after getting tools"""
38
- from composio_openai import OpenAIProvider
39
- from openai import OpenAI
40
-
41
- from composio.core import Composio
42
-
43
- # Initialize tools.
44
- openai_client = OpenAI()
45
- composio = Composio(provider=OpenAIProvider())
46
-
47
- # Get GitHub tools that are pre-configured
48
- tools = composio.tools.get(user_id="default", filters={"toolkits": ["HACKERNEWS"]})
49
- # Get response from the LLM
50
- response = openai_client.chat.completions.create(
51
- model="gpt-4-turbo-preview",
52
- tools=tools,
53
- messages=[
54
- {"role": "system", "content": "You are a helpful assistant."},
55
- {
56
- "role": "user",
57
- "content": "Get the user details for `dang` on Hackernews.",
58
- },
59
- ],
60
- )
61
- # Execute the function calls.
62
- result = composio.provider.handle_tool_calls(response=response, user_id="default")
63
- assert result[0].data["response_data"]["username"] == "dang"
64
- print(result)