diff --git a/hamilton/graph.py b/hamilton/graph.py index a8db82934..ac9fc17b1 100644 --- a/hamilton/graph.py +++ b/hamilton/graph.py @@ -361,6 +361,8 @@ def _get_legend(node_types: Set[str]): concentrate="true", ), ) + # we need to update the graph_attr dict instead of overwriting it + # so that means we need to handle nested dicts, e.g. graph_attr. for g_key, g_value in graphviz_kwargs.items(): if isinstance(g_value, dict): digraph_attr[g_key].update(**g_value) diff --git a/hamilton/io/utils.py b/hamilton/io/utils.py index d09852196..69d40e461 100644 --- a/hamilton/io/utils.py +++ b/hamilton/io/utils.py @@ -11,6 +11,10 @@ def get_file_metadata(path: str) -> Dict[str, Any]: """Gives metadata from loading a file. + + Note: we reserve the right to change this schema. So if you're using this come + chat so that we can make sure we don't break your code. + This includes: - the file size - the file path @@ -27,6 +31,10 @@ def get_file_metadata(path: str) -> Dict[str, Any]: def get_dataframe_metadata(df: pd.DataFrame) -> Dict[str, Any]: """Gives metadata from loading a dataframe. + + Note: we reserve the right to change this schema. So if you're using this come + chat so that we can make sure we don't break your code. + This includes: - the number of rows - the number of columns @@ -43,6 +51,10 @@ def get_dataframe_metadata(df: pd.DataFrame) -> Dict[str, Any]: def get_file_and_dataframe_metadata(path: str, df: pd.DataFrame) -> Dict[str, Any]: """Gives metadata from loading a file and a dataframe. + + Note: we reserve the right to change this schema. So if you're using this come + chat so that we can make sure we don't break your code. + This includes: file_meta: - the file size @@ -60,6 +72,10 @@ def get_file_and_dataframe_metadata(path: str, df: pd.DataFrame) -> Dict[str, An def get_sql_metadata(query_or_table: str, results: Union[int, pd.DataFrame]) -> Dict[str, Any]: """Gives metadata from reading a SQL table or writing to SQL db. + + Note: we reserve the right to change this schema. So if you're using this come + chat so that we can make sure we don't break your code. + This includes: - the number of rows read, added, or to add. - the sql query (e.g., "SELECT foo FROM bar") diff --git a/tests/test_graph.py b/tests/test_graph.py index f519ad6b9..f107b3016 100644 --- a/tests/test_graph.py +++ b/tests/test_graph.py @@ -5,9 +5,6 @@ import pandas as pd import pytest - -import hamilton.graph_utils -import hamilton.htypes import tests.resources.bad_functions import tests.resources.compatible_input_types import tests.resources.config_modifier @@ -24,6 +21,9 @@ import tests.resources.parametrized_nodes import tests.resources.test_default_args import tests.resources.typing_vs_not_typing + +import hamilton.graph_utils +import hamilton.htypes from hamilton import ad_hoc_utils, base, graph, node from hamilton.execution import graph_functions from hamilton.node import NodeType @@ -237,7 +237,10 @@ def test_add_dependency_input_nodes_compatible_types(): def test_add_dependency_input_nodes_compatible_types_order_check(): - """Tests that if functions request an input that we correctly accept compatible types independent of order.""" + """Tests that if functions request an input that we correctly accept compatible types independent of order. + + This just reorders test_add_dependency_input_nodes_compatible_types to ensure the outcome does not change. + """ b_sig = inspect.signature(tests.resources.compatible_input_types.b) c_sig = inspect.signature(tests.resources.compatible_input_types.c) d_sig = inspect.signature(tests.resources.compatible_input_types.d) diff --git a/tests/test_hamilton_driver.py b/tests/test_hamilton_driver.py index 23f4dcced..2856520af 100644 --- a/tests/test_hamilton_driver.py +++ b/tests/test_hamilton_driver.py @@ -2,13 +2,13 @@ import pandas as pd 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 import tests.resources.very_simple_dag + from hamilton import base, node from hamilton.driver import ( Builder,