MCPcopy Index your code
hub / github.com/dagger/dagger / load_module

Function load_module

sdk/python/src/dagger/mod/cli.py:54–72  ·  view source on GitHub ↗

Load the dagger.Module instance via the main object entry point.

()

Source from the content-addressed store, hash-verified

52
53
54def load_module() -> Module:
55 """Load the dagger.Module instance via the main object entry point."""
56 ep = get_entry_point()
57 try:
58 cls = ep.load()
59 except Exception as e:
60 logger.exception(
61 "Error while importing Python module '%s' with Dagger functions",
62 ep.module,
63 )
64 raise ModuleLoadError(str(e)) from e
65 try:
66 return cls.__dagger_module__
67 except AttributeError:
68 msg = (
69 "The main object must be a class decorated with @dagger.object_type, "
70 f"found '{type(cls)}'"
71 )
72 raise ModuleLoadError(msg) from None
73
74
75def get_entry_point() -> importlib.metadata.EntryPoint:

Callers 1

mainFunction · 0.85

Calls 3

ModuleLoadErrorClass · 0.90
get_entry_pointFunction · 0.85
loadMethod · 0.45

Tested by

no test coverage detected