--- id: autotyping version: "24.9.0" license: unclear license_treatment: permissive maintenance: aging --- # autotyping — A tool for autoadding simple type annotations. License: permissive · Maintenance: aging · Downloads: 73.7K/mo ## What it is and what it does Autotyping is a command-line tool and libcst codemod that automatically adds type annotations to Python code where they are obvious from context. It uses heuristics to infer types from function bodies (e.g., functions with no return statement get `-> None`), parameter defaults (e.g., `flag=True` becomes `flag: bool`), and magic method signatures. It supports multiple invocation modes: direct CLI, pre-commit hooks, or as a libcst codemod. The tool offers granular flags for different annotation strategies—`--none-return`, `--bool-param`, `--scalar-return`, and others—plus shortcut flags like `--safe` (conservative changes) and `--aggressive` (riskier inference). It can also integrate with pyanalyze's type suggestions. The documentation explicitly warns that heuristics may fail and that you should run a type checker afterward to verify correctness. Use it for: - Add `-> None` annotations to functions that don't return anything, eliminating tedious manual work. - Annotate boolean, string, and numeric parameters based on their literal default values. - Bulk-annotate magic methods like `__init__`, `__str__`, and `__len__` with their standard return types. - Integrate into a pre-commit hook to enforce type annotations on every commit automatically. - Use as a libcst codemod in a larger refactoring pipeline to seed a codebase with starter annotations. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Automatically infers and adds type annotations to Python functions based on context clues like return statements, parameter defaults, and magic methods. Yes, with conditions. Install if you want to reduce boilerplate type annotation work and are willing to verify the results with a type checker. The low install friction and permissive license make it a low-risk experiment. However, the 690-day gap since the last release suggests limited active maintenance; use it as a helper tool rather than a critical part of your workflow, and always validate its output. ## Install pip install autotyping uv add autotyping poetry add autotyping ## Installing autotyping Before you install: Low friction: pure Python wheel with only two runtime dependencies (libcst and typing-extensions). Maintenance shows aging status—690 days since last release—but the repository remains active with recent commits and no archived status. License in practice: MIT license (permissive) means you can use, modify, and distribute this package freely with minimal restrictions. Quickstart: pip install autotyping python -m autotyping /path/to/code --safe # Or as a libcst codemod: python -m libcst.tool codemod autotyping.AutotypeCommand /path/to/code Requires Python 3.8 or later. Heuristic-based inference may produce incorrect annotations; always verify with a type checker afterward. Verify before relying: - Whether the tool's heuristics work reliably on large codebases or edge cases beyond the documented limitations. - How well the --pyanalyze-report integration works in practice with current pyanalyze versions. - Performance characteristics when run on very large code repositories. ## Package facts - License: not declared (permissive) - Python support: supports_current - Install friction: low - Maintenance: aging - Downloads: 73.7K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags automatic type annotation, add type hints to code, infer function types, type annotation tool, python typing automation, codemod type inference, libcst type annotation, type-hints, codemod, pre-commit [View on SkillFed](https://skillfed.io/packages/autotyping) · [View on PyPI](https://pypi.org/project/autotyping/)