Skip to content

[Proposal] Pyright in strict mode #1318

@mfornet

Description

@mfornet

Proposal

I propse changing pyright to strict mode.

[tool.pyright]
typeCheckingMode = "strict"

This can be done through multiple PRs, fixing few files at a time to avoid large rewrites of the codebase.

Right now running uvx pyright in strict mode reports 604 errors.

By the way, running uvx pyright in "basic" model raise 11 errors and 3 warnings today. I guess the first step would be to correct those, and add pyright to CI.

Motivation

Right now writing for agent in env.agent_iter(): ... can't deduce the proper type of agent.

This library should be taken to a high standard, and having everything properly typed significantly improves the experience from this library users.

Pitch

Every user facing API should be properly typed for better user experience. I imagine that typing internal API can also help catching bugs and improve maintainer experience.

I imagine this proposal will be take in the spirit of "rewrite it in rust" 😅

Alternatives

This can be a daunting task, instead we can only add proper types in APIs that are consumer facing (not sure how easy are to detect those).

Additional context

No response

Checklist

  • I have checked that there is no similar issue in the repo

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions