aws / aws/bedrock-agentcore-sdk-python
mypy not passing
- 主要語言
- Python
- 星號
- 761
- 分支
- 147
- 平均合併
- 1 天 23 小時
- 30 天內合併 PR
- 7
描述
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
```
貢獻指南
研究方向
首先在 `main` 上執行 `uv run mypy . | wc`,然後檢查整個 SDK 中回報的錯誤。使用 `main.py` 範例檢查公開 `entrypoint`、payload、agent call 和 `run` 的型別。完成的標準是 mypy 通過且沒有錯誤或註記,並且該範例不再產生所顯示的 pyright 未知型別診斷。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- python
- 領域
- developer-experience
- Issue 類型
- 重構
- 難度
- 5/5
- 預估耗時
- 一週以上
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 25/100