Skip to content

mypy not passing #167

@maxrabin

Description

@maxrabin

Right now on branch main there are 1742 errors and notes on mypy.

uv run mypy . | wc
1742

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

Given this sample code:

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions