paya.util.modules#

Utilities for managing modules.

path_to_dotpath(path)#

Given a file system path to a module file, returns the dot-path to be used in import statements. __init__.py files must be present.

Parameters

path (str) – the full path to the module file

Returns

The dotted module name (path).

Return type

str

class LazyModule(moduleName)#

Lazy module loader. Defers module loading until attribute access is attempted. Useful for avoiding circular imports.

Example
r = LazyModule('paya.runtime')

r.ls() # triggers load