aws / aws/bedrock-agentcore-sdk-python
mypy not passing
- Lingua principale
- Python
- Stelle
- 761
- Fork
- 147
- Merge medio
- 1g 23h
- PR unite (30g)
- 7
Descrizione
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
```
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia eseguendo `uv run mypy . | wc` su `main`, quindi esamina gli errori segnalati nell’intero SDK. Usa l’esempio `main.py` per verificare i tipi dell’`entrypoint` pubblico, del payload, della chiamata all’agente e di `run`. Il lavoro è completato quando mypy passa senza errori o note e l’esempio non produce più le diagnostiche pyright di tipo sconosciuto mostrate.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- developer-experience
- Tipo di issue
- Refactoring
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 25/100