Tato is Python file layout formatter. In contrast to other autoformatters, tato only formats the organization/layout of a file. It tries to organize files into four sections: imports, constants, classes, and functions.
In large, mature codebases, it’s common to encounter files that lack a coherent structure. While the initial version of a file may have been thoughtfully crafted with a logical organization, this structure often erodes over time. (There are many reasons for this erosion, but that’s a topic for another time.)
Tato offers a reset button, providing consistency by deterministically organizing the file. While it may not be the optimal layout, this consistency should reduce the cognitive load required to understand the code.
Constants: Constants are moved to the top of the file. Typically, these have brief definitions and act as key control points for program behavior.
Functions: Functions are placed in the final section and sorted by call hierarchy. This order places the main() function first, ensuring that the most important functions appear at the top.