Skip to main content

Pyrefly Autotype

Manually adding type annotations to your code can be tedius and time-consuming. Pyrefly can help with this task by automatically adding type annotations to your code.

This feature is currently under active development, and the following sections will be updated as the feature matures. We currently recommend manually reviewing the changes created by pyrefly autotype

Usage

To use the autotype feature, run the following command in your project directory:

pyrefly autotype path/to/file.py
# or
pyrefly autotype path/to/directory/

We recommend running it in small batches to make reviewing and merging changes easier.

It is common that new annotations will expose new type errors. See our error suppression guides to learn how to automate silencing these errors.