Uncalled is a Python library and command-line tool (version 0.1.8, released July 11, 2024) designed to identify unused functions within Python projects. It employs either regular expressions for speed (default) or Abstract Syntax Tree (AST) traversal for greater accuracy, also offering a combined mode to reduce false positives. Releases appear to be infrequent and as-needed.
Warnings
gotcha Potential for False Positives due to Python's Dynamic Nature.
Fix: Static analysis tools like Uncalled can report functions as unused even if they are called dynamically (e.g., via `getattr()`, decorators, or framework magic). Users should manually review reports and consider using the `--combined` mode for better accuracy, which leverages both regex and AST analysis.
gotcha Primarily a Command-Line Tool, Not Designed for Library Import.
Fix: Uncalled is intended to be executed from the command line on a specified project path (`$ uncalled path/to/project`). It does not expose a public API for direct programmatic import and use within other Python scripts. Attempts to import it for direct function calls may not yield expected results or are not officially supported.
gotcha Infrequent Release Cadence.
Fix: The project has an infrequent and as-needed release schedule. Users should not expect frequent updates, new features, or rapid bug fixes. While the tool remains functional for its core purpose, those requiring cutting-edge features or quick resolution of minor issues might find its development pace slower than other active projects.
Install
pip install uncalledInstall latest version
Imports
uncalled
uncalled path/to/your/project
Uncalled is primarily a command-line tool and is not typically imported as a Python library for programmatic use. Its functionality is accessed by executing the `uncalled` command in the shell.
Quickstart
Scan the current directory for unused functions. For more options, use `uncalled --help`.