MCPcopy Create free account
hub / github.com/vercel/vercel / import_module

Function import_module

python/vercel-runtime/src/vercel_runtime/resolver.py:17–25  ·  view source on GitHub ↗
(name: str, path: str)

Source from the content-addressed store, hash-verified

15# Import relative path
16# https://docs.python.org/3/library/importlib.html#importing-a-source-file-directly
17def import_module(name: str, path: str) -> ModuleType:
18 spec = _importlib_util.spec_from_file_location(name, path)
19 if spec is None or spec.loader is None:
20 msg = f'could not load module spec for "{name}" at {path}'
21 raise RuntimeError(msg)
22 mod = _importlib_util.module_from_spec(spec)
23 sys.modules[name] = mod
24 spec.loader.exec_module(mod)
25 return mod
26
27
28def resolve_app(mod: ModuleType, module_name: str, var: str) -> tuple[str, Any]:

Callers 3

vc_init.pyFile · 0.90
_setup_appsFunction · 0.90
set_headersFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected