Skip to content

Use automation to add more type information  #17301

@seanbudd

Description

@seanbudd

Detailed description of the issue

NVDA python code is missing a lot of type information.
Some of this could be easily auto-generated and human reviewed.

Potential methods

MonkeyType

https://github.com/Instagram/MonkeyType

MonkeyType is a library which generates type information based on runtime behaviour.
After configuring, we would simply run NVDA with MonkeyType watching. It would generate type information based on what data functions received. We would then review and commit type annotations generated from this data gathering.

Discussion on usage in a similar use case: https://discuss.python.org/t/how-does-monkeytype-affect-performance-and-stability/40087/13

Note, I've used this before and you must take the results with a grain of salt. I think it saves a lot of time though compared to hand writing types from scratch

use AI

Use AI tooling to generate type information. AI might be able to gain more contextual information than analysing at run time. It's more prone to hallucination though, at least at runtime we are guaranteed to get a subset of the correct type information

Why are the other templates not appropriate in this case?

This is a code refactor task not a user facing issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    audience/nvda-devPR or issue is relevant to NVDA / Add-on developersp5https://github.com/nvaccess/nvda/blob/master/projectDocs/issues/triage.md#prioritytriagedHas been triaged, issue is waiting for implementation.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions