aws / aws/bedrock-agentcore-sdk-python

mypy not passing

Open
#167 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
761
Forks
147
Avg merge
1d 23h
Merged PRs (30d)
7

Description

Right now on branch `main` there are 1742 errors and notes on mypy.
```bash
uv run mypy . | wc
1742
```

I discovered this because I use `pyright` on `strict` mode by default.

Given this sample code:
```python
from bedrock_agentcore import BedrockAgentCoreApp
from strands import Agent

app = BedrockAgentCoreApp(debug=True)
agent = Agent()

@app.entrypoint
def invoke(payload):
"""Your AI agent function"""
user_message = payload.get("prompt", "Hello! How can I help you today?")
app.logger.info(f"User message: {user_message}")
result = agent(user_message)
return {"result": result.message}

if __name__ == "__main__":
app.run()
```
I get the following results from `pyright`:
```
main.py
/homes/myuser/myproject/main.py:8:2 - error: Type of "entrypoint" is partially unknown
  Type of "entrypoint" is "(func: (...) -> Unknown) -> ((...) -> Unknown)" (reportUnknownMemberType)
/homes/myuser/myproject/main.py:9:12 - error: Type of parameter "payload" is unknown (reportUnknownParameterType)
/homes/myuser/myproject/main.py:9:12 - error: Type annotation is missing for parameter "payload" (reportMissingParameterType)
/homes/myuser/myproject/main.py:11:5 - error: Type of "user_message" is unknown (reportUnknownVariableType)
/homes/myuser/myproject/main.py:11:20 - error: Type of "get" is unknown (reportUnknownMemberType)
/homes/myuser/myproject/main.py:13:20 - error: Argument type is unknown
  Argument corresponds to parameter "prompt" in function "__call__" (reportUnknownArgumentType)
/homes/myuser/myproject/main.py:18:5 - error: Type of "run" is partially unknown
  Type of "run" is "(port: int = 8080, host: str | None = None, **kwargs: Unknown) -> None" (reportUnknownMemberType)
7 errors, 0 warnings, 0 informations
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.