aws / aws/bedrock-agentcore-sdk-python

mypy not passing

未关闭
#167 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
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
```

贡献指南

打开贡献指南

调研方向

Start by running `uv run mypy . | wc` on `main`, then inspect the reported errors across the SDK. Use the `main.py` example to check the public `entrypoint`, payload, agent call, and `run` types. Done means mypy passes without errors or notes and the example no longer produces the shown pyright unknown-type diagnostics.

由索引模型根据 Issue 内容生成。

评估

技术栈
python
领域
developer-experience
Issue 类型
重构
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
基本清楚
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。