Skip to main content

python_project_module_components

Function python_project_module_components 

Source
pub fn python_project_module_components(file: &ProjectFile) -> Vec<String>
Expand description

The module-name components file’s path yields when it is named from the project root, which is the longest name the workspace can give it: dependency/core/lib/common/__init__.py is ["dependency", "core", "lib", "common"].

A Python module name is relative to the sys.path entry an import of it resolves against, so one file has one valid absolute name per ancestor directory on that path, and each of them is a suffix of this one. python_import_root picks the single name that becomes the module’s identity; this is what an import written against any deeper root has to be matched against (#3506).