-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Build Manager
Jukka Lehtosalo edited this page Jun 28, 2022
·
2 revisions
The build manager (mypy/build.py) is responsible for orchestrating a mypy run.
The main entry point is the function build
. It is given a set of files to process and the options/flags.
The build manager does these primary things:
- Resolve imports to find all files that need to be processed (including stub files). Build an import dependency graph.
- Figure out the order in which to process the files. We process import dependencies first before processing a module, so that we can resolve references to names defined in the imported modules.
- Detect cyclic import dependencies, i.e. import cycles or strongly connected components (SCCs). Each SCC is processed as a unit, since each file in an import cycle could contains a reference to any other file within the cycle. (Note that each module is part of some SCC -- the simplest case is a SCC with a single file.)
- Perform the different passes. This includes the Python Parser, Semantic Analyzer and Type Checker passes.
- If running in incremental mode, deserialize each SCC instead of processing them if neither the SCC nor any transitive dependency has changed since the previous run (and config options haven't changed).
- Return the ASTs of processed files, inferred types and any reported errors or notes to the caller.