l0_paths::SourceSearchPaths class

Defined in module l0_paths (l0_paths.py).

Search configuration for L0 modules.

Resolution order: system_roots are searched first, then project_roots.

Public static attributes

static List system_roots
static List project_roots

Public functions

auto add_system_root(self, str|Path root) -> None
Add a path to the system search roots.
auto add_project_root(self, str|Path root) -> None
Add a path to the project search roots.
auto module_relpath(self, str module_name) -> Path
Convert a dotted module name to its relative file path.
auto resolve(self, str module_name) -> Path
Find the absolute path for an L0 module name.

Function documentation

None l0_paths::SourceSearchPaths::add_system_root(self, str|Path root)

Add a path to the system search roots.

Parameters
root The directory path to add.

None l0_paths::SourceSearchPaths::add_project_root(self, str|Path root)

Add a path to the project search roots.

Parameters
root The directory path to add.

Path l0_paths::SourceSearchPaths::module_relpath(self, str module_name)

Convert a dotted module name to its relative file path.

Parameters
module_name The dotted L0 module name.
Returns The relative Path to the module file.

Example: 'std.io' -> 'std/io.l0'

Path l0_paths::SourceSearchPaths::resolve(self, str module_name)

Find the absolute path for an L0 module name.

Parameters
module_name The dotted L0 module name.
Returns The absolute Path to the first matching file found.
Exceptions
FileNotFoundError If the module cannot be found in any root.