aws / aws/bedrock-agentcore-sdk-python
mypy not passing
- 主要言語
- Python
- スター
- 761
- フォーク
- 147
- 平均マージ
- 1日 23時間
- マージ済み PR(30日)
- 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 の unknown-type 診断が出なくなれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- developer-experience
- issue の種類
- リファクタリング
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 25/100