autotyping
raw JSON → 24.9.0 verified Mon Apr 27 auth: no python
A tool for auto-adding simple type annotations to Python code. Current version 24.9.0, released September 2024. Follows a semi-annual release cadence.
pip install autotyping Common errors
error TypeError: __init__() got an unexpected keyword argument 'iterables' ↓
cause Older version crashed on certain argument names like 'iterables' due to a bug.
fix
Upgrade to autotyping 23.3.0 or later.
error ModuleNotFoundError: No module named 'autotyping' ↓
cause autotyping is not installed or not in the current Python environment.
fix
Run: pip install autotyping
error TypeError: 'NoneType' object is not iterable ↓
cause Missing dependency libcst caused autotyping to fail internally.
fix
Reinstall autotyping: pip install --force-reinstall autotyping
Warnings
breaking Version 24.3.0 dropped support for Python 3.7. Upgrade to Python 3.8+. ↓
fix Update Python to 3.8 or later and upgrade autotyping to 24.3.0+.
gotcha The --safe and --aggressive flags in version 23.2.0 were changed to not take ignored arguments. Previously they accepted --safe=true, now just --safe. ↓
fix Remove arguments after --safe or --aggressive. Use --safe on its own.
gotcha Autotyping may add None return type to methods marked with @abstractmethod in older versions. Fixed in 22.9.0. ↓
fix Update to 22.9.0+ to avoid adding None to abstract methods.
Imports
- Autotyping
from autotyping import Autotyping
Quickstart
# Basic usage on a single file
import subprocess
subprocess.run(["autotyping", "my_file.py"], check=True)
# Or run as a module
# python -m autotyping my_file.py