diff --git a/hamilton/driver.py b/hamilton/driver.py index 8e77a182b..0b5046186 100644 --- a/hamilton/driver.py +++ b/hamilton/driver.py @@ -1195,11 +1195,13 @@ def build(self) -> Driver: """Builds the driver -- note that this can return a different class, so you'll likely want to have a sense of what it returns. + Note: this defaults to a dictionary adapter if no adapter is set. + :return: The driver you specified. """ adapter = self.adapter if self.adapter is not None else base.DefaultAdapter() if not self.v2_executor: - return Driver(self.config, *self.modules, adapter=self.adapter) + return Driver(self.config, *self.modules, adapter=adapter) execution_manager = self.execution_manager if execution_manager is None: local_executor = self.local_executor or executors.SynchronousLocalTaskExecutor() diff --git a/tests/test_hamilton_driver.py b/tests/test_hamilton_driver.py index 22e040d60..7344859a8 100644 --- a/tests/test_hamilton_driver.py +++ b/tests/test_hamilton_driver.py @@ -4,6 +4,7 @@ import pytest import tests.resources.cyclic_functions +import tests.resources.dummy_functions import tests.resources.dynamic_parallelism.parallel_linear_basic import tests.resources.tagging import tests.resources.test_default_args @@ -445,3 +446,10 @@ def test_executor_validates_happy_parallel_executor(): nodes, user_nodes = dr.graph.get_upstream_nodes(["final"]) dr.graph_executor.validate(nodes | user_nodes) + + +def test_builder_defaults_to_dict_result(): + dr = Builder().with_modules(tests.resources.dummy_functions).build() + + result = dr.execute(["C"], inputs={"b": 1, "c": 1}) + assert result == {"C": 4}