From fac77376c6ea6ec15749e3d0ea8c1817c40515e0 Mon Sep 17 00:00:00 2001 From: Andrew Truong Date: Fri, 23 Aug 2024 17:55:30 -0400 Subject: [PATCH] move to legacy: weave_internal --- Eval Board.ipynb | 308 +++++++++--------- .../skip_test/Confusion Matrix.ipynb | 2 +- .../skip_test/Diffusion explore 2.ipynb | 2 +- .../skip_test/Diffusion explore.ipynb | 2 +- .../skip_test/Diffusion story.ipynb | 2 +- .../experimental/skip_test/art_explore.ipynb | 2 +- .../experimental/skip_test/weave_scifi.ipynb | 2 +- examples/experimental/tag_search.ipynb | 2 +- .../reference/panels/plot/synced_axes.ipynb | 2 +- examples/reference/vis/Distribution.ipynb | 2 +- weave/legacy/api.py | 2 +- weave/legacy/arrow/convert.py | 2 +- weave/legacy/arrow/list_.py | 4 +- weave/legacy/codify.py | 4 +- weave/legacy/compile.py | 4 +- weave/legacy/derive_op.py | 6 +- weave/legacy/eager.py | 2 +- .../ecosystem/wandb/panel_distribution.py | 2 +- weave/legacy/ecosystem/wandb/panel_geo.py | 2 +- weave/legacy/ecosystem/wandb/panel_scatter.py | 2 +- .../ecosystem/wandb/panel_time_series.py | 2 +- .../wandb/test_panel_distribution.py | 2 +- weave/legacy/ecosystem/wandb/weave_plotly.py | 2 +- weave/legacy/execute_fast.py | 4 +- weave/legacy/make_type.py | 2 +- weave/legacy/mappers_publisher.py | 2 +- weave/legacy/op_def.py | 4 +- weave/legacy/ops_arrow/vectorize.py | 5 +- .../legacy/ops_domain/artifact_version_ops.py | 2 +- weave/legacy/ops_domain/table.py | 2 +- weave/legacy/ops_primitives/number_bin.py | 2 +- weave/legacy/ops_primitives/test_dict.py | 2 +- weave/legacy/ops_primitives/test_list.py | 2 +- weave/legacy/ops_primitives/test_typeddict.py | 2 +- weave/legacy/ops_primitives/timestamp_bin.py | 4 +- weave/legacy/ops_primitives/weave_api.py | 3 +- weave/legacy/panel.py | 2 +- weave/legacy/panels/panel_board.py | 2 +- weave/legacy/panels/panel_facet.py | 2 +- weave/legacy/panels/panel_group.py | 2 +- weave/legacy/panels/panel_object_picker.py | 2 +- weave/legacy/panels/panel_plot.py | 2 +- weave/legacy/panels/panel_query.py | 2 +- weave/legacy/panels/panel_select.py | 2 +- weave/legacy/panels/panel_slider.py | 2 +- weave/legacy/panels/panel_table.py | 2 +- weave/legacy/panels/panel_weavelink.py | 2 +- weave/legacy/panels/table_state.py | 2 +- weave/legacy/panels_py/panel_autoboard.py | 2 +- .../panels_py/panel_example_custom_board.py | 2 +- weave/legacy/panels_py/panel_llm_monitor.py | 4 +- weave/legacy/panels_py/panel_observability.py | 2 +- weave/legacy/panels_py/panel_seedboard.py | 2 +- weave/legacy/panels_py/panel_trace_monitor.py | 4 +- weave/legacy/serialize.py | 2 +- weave/legacy/trace_local.py | 2 +- weave/{ => legacy}/weave_internal.py | 2 +- weave/legacy/weavify.py | 2 +- weave/tests/legacy/test_access.py | 11 +- weave/tests/legacy/test_arrow.py | 12 +- weave/tests/legacy/test_arrow_vectorizer.py | 3 +- weave/tests/legacy/test_artifact.py | 4 +- weave/tests/legacy/test_basic_ops.py | 2 +- weave/tests/legacy/test_compile.py | 2 +- weave/tests/legacy/test_complex_calls.py | 3 +- weave/tests/legacy/test_const_type_mapper.py | 4 +- weave/tests/legacy/test_decorators.py | 2 +- weave/tests/legacy/test_execute.py | 4 +- weave/tests/legacy/test_execute_fast.py | 3 +- weave/tests/legacy/test_graph.py | 4 +- weave/tests/legacy/test_list_arrow_compat.py | 3 +- weave/tests/legacy/test_logging.py | 5 +- weave/tests/legacy/test_mappability.py | 8 +- weave/tests/legacy/test_mappers_python.py | 3 +- weave/tests/legacy/test_media.py | 3 +- weave/tests/legacy/test_mutation2.py | 4 +- weave/tests/legacy/test_mutations.py | 3 +- weave/tests/legacy/test_nullability.py | 2 +- weave/tests/legacy/test_op.py | 4 +- weave/tests/legacy/test_op_behaviors.py | 3 +- weave/tests/legacy/test_op_dispatching.py | 4 +- weave/tests/legacy/test_panels.py | 2 +- weave/tests/legacy/test_plot.py | 3 +- weave/tests/legacy/test_refs.py | 4 +- weave/tests/legacy/test_run_segment.py | 4 +- weave/tests/legacy/test_serialize.py | 5 +- weave/tests/legacy/test_stitch.py | 3 +- weave/tests/legacy/test_storage.py | 11 +- weave/tests/legacy/test_table_ops.py | 11 +- weave/tests/legacy/test_tagging.py | 4 +- weave/tests/legacy/test_trace.py | 6 +- weave/tests/legacy/test_wb_domain_types.py | 2 +- weave/tests/legacy/test_wb_tables.py | 2 +- weave/tests/legacy/test_weavejs_fixes.py | 10 +- weave/tests/legacy/test_weavify.py | 3 +- weave/tests/trace/test_server.py | 2 +- weave/tests/weavejs_ops.py | 4 +- 97 files changed, 305 insertions(+), 313 deletions(-) rename weave/{ => legacy}/weave_internal.py (99%) diff --git a/Eval Board.ipynb b/Eval Board.ipynb index 6c64694dc688..be2baf592eb6 100644 --- a/Eval Board.ipynb +++ b/Eval Board.ipynb @@ -1,161 +1,161 @@ { - "cells": [ - { - "cell_type": "code", - "execution_count": 61, - "id": "314bb6b4", - "metadata": {}, - "outputs": [], - "source": [ - "import typing\n", - "\n", - "import weave\n", - "from weave import weave_internal\n", - "\n", - "weave.use_frontend_devmode()\n", - "from weave.legacy import ops_domain\n", - "from weave.legacy.panels import panel_board" - ] - }, - { - "cell_type": "code", - "execution_count": 62, - "id": "550daef6", - "metadata": {}, - "outputs": [], - "source": [ - "@weave.type()\n", - "class Dataset:\n", - " rows: list[typing.Any]" - ] - }, - { - "cell_type": "code", - "execution_count": 64, - "id": "e8065ad6", - "metadata": {}, - "outputs": [ + "cells": [ + { + "cell_type": "code", + "execution_count": 61, + "id": "314bb6b4", + "metadata": {}, + "outputs": [], + "source": [ + "import typing\n", + "\n", + "import weave\n", + "from weave.legacy import weave_internal\n", + "\n", + "weave.use_frontend_devmode()\n", + "from weave.legacy import ops_domain\n", + "from weave.legacy.panels import panel_board" + ] + }, { - "data": { - "text/html": [ - "\n", - " \n", - " " + "cell_type": "code", + "execution_count": 62, + "id": "550daef6", + "metadata": {}, + "outputs": [], + "source": [ + "@weave.type()\n", + "class Dataset:\n", + " rows: list[typing.Any]" + ] + }, + { + "cell_type": "code", + "execution_count": 64, + "id": "e8065ad6", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + " \n", + " " + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } ], - "text/plain": [ - "" + "source": [ + "varbar = panel_board.varbar()\n", + "\n", + "entity_name_val = varbar.add(\"entity_name_val\", \"shawn\", hidden=True)\n", + "entity = ops_domain.entity(entity_name_val)\n", + "entity_name = varbar.add(\n", + " \"entity_name\",\n", + " weave.legacy.panels.Dropdown(\n", + " entity_name_val, choices=ops_domain.viewer().entities().name()\n", + " ),\n", + ")\n", + "\n", + "project_name_val = varbar.add(\"project_name_val\", \"weave-flow1\", hidden=True)\n", + "project = ops_domain.project(entity_name_val, project_name_val)\n", + "project_name = varbar.add(\n", + " \"project_name\",\n", + " weave.legacy.panels.Dropdown(project_name_val, choices=entity.projects().name()),\n", + ")\n", + "\n", + "dataset_name_val = varbar.add(\"dataset_name_val\", \"my_dataset1\", hidden=True)\n", + "dataset = varbar.add(\n", + " \"dataset\",\n", + " weave.legacy.ops.get(\n", + " weave_internal.const(\"wandb-artifact:///\")\n", + " + entity_name_val\n", + " + \"/\"\n", + " + project_name_val\n", + " + \"/\"\n", + " + dataset_name_val\n", + " + \":latest/obj\"\n", + " ),\n", + " hidden=True,\n", + ")\n", + "dataset_ref = varbar.add(\n", + " \"dataset_ref\",\n", + " weave.legacy.ops.ref(\n", + " weave_internal.const(\"wandb-artifact:///\")\n", + " + entity_name_val\n", + " + \"/\"\n", + " + project_name_val\n", + " + \"/\"\n", + " + dataset_name_val\n", + " + \":latest/obj\"\n", + " ),\n", + ")\n", + "dataset_name = varbar.add(\n", + " \"dataset_name\",\n", + " weave.legacy.panels.Dropdown(\n", + " dataset_name_val, choices=project.artifactType(\"Dataset\").artifacts().name()\n", + " ),\n", + ")\n", + "\n", + "# Now here I want to pick model A and model B\n", + "# I need to a way to get to artifact from an object, like get_ref.artifact ?\n", + "# like dataset_ref.artifact().usedBy().filter(lambda row: row.jobName() == 'eval')\n", + "# then from there find consuming runs of a given job_type (\"eval\")\n", + "# let the user pick two of those\n", + "\n", + "# want a really nice data grid of the table metric comparsion per row\n", + "\n", + "main = weave.legacy.panels.Group(\n", + " layoutMode=\"grid\",\n", + " showExpressions=True,\n", + " enableAddPanel=True,\n", + ")\n", + "\n", + "main.add(\"ename\", entity_name_val)\n", + "main.add(\"pname\", project_name_val)\n", + "main.add(\"dsrows\", weave.legacy.ops.obj_getattr(dataset, \"rows\"))\n", + "# main.add(\"artifact\", dataset_ref.artifact())\n", + "\n", + "# I Need a programmable Table. One that's columns are defined by Nodes\n", + "# Same for panels, I want to be able to generate a bunch of panels\n", + "# Can I do this with Weaveify?\n", + "# Like I can pass a function in in the Board that returns the panel I want maybe?\n", + "\n", + "weave.legacy.panels.Board(vars=varbar, panels=main)" ] - }, - "metadata": {}, - "output_type": "display_data" } - ], - "source": [ - "varbar = panel_board.varbar()\n", - "\n", - "entity_name_val = varbar.add(\"entity_name_val\", \"shawn\", hidden=True)\n", - "entity = ops_domain.entity(entity_name_val)\n", - "entity_name = varbar.add(\n", - " \"entity_name\",\n", - " weave.legacy.panels.Dropdown(\n", - " entity_name_val, choices=ops_domain.viewer().entities().name()\n", - " ),\n", - ")\n", - "\n", - "project_name_val = varbar.add(\"project_name_val\", \"weave-flow1\", hidden=True)\n", - "project = ops_domain.project(entity_name_val, project_name_val)\n", - "project_name = varbar.add(\n", - " \"project_name\",\n", - " weave.legacy.panels.Dropdown(project_name_val, choices=entity.projects().name()),\n", - ")\n", - "\n", - "dataset_name_val = varbar.add(\"dataset_name_val\", \"my_dataset1\", hidden=True)\n", - "dataset = varbar.add(\n", - " \"dataset\",\n", - " weave.legacy.ops.get(\n", - " weave_internal.const(\"wandb-artifact:///\")\n", - " + entity_name_val\n", - " + \"/\"\n", - " + project_name_val\n", - " + \"/\"\n", - " + dataset_name_val\n", - " + \":latest/obj\"\n", - " ),\n", - " hidden=True,\n", - ")\n", - "dataset_ref = varbar.add(\n", - " \"dataset_ref\",\n", - " weave.legacy.ops.ref(\n", - " weave_internal.const(\"wandb-artifact:///\")\n", - " + entity_name_val\n", - " + \"/\"\n", - " + project_name_val\n", - " + \"/\"\n", - " + dataset_name_val\n", - " + \":latest/obj\"\n", - " ),\n", - ")\n", - "dataset_name = varbar.add(\n", - " \"dataset_name\",\n", - " weave.legacy.panels.Dropdown(\n", - " dataset_name_val, choices=project.artifactType(\"Dataset\").artifacts().name()\n", - " ),\n", - ")\n", - "\n", - "# Now here I want to pick model A and model B\n", - "# I need to a way to get to artifact from an object, like get_ref.artifact ?\n", - "# like dataset_ref.artifact().usedBy().filter(lambda row: row.jobName() == 'eval')\n", - "# then from there find consuming runs of a given job_type (\"eval\")\n", - "# let the user pick two of those\n", - "\n", - "# want a really nice data grid of the table metric comparsion per row\n", - "\n", - "main = weave.legacy.panels.Group(\n", - " layoutMode=\"grid\",\n", - " showExpressions=True,\n", - " enableAddPanel=True,\n", - ")\n", - "\n", - "main.add(\"ename\", entity_name_val)\n", - "main.add(\"pname\", project_name_val)\n", - "main.add(\"dsrows\", weave.legacy.ops.obj_getattr(dataset, \"rows\"))\n", - "# main.add(\"artifact\", dataset_ref.artifact())\n", - "\n", - "# I Need a programmable Table. One that's columns are defined by Nodes\n", - "# Same for panels, I want to be able to generate a bunch of panels\n", - "# Can I do this with Weaveify?\n", - "# Like I can pass a function in in the Board that returns the panel I want maybe?\n", - "\n", - "weave.legacy.panels.Board(vars=varbar, panels=main)" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.9.7" + } }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.9.7" - } - }, - "nbformat": 4, - "nbformat_minor": 5 + "nbformat": 4, + "nbformat_minor": 5 } diff --git a/examples/experimental/skip_test/Confusion Matrix.ipynb b/examples/experimental/skip_test/Confusion Matrix.ipynb index b357921adfab..02e964017ebd 100644 --- a/examples/experimental/skip_test/Confusion Matrix.ipynb +++ b/examples/experimental/skip_test/Confusion Matrix.ipynb @@ -13,7 +13,7 @@ "from PIL import Image\n", "import weave\n", "from weave.legacy import storage\n", - "from weave import weave_internal\n", + "from weave.legacy import weave_internal\n", "#weave.use_frontend_devmode()" ] }, diff --git a/examples/experimental/skip_test/Diffusion explore 2.ipynb b/examples/experimental/skip_test/Diffusion explore 2.ipynb index 1e3dfee050e0..3337cda943e1 100644 --- a/examples/experimental/skip_test/Diffusion explore 2.ipynb +++ b/examples/experimental/skip_test/Diffusion explore 2.ipynb @@ -8,7 +8,7 @@ "outputs": [], "source": [ "import weave\n", - "from weave import weave_internal\n", + "from weave.legacy import weave_internal\n", "from weave.legacy.ecosystem.all import langchain\n", "weave.use_frontend_devmode()" ] diff --git a/examples/experimental/skip_test/Diffusion explore.ipynb b/examples/experimental/skip_test/Diffusion explore.ipynb index 0d3365f2f253..a253ccdaae50 100644 --- a/examples/experimental/skip_test/Diffusion explore.ipynb +++ b/examples/experimental/skip_test/Diffusion explore.ipynb @@ -25,7 +25,7 @@ "outputs": [], "source": [ "import weave\n", - "from weave import weave_internal\n", + "from weave.legacy import weave_internal\n", "from weave.legacy.ecosystem.all import langchain" ] }, diff --git a/examples/experimental/skip_test/Diffusion story.ipynb b/examples/experimental/skip_test/Diffusion story.ipynb index 8a9f8b6771df..93844909d881 100644 --- a/examples/experimental/skip_test/Diffusion story.ipynb +++ b/examples/experimental/skip_test/Diffusion story.ipynb @@ -8,7 +8,7 @@ "outputs": [], "source": [ "import weave\n", - "from weave import weave_internal\n", + "from weave.legacy import weave_internal\n", "from weave.legacy.ecosystem.all import langchain\n", "weave.use_frontend_devmode()" ] diff --git a/examples/experimental/skip_test/art_explore.ipynb b/examples/experimental/skip_test/art_explore.ipynb index 2b3ae1221c61..b591b5a163ef 100644 --- a/examples/experimental/skip_test/art_explore.ipynb +++ b/examples/experimental/skip_test/art_explore.ipynb @@ -32,7 +32,7 @@ "outputs": [], "source": [ "import weave\n", - "from weave import weave_internal\n", + "from weave.legacy import weave_internal\n", "from weave.legacy.ecosystem.all import langchain" ] }, diff --git a/examples/experimental/skip_test/weave_scifi.ipynb b/examples/experimental/skip_test/weave_scifi.ipynb index d6144ba3fff1..e08c7cc5ed29 100644 --- a/examples/experimental/skip_test/weave_scifi.ipynb +++ b/examples/experimental/skip_test/weave_scifi.ipynb @@ -8,7 +8,7 @@ "outputs": [], "source": [ "import weave\n", - "from weave import weave_internal\n", + "from weave.legacy import weave_internal\n", "from weave.legacy.ecosystem.all import langchain\n", "weave.use_frontend_devmode()" ] diff --git a/examples/experimental/tag_search.ipynb b/examples/experimental/tag_search.ipynb index edd83696e7ed..d28245ee8adb 100644 --- a/examples/experimental/tag_search.ipynb +++ b/examples/experimental/tag_search.ipynb @@ -30,7 +30,7 @@ "outputs": [], "source": [ "import weave\n", - "from weave import weave_internal" + "from weave.legacy import weave_internal" ] }, { diff --git a/examples/reference/panels/plot/synced_axes.ipynb b/examples/reference/panels/plot/synced_axes.ipynb index 9d227a2470b3..b3d9d43b4105 100644 --- a/examples/reference/panels/plot/synced_axes.ipynb +++ b/examples/reference/panels/plot/synced_axes.ipynb @@ -89,7 +89,7 @@ "outputs": [], "source": [ "from weave.legacy.panels.panel_plot import Signals, AxisSelections, Plot\n", - "from weave import weave_internal\n", + "from weave.legacy import weave_internal\n", "\n", "\n", "domain_node = weave_internal.const(None)\n", diff --git a/examples/reference/vis/Distribution.ipynb b/examples/reference/vis/Distribution.ipynb index 726c4a8f99ec..3248599762f2 100644 --- a/examples/reference/vis/Distribution.ipynb +++ b/examples/reference/vis/Distribution.ipynb @@ -41,7 +41,7 @@ "metadata": {}, "outputs": [], "source": [ - "from weave import weave_internal\n", + "from weave.legacy import weave_internal\n", "# Numeric distribution\n", "dist = wandb.Distribution(\n", " items,\n", diff --git a/weave/legacy/api.py b/weave/legacy/api.py index c310b40db086..853d7cd37ceb 100644 --- a/weave/legacy/api.py +++ b/weave/legacy/api.py @@ -12,7 +12,7 @@ from . import ref_base as _ref_base from weave.legacy import wandb_api as _wandb_api -from .. import weave_internal as _weave_internal +from weave.legacy import weave_internal as _weave_internal from weave.legacy import util as _util diff --git a/weave/legacy/arrow/convert.py b/weave/legacy/arrow/convert.py index d76edeaef7b7..95c22eb4f3da 100644 --- a/weave/legacy/arrow/convert.py +++ b/weave/legacy/arrow/convert.py @@ -4,7 +4,7 @@ import pyarrow.compute as pc from weave.legacy import api as api -from weave import weave_internal +from weave.legacy import weave_internal from weave.legacy import weave_types as types from weave.legacy import errors, arrow_util, artifact_base, artifact_mem, box, mappers_arrow from weave.legacy.arrow.arrow import ( diff --git a/weave/legacy/arrow/list_.py b/weave/legacy/arrow/list_.py index e90c860fead6..f0855545fb5a 100644 --- a/weave/legacy/arrow/list_.py +++ b/weave/legacy/arrow/list_.py @@ -10,11 +10,9 @@ import pyarrow.compute as pc import typing_extensions -from weave import ( - weave_internal, -) from weave.legacy import weave_types as types from weave.legacy import ( + weave_internal, errors, _dict_utils, artifact_base, diff --git a/weave/legacy/codify.py b/weave/legacy/codify.py index e1017261d778..ca1036dd8266 100644 --- a/weave/legacy/codify.py +++ b/weave/legacy/codify.py @@ -201,7 +201,7 @@ def _node_to_code(node: graph.Node, wrap_const_node: bool = True) -> str: if current_frame is not None and node.name in current_frame: return node.name - return f"weave.weave_internal.make_var_node({_type_to_code(node.type)}, '{node.name}')" + return f"weave.legacy.weave_internal.make_var_node({_type_to_code(node.type)}, '{node.name}')" elif isinstance(node, graph.ConstNode): if isinstance(node.type, weave_types.Function): vars = list(node.type.input_types.keys()) @@ -209,7 +209,7 @@ def _node_to_code(node: graph.Node, wrap_const_node: bool = True) -> str: else: val_as_code = object_to_code_no_format(node.val) if wrap_const_node: - return f"weave.weave_internal.const({val_as_code})" + return f"weave.legacy.weave_internal.const({val_as_code})" else: return val_as_code elif isinstance(node, graph.OutputNode): diff --git a/weave/legacy/compile.py b/weave/legacy/compile.py index 1e307054bd0e..e55d66daf9b9 100644 --- a/weave/legacy/compile.py +++ b/weave/legacy/compile.py @@ -5,11 +5,9 @@ import re import typing -from weave import ( - weave_internal, -) from weave.legacy import weave_types as types from weave.legacy import ( + weave_internal, errors, engine_trace, box, diff --git a/weave/legacy/derive_op.py b/weave/legacy/derive_op.py index dcf1010b024c..797d16af9fae 100644 --- a/weave/legacy/derive_op.py +++ b/weave/legacy/derive_op.py @@ -6,12 +6,10 @@ import inspect import typing -from weave import ( - storage, - weave_internal, -) from weave.legacy import weave_types as types from weave.legacy import ( + storage, + weave_internal, errors, parallelism, registry_mem, diff --git a/weave/legacy/eager.py b/weave/legacy/eager.py index 88ea1c453b67..7b1b1935ffc0 100644 --- a/weave/legacy/eager.py +++ b/weave/legacy/eager.py @@ -2,7 +2,7 @@ from weave.legacy import context_state, graph -from .. import weave_internal +from weave.legacy import weave_internal from weave.legacy import weave_types as types WeaveIterObjectType = typing.TypeVar("WeaveIterObjectType") diff --git a/weave/legacy/ecosystem/wandb/panel_distribution.py b/weave/legacy/ecosystem/wandb/panel_distribution.py index 3ed85e247e3a..b7d53699e4a6 100644 --- a/weave/legacy/ecosystem/wandb/panel_distribution.py +++ b/weave/legacy/ecosystem/wandb/panel_distribution.py @@ -2,7 +2,7 @@ import typing import weave -from weave import weave_internal +from weave.legacy import weave_internal from weave.legacy import panel_util from weave.legacy.ecosystem.wandb import weave_plotly diff --git a/weave/legacy/ecosystem/wandb/panel_geo.py b/weave/legacy/ecosystem/wandb/panel_geo.py index be1baff8a1fb..f0be19903576 100644 --- a/weave/legacy/ecosystem/wandb/panel_geo.py +++ b/weave/legacy/ecosystem/wandb/panel_geo.py @@ -3,7 +3,7 @@ import typing import weave -from weave import weave_internal +from weave.legacy import weave_internal from weave.legacy.ecosystem.wandb import weave_plotly diff --git a/weave/legacy/ecosystem/wandb/panel_scatter.py b/weave/legacy/ecosystem/wandb/panel_scatter.py index 4b86e22edb1c..9794d8473132 100644 --- a/weave/legacy/ecosystem/wandb/panel_scatter.py +++ b/weave/legacy/ecosystem/wandb/panel_scatter.py @@ -3,7 +3,7 @@ import typing import weave -from weave import weave_internal +from weave.legacy import weave_internal from weave.legacy.ecosystem.wandb import weave_plotly diff --git a/weave/legacy/ecosystem/wandb/panel_time_series.py b/weave/legacy/ecosystem/wandb/panel_time_series.py index a95069bc2792..5d793f3152da 100644 --- a/weave/legacy/ecosystem/wandb/panel_time_series.py +++ b/weave/legacy/ecosystem/wandb/panel_time_series.py @@ -2,7 +2,7 @@ import typing import weave -from weave import weave_internal +from weave.legacy import weave_internal from weave.legacy.ecosystem.wandb import weave_plotly from weave.legacy.language_features.tagging import tagged_value_type from weave.legacy.panel_util import make_node diff --git a/weave/legacy/ecosystem/wandb/test_panel_distribution.py b/weave/legacy/ecosystem/wandb/test_panel_distribution.py index 71090b2d59c2..a75a862649c9 100644 --- a/weave/legacy/ecosystem/wandb/test_panel_distribution.py +++ b/weave/legacy/ecosystem/wandb/test_panel_distribution.py @@ -1,7 +1,7 @@ import random import weave -from weave import weave_internal +from weave.legacy import weave_internal from weave.legacy.ecosystem.wandb import panel_distribution diff --git a/weave/legacy/ecosystem/wandb/weave_plotly.py b/weave/legacy/ecosystem/wandb/weave_plotly.py index ab098cf48938..0450a9dbd64b 100644 --- a/weave/legacy/ecosystem/wandb/weave_plotly.py +++ b/weave/legacy/ecosystem/wandb/weave_plotly.py @@ -9,7 +9,7 @@ from plotly import graph_objs as go import weave -from weave import weave_internal +from weave.legacy import weave_internal from weave.legacy import infer_types diff --git a/weave/legacy/execute_fast.py b/weave/legacy/execute_fast.py index b7331ded9985..f3069ffa8869 100644 --- a/weave/legacy/execute_fast.py +++ b/weave/legacy/execute_fast.py @@ -1,10 +1,8 @@ import logging -from weave import ( - weave_internal, -) from weave.legacy import weave_types as types from weave.legacy import ( + weave_internal, errors, engine_trace, ref_base, diff --git a/weave/legacy/make_type.py b/weave/legacy/make_type.py index 765bc06636dc..3a39f8aa14df 100644 --- a/weave/legacy/make_type.py +++ b/weave/legacy/make_type.py @@ -1,4 +1,4 @@ -from .. import weave_internal +from weave.legacy import weave_internal from weave.legacy import weave_types as types diff --git a/weave/legacy/mappers_publisher.py b/weave/legacy/mappers_publisher.py index 667d47a54143..7332f22c16a4 100644 --- a/weave/legacy/mappers_publisher.py +++ b/weave/legacy/mappers_publisher.py @@ -3,7 +3,7 @@ import typing from weave.legacy import storage -from weave import weave_internal +from weave.legacy import weave_internal from weave.legacy import weave_types as types from weave.legacy.node_ref import ref_to_node diff --git a/weave/legacy/op_def.py b/weave/legacy/op_def.py index 7581773e09fe..8fdfd8815138 100644 --- a/weave/legacy/op_def.py +++ b/weave/legacy/op_def.py @@ -6,11 +6,9 @@ import typing from typing import Iterator, Sequence -from weave import ( - weave_internal, -) from weave.legacy import weave_types as types from weave.legacy import ( + weave_internal, errors, context_state, engine_trace, diff --git a/weave/legacy/ops_arrow/vectorize.py b/weave/legacy/ops_arrow/vectorize.py index 107666929e14..002d8c1d86d4 100644 --- a/weave/legacy/ops_arrow/vectorize.py +++ b/weave/legacy/ops_arrow/vectorize.py @@ -6,10 +6,7 @@ import numpy as np import pyarrow as pa -from weave import ( - - weave_internal, -) +from weave.legacy import weave_internal from weave.legacy import errors,weavify, registry_mem from weave.legacy import weave_types as types from weave.legacy.api import op, use diff --git a/weave/legacy/ops_domain/artifact_version_ops.py b/weave/legacy/ops_domain/artifact_version_ops.py index aa816e3f716a..8203e2891897 100644 --- a/weave/legacy/ops_domain/artifact_version_ops.py +++ b/weave/legacy/ops_domain/artifact_version_ops.py @@ -460,7 +460,7 @@ def artifact_version_weave_type( def _get_history_metrics( artifactVersion: wdt.ArtifactVersion, ) -> dict[str, typing.Any]: - from weave import weave_internal + from weave.legacy import weave_internal from weave.legacy.compile import enable_compile from weave.legacy.graph import ConstNode, OutputNode from weave.legacy.ops_domain import wb_domain_types diff --git a/weave/legacy/ops_domain/table.py b/weave/legacy/ops_domain/table.py index 7f4fbf91daed..bef6805ad1d6 100644 --- a/weave/legacy/ops_domain/table.py +++ b/weave/legacy/ops_domain/table.py @@ -5,7 +5,7 @@ import logging import typing -from weave import weave_internal +from weave.legacy import weave_internal from weave.legacy import weave_types as types from weave.legacy.api import op, weave_class from weave.legacy import ( diff --git a/weave/legacy/ops_primitives/number_bin.py b/weave/legacy/ops_primitives/number_bin.py index c06de46703d7..97b799fcd3d3 100644 --- a/weave/legacy/ops_primitives/number_bin.py +++ b/weave/legacy/ops_primitives/number_bin.py @@ -5,7 +5,7 @@ from weave.legacy import graph from weave.legacy.ops_primitives import date from weave.legacy.ops_primitives.dict import dict_ -from weave.weave_internal import call_fn, define_fn, make_const_node +from weave.legacy.weave_internal import call_fn, define_fn, make_const_node from weave.legacy.weave_types import Function, NumberBinType diff --git a/weave/legacy/ops_primitives/test_dict.py b/weave/legacy/ops_primitives/test_dict.py index 33508af74e2d..165a714a3eec 100644 --- a/weave/legacy/ops_primitives/test_dict.py +++ b/weave/legacy/ops_primitives/test_dict.py @@ -1,5 +1,5 @@ import weave -from weave import weave_internal +from weave.legacy import weave_internal from weave.legacy.language_features.tagging import tagged_value_type diff --git a/weave/legacy/ops_primitives/test_list.py b/weave/legacy/ops_primitives/test_list.py index 2856054b5ab6..6507ead3b4a9 100644 --- a/weave/legacy/ops_primitives/test_list.py +++ b/weave/legacy/ops_primitives/test_list.py @@ -1,7 +1,7 @@ import pytest from weave.legacy import api as weave -from weave import weave_internal +from weave.legacy import weave_internal from weave.legacy import weave_types as types from weave.legacy import box from weave.legacy.language_features.tagging import ( diff --git a/weave/legacy/ops_primitives/test_typeddict.py b/weave/legacy/ops_primitives/test_typeddict.py index 94644dae54e0..6f85584df4d5 100644 --- a/weave/legacy/ops_primitives/test_typeddict.py +++ b/weave/legacy/ops_primitives/test_typeddict.py @@ -1,7 +1,7 @@ import pytest import weave -from weave import weave_internal +from weave.legacy import weave_internal from weave.legacy import box from weave.legacy.arrow.arrow import ArrowWeaveListType from weave.legacy.language_features.tagging import tag_store, tagged_value_type diff --git a/weave/legacy/ops_primitives/timestamp_bin.py b/weave/legacy/ops_primitives/timestamp_bin.py index ef153be48da4..ce5b3e1097b3 100644 --- a/weave/legacy/ops_primitives/timestamp_bin.py +++ b/weave/legacy/ops_primitives/timestamp_bin.py @@ -1,9 +1,9 @@ -from weave import weave_internal +from weave.legacy import weave_internal from weave.legacy import weave_types as types from weave.legacy.api import op, use from weave.legacy import graph from weave.legacy.ops_primitives.dict import dict_ -from weave.weave_internal import call_fn, define_fn, make_const_node +from weave.legacy.weave_internal import call_fn, define_fn, make_const_node from weave.legacy.weave_types import Function, TimestampBinType NICE_BIN_SIZES_SEC = [ diff --git a/weave/legacy/ops_primitives/weave_api.py b/weave/legacy/ops_primitives/weave_api.py index 187439a7cfac..86761b21d956 100644 --- a/weave/legacy/ops_primitives/weave_api.py +++ b/weave/legacy/ops_primitives/weave_api.py @@ -4,12 +4,13 @@ from weave import ( storage, - trace_legacy, weave_internal, ) from weave.legacy import weave_types as types from weave.legacy.api import mutation, op, weave_class from weave.legacy import ( + storage, + weave_internal, errors, ref_base, registry_mem, diff --git a/weave/legacy/panel.py b/weave/legacy/panel.py index 7ec6daab4e0b..87af22bca475 100644 --- a/weave/legacy/panel.py +++ b/weave/legacy/panel.py @@ -4,7 +4,7 @@ from tarfile import DEFAULT_FORMAT from weave.legacy import api as weave -from weave import weave_internal +from weave.legacy import weave_internal from weave.legacy import weave_types as types from weave.legacy import graph, panel_util, errors, storage diff --git a/weave/legacy/panels/panel_board.py b/weave/legacy/panels/panel_board.py index 6f3ac7e94dd8..0db30de2a275 100644 --- a/weave/legacy/panels/panel_board.py +++ b/weave/legacy/panels/panel_board.py @@ -2,7 +2,7 @@ import typing import weave -from weave import weave_internal +from weave.legacy import weave_internal from weave.legacy import panel from weave.legacy.panels import panel_group diff --git a/weave/legacy/panels/panel_facet.py b/weave/legacy/panels/panel_facet.py index 54e079f333f7..24c4b42d663c 100644 --- a/weave/legacy/panels/panel_facet.py +++ b/weave/legacy/panels/panel_facet.py @@ -2,7 +2,7 @@ import typing import weave -from weave import weave_internal +from weave.legacy import weave_internal from weave.legacy import weave_types as types from weave.legacy import graph, panel, panel_util from weave.legacy.arrow import list_ diff --git a/weave/legacy/panels/panel_group.py b/weave/legacy/panels/panel_group.py index a7ea1847900c..3c4046c74101 100644 --- a/weave/legacy/panels/panel_group.py +++ b/weave/legacy/panels/panel_group.py @@ -3,7 +3,7 @@ import typing import weave -from weave import weave_internal +from weave.legacy import weave_internal from weave.legacy import ( errors, codifiable_value_mixin, diff --git a/weave/legacy/panels/panel_object_picker.py b/weave/legacy/panels/panel_object_picker.py index 802afc109a29..c3ca313c4ccb 100644 --- a/weave/legacy/panels/panel_object_picker.py +++ b/weave/legacy/panels/panel_object_picker.py @@ -2,7 +2,7 @@ import typing import weave -from weave import weave_internal +from weave.legacy import weave_internal from weave.legacy import graph, panel ChoiceType = typing.TypeVar("ChoiceType") diff --git a/weave/legacy/panels/panel_plot.py b/weave/legacy/panels/panel_plot.py index 7210836b2d7f..6386d26e7198 100644 --- a/weave/legacy/panels/panel_plot.py +++ b/weave/legacy/panels/panel_plot.py @@ -4,7 +4,7 @@ import typing import weave -from weave import weave_internal +from weave.legacy import weave_internal from weave.legacy import weave_types as types from weave.legacy import errors, codifiable_value_mixin, codify, graph, panel from weave.legacy.ops_primitives import boolean, list_ diff --git a/weave/legacy/panels/panel_query.py b/weave/legacy/panels/panel_query.py index 1ca55a028289..e59d4b666e8f 100644 --- a/weave/legacy/panels/panel_query.py +++ b/weave/legacy/panels/panel_query.py @@ -2,7 +2,7 @@ import typing import weave -from weave import weave_internal +from weave.legacy import weave_internal from weave.legacy import graph, panel from weave.legacy.panels import table_state diff --git a/weave/legacy/panels/panel_select.py b/weave/legacy/panels/panel_select.py index b62334154da2..3ab67039bae2 100644 --- a/weave/legacy/panels/panel_select.py +++ b/weave/legacy/panels/panel_select.py @@ -2,7 +2,7 @@ import typing import weave -from weave import weave_internal +from weave.legacy import weave_internal from weave.legacy import graph, panel diff --git a/weave/legacy/panels/panel_slider.py b/weave/legacy/panels/panel_slider.py index 130407577d16..cbe568a48761 100644 --- a/weave/legacy/panels/panel_slider.py +++ b/weave/legacy/panels/panel_slider.py @@ -2,7 +2,7 @@ import typing import weave -from weave import weave_internal +from weave.legacy import weave_internal from weave.legacy import panel diff --git a/weave/legacy/panels/panel_table.py b/weave/legacy/panels/panel_table.py index 4cce8bfb05c2..a359e7b01c19 100644 --- a/weave/legacy/panels/panel_table.py +++ b/weave/legacy/panels/panel_table.py @@ -2,7 +2,7 @@ import typing import weave -from weave import weave_internal +from weave.legacy import weave_internal from weave.legacy import codifiable_value_mixin, codify, panel from weave.legacy.graph import ConstNode, Node, OutputNode, VoidNode from weave.legacy.panels import table_state diff --git a/weave/legacy/panels/panel_weavelink.py b/weave/legacy/panels/panel_weavelink.py index ac1bb1258698..095926dd1673 100644 --- a/weave/legacy/panels/panel_weavelink.py +++ b/weave/legacy/panels/panel_weavelink.py @@ -2,7 +2,7 @@ import typing import weave -from weave import weave_internal +from weave.legacy import weave_internal from weave.legacy import graph, ops, panel, panel_util diff --git a/weave/legacy/panels/table_state.py b/weave/legacy/panels/table_state.py index 9415c814d7db..460585136b85 100644 --- a/weave/legacy/panels/table_state.py +++ b/weave/legacy/panels/table_state.py @@ -7,7 +7,7 @@ import string import typing -from weave import weave_internal +from weave.legacy import weave_internal from weave.legacy import decorator_type, graph, ops, panel, weave_types from weave.legacy.language_features.tagging import tagged_value_type diff --git a/weave/legacy/panels_py/panel_autoboard.py b/weave/legacy/panels_py/panel_autoboard.py index ab37b9813ac4..26ea6c6c4686 100644 --- a/weave/legacy/panels_py/panel_autoboard.py +++ b/weave/legacy/panels_py/panel_autoboard.py @@ -26,7 +26,7 @@ import typing import weave -from weave import weave_internal +from weave.legacy import weave_internal from weave.legacy.panels import panel_plot from weave.legacy.panels_py.generator_templates import template_registry from weave.legacy import util diff --git a/weave/legacy/panels_py/panel_example_custom_board.py b/weave/legacy/panels_py/panel_example_custom_board.py index 21ba4b37fdbe..fa3bd6641df7 100644 --- a/weave/legacy/panels_py/panel_example_custom_board.py +++ b/weave/legacy/panels_py/panel_example_custom_board.py @@ -1,5 +1,5 @@ import weave -from weave import weave_internal as internal +from weave.legacy import weave_internal as internal from weave.legacy import weave_types as types from weave.legacy.panels_py.generator_templates import template_registry diff --git a/weave/legacy/panels_py/panel_llm_monitor.py b/weave/legacy/panels_py/panel_llm_monitor.py index a14e0e804d5d..d51810eb0a52 100644 --- a/weave/legacy/panels_py/panel_llm_monitor.py +++ b/weave/legacy/panels_py/panel_llm_monitor.py @@ -2,8 +2,8 @@ import typing import weave -from weave import weave_internal -from weave import weave_internal as internal +from weave.legacy import weave_internal +from weave.legacy import weave_internal as internal from weave.legacy import weave_types as types from weave.legacy import util, dispatch from weave.legacy.panels import panel_board, panel_group diff --git a/weave/legacy/panels_py/panel_observability.py b/weave/legacy/panels_py/panel_observability.py index 37a3d47d6bce..a6ea920d2f43 100644 --- a/weave/legacy/panels_py/panel_observability.py +++ b/weave/legacy/panels_py/panel_observability.py @@ -1,5 +1,5 @@ import weave -from weave import weave_internal +from weave.legacy import weave_internal from weave.legacy import weave_types as types from weave.legacy.panels import panel_board from weave.legacy.panels_py.generator_templates import template_registry diff --git a/weave/legacy/panels_py/panel_seedboard.py b/weave/legacy/panels_py/panel_seedboard.py index a8ffbc5b2c11..4887f66f854b 100644 --- a/weave/legacy/panels_py/panel_seedboard.py +++ b/weave/legacy/panels_py/panel_seedboard.py @@ -1,7 +1,7 @@ import typing import weave -from weave import weave_internal +from weave.legacy import weave_internal from weave.legacy.panels_py.generator_templates import template_registry diff --git a/weave/legacy/panels_py/panel_trace_monitor.py b/weave/legacy/panels_py/panel_trace_monitor.py index 7e228aeef012..9bd91d96090a 100644 --- a/weave/legacy/panels_py/panel_trace_monitor.py +++ b/weave/legacy/panels_py/panel_trace_monitor.py @@ -1,8 +1,8 @@ import os import weave -from weave import weave_internal -from weave import weave_internal as internal +from weave.legacy import weave_internal +from weave.legacy import weave_internal as internal from weave.legacy import weave_types as types from weave.legacy import util, dispatch, graph from weave.legacy.panels import panel_board, panel_group, panel_trace diff --git a/weave/legacy/serialize.py b/weave/legacy/serialize.py index ee83f9047cb1..396a1b956bec 100644 --- a/weave/legacy/serialize.py +++ b/weave/legacy/serialize.py @@ -7,7 +7,7 @@ import random import typing -from weave import weave_internal +from weave.legacy import weave_internal from weave.legacy import weave_types as types from weave.legacy import storage, errors, graph, memo, value_or_error diff --git a/weave/legacy/trace_local.py b/weave/legacy/trace_local.py index 05c6075b0032..b38d0df657de 100644 --- a/weave/legacy/trace_local.py +++ b/weave/legacy/trace_local.py @@ -8,7 +8,7 @@ from weave.legacy import artifact_local, graph, op_def, op_policy, runs from . import ref_base -from .. import ( +from weave.legacy import ( storage, weave_internal, ) diff --git a/weave/weave_internal.py b/weave/legacy/weave_internal.py similarity index 99% rename from weave/weave_internal.py rename to weave/legacy/weave_internal.py index 014ab621db61..e26bcd526c25 100644 --- a/weave/weave_internal.py +++ b/weave/legacy/weave_internal.py @@ -148,7 +148,7 @@ def define_fn( # and the function doesn't explicitly operate on tagged values. this ensures that the input tags # are propagated appropriately to the output type of the function. def refine_graph(node: graph.Node) -> graph.Node: - from .legacy.registry_mem import memory_registry + from weave.legacy.registry_mem import memory_registry if isinstance(node, (graph.ConstNode, graph.VoidNode, graph.VarNode)): return node diff --git a/weave/legacy/weavify.py b/weave/legacy/weavify.py index 6714d6676f89..a85567a1e53c 100644 --- a/weave/legacy/weavify.py +++ b/weave/legacy/weavify.py @@ -2,7 +2,7 @@ from weave.legacy import errors, graph, op_args, val_const -from .. import weave_internal +from weave.legacy import weave_internal from weave.legacy import weave_types as types if typing.TYPE_CHECKING: diff --git a/weave/tests/legacy/test_access.py b/weave/tests/legacy/test_access.py index cbcfbb6defe2..15b1157581d8 100644 --- a/weave/tests/legacy/test_access.py +++ b/weave/tests/legacy/test_access.py @@ -1,9 +1,14 @@ import pytest import weave -from weave.legacy import artifact_fs, artifact_local, environment, errors, wandb_api - -from ... import storage +from weave.legacy import ( + artifact_fs, + artifact_local, + environment, + errors, + storage, + wandb_api, +) @pytest.fixture() diff --git a/weave/tests/legacy/test_arrow.py b/weave/tests/legacy/test_arrow.py index 889835c95887..7e8a7703e643 100644 --- a/weave/tests/legacy/test_arrow.py +++ b/weave/tests/legacy/test_arrow.py @@ -7,7 +7,16 @@ import pytest from PIL import Image -from weave.legacy import box, context_state, errors, graph, mappers_arrow, ops +from weave.legacy import ( + box, + context_state, + errors, + graph, + mappers_arrow, + ops, + storage, + weave_internal, +) # If you're thinking of import vectorize here, don't! Put your # tests in test_arrow_vectorizer.py instead @@ -28,7 +37,6 @@ from weave.tests import list_arrow_test_helpers as lath from ... import api as weave -from ... import storage, weave_internal from ...tests import tag_test_util as ttu from ...tests import weavejs_ops from ...tests.legacy import test_wb diff --git a/weave/tests/legacy/test_arrow_vectorizer.py b/weave/tests/legacy/test_arrow_vectorizer.py index 04e1b0f98626..8f41805c8408 100644 --- a/weave/tests/legacy/test_arrow_vectorizer.py +++ b/weave/tests/legacy/test_arrow_vectorizer.py @@ -5,7 +5,7 @@ import pytest from pyarrow import compute as pc -from weave.legacy import box, dispatch, errors, ops +from weave.legacy import box, dispatch, errors, ops, weave_internal from weave.legacy import ops_arrow as arrow from weave.legacy import weave_types as types from weave.legacy.language_features.tagging import ( @@ -19,7 +19,6 @@ from weave.legacy.ops_primitives import Boolean, Number, date, dict_, list_ from ... import api as weave -from ... import weave_internal string_ops_test_cases = [ ("eq-scalar", lambda x: x == "bc", [True, False, False]), diff --git a/weave/tests/legacy/test_artifact.py b/weave/tests/legacy/test_artifact.py index 27cde9e1e1b5..2c62094c36e8 100644 --- a/weave/tests/legacy/test_artifact.py +++ b/weave/tests/legacy/test_artifact.py @@ -1,11 +1,9 @@ import pytest import weave -from weave.legacy import artifact_fs, artifact_local +from weave.legacy import artifact_fs, artifact_local, storage from weave.legacy import ops_arrow as arrow -from ... import storage - def test_artifact(): data = arrow.to_arrow([{"a": 5}]) diff --git a/weave/tests/legacy/test_basic_ops.py b/weave/tests/legacy/test_basic_ops.py index c957d907e0e2..19c2d3020b8b 100644 --- a/weave/tests/legacy/test_basic_ops.py +++ b/weave/tests/legacy/test_basic_ops.py @@ -1,9 +1,9 @@ from weave.legacy import box, ops from weave.legacy.ops_primitives import number from weave.legacy.ops_primitives.string import * +from weave.legacy.weave_internal import make_const_node from ... import api as weave -from ...weave_internal import make_const_node def test_number_ops(): diff --git a/weave/tests/legacy/test_compile.py b/weave/tests/legacy/test_compile.py index ef0ec1014bdc..2bdde6920af7 100644 --- a/weave/tests/legacy/test_compile.py +++ b/weave/tests/legacy/test_compile.py @@ -8,7 +8,7 @@ from weave.legacy.ops_arrow import to_arrow from weave.legacy.ops_arrow.vectorize import raise_on_python_bailout from weave.legacy.wandb_interface.wandb_stream_table import StreamTable -from weave.weave_internal import const, define_fn, make_const_node +from weave.legacy.weave_internal import const, define_fn, make_const_node from ...api import use diff --git a/weave/tests/legacy/test_complex_calls.py b/weave/tests/legacy/test_complex_calls.py index 07fe79a5f01f..bb480e1b8003 100644 --- a/weave/tests/legacy/test_complex_calls.py +++ b/weave/tests/legacy/test_complex_calls.py @@ -1,6 +1,5 @@ import weave - -from ... import weave_internal +from weave.legacy import weave_internal def test_weave_fn_in_data(): diff --git a/weave/tests/legacy/test_const_type_mapper.py b/weave/tests/legacy/test_const_type_mapper.py index c6143cdc2786..792294572d0a 100644 --- a/weave/tests/legacy/test_const_type_mapper.py +++ b/weave/tests/legacy/test_const_type_mapper.py @@ -1,9 +1,7 @@ import typing import weave -from weave.legacy import context_state - -from ... import weave_internal +from weave.legacy import context_state, weave_internal _loading_builtins_token = context_state.set_loading_built_ins() diff --git a/weave/tests/legacy/test_decorators.py b/weave/tests/legacy/test_decorators.py index e47c79db7a93..cc1a2e1846ba 100644 --- a/weave/tests/legacy/test_decorators.py +++ b/weave/tests/legacy/test_decorators.py @@ -1,8 +1,8 @@ +from weave.legacy import storage from weave.legacy import weave_types as types from weave.legacy.decorator_op import op from ... import api as weave -from ... import storage def test_function_op_name(): diff --git a/weave/tests/legacy/test_execute.py b/weave/tests/legacy/test_execute.py index 29a8a93191fb..a36eec66b6b8 100644 --- a/weave/tests/legacy/test_execute.py +++ b/weave/tests/legacy/test_execute.py @@ -4,10 +4,10 @@ import pytest import weave -from weave.legacy import environment, execute, ops +from weave.legacy import environment, execute, ops, weave_internal from weave.legacy import weave_types as types -from ... import api, weave_internal +from ... import api from . import test_wb execute_test_count_op_run_count = 0 diff --git a/weave/tests/legacy/test_execute_fast.py b/weave/tests/legacy/test_execute_fast.py index 716651dd9435..af8c94b7b5e1 100644 --- a/weave/tests/legacy/test_execute_fast.py +++ b/weave/tests/legacy/test_execute_fast.py @@ -1,8 +1,7 @@ import weave -from weave.legacy import dispatch +from weave.legacy import dispatch, weave_internal from weave.legacy import weave_types as types -from ... import weave_internal from .. import weavejs_ops diff --git a/weave/tests/legacy/test_graph.py b/weave/tests/legacy/test_graph.py index 70051c60a179..ca04c2722d5e 100644 --- a/weave/tests/legacy/test_graph.py +++ b/weave/tests/legacy/test_graph.py @@ -1,9 +1,7 @@ import weave -from weave.legacy import graph +from weave.legacy import graph, weave_internal from weave.legacy import weave_types as types -from ... import weave_internal - def test_map_dag_produces_same_len(): # 3 diff --git a/weave/tests/legacy/test_list_arrow_compat.py b/weave/tests/legacy/test_list_arrow_compat.py index a38a409ae234..08287ed6da9c 100644 --- a/weave/tests/legacy/test_list_arrow_compat.py +++ b/weave/tests/legacy/test_list_arrow_compat.py @@ -3,8 +3,7 @@ import numpy as np import pytest -from weave import weave_internal -from weave.legacy import box, ops +from weave.legacy import box, ops, weave_internal from weave.legacy import ops_arrow as arrow from weave.legacy import weave_types as types from weave.legacy.language_features.tagging import ( diff --git a/weave/tests/legacy/test_logging.py b/weave/tests/legacy/test_logging.py index 48463f5e49f8..6ef1abea8b56 100644 --- a/weave/tests/legacy/test_logging.py +++ b/weave/tests/legacy/test_logging.py @@ -4,9 +4,8 @@ import pytest import requests -from weave.legacy import context, logs, ops, server - -from ... import api, weave_server +from weave import weave_server +from weave.legacy import api, context, logs, ops, server def test_logfile_created(fresh_server_logfile): diff --git a/weave/tests/legacy/test_mappability.py b/weave/tests/legacy/test_mappability.py index e7bbcfb79cad..335eff5722e5 100644 --- a/weave/tests/legacy/test_mappability.py +++ b/weave/tests/legacy/test_mappability.py @@ -2,9 +2,9 @@ from weave.legacy import context_state as _context from weave.legacy import graph from weave.legacy import weave_types as types +from weave.legacy.weave_internal import make_const_node from ...legacy import registry_mem -from ...weave_internal import make_const_node _loading_builtins_token = _context.set_loading_built_ins() @@ -61,7 +61,7 @@ def test_non_mapped_use(): def test_non_mapped_serialized(): - node = weave.weave_internal.make_output_node( + node = weave.legacy.weave_internal.make_output_node( weave.types.Int(), _test_add_one.name, {"x": weave.legacy.graph.ConstNode(weave.types.Int(), 1)}, @@ -82,7 +82,7 @@ def test_mapped_nullable_use(): def test_mapped_serialized(): - node = weave.weave_internal.make_output_node( + node = weave.legacy.weave_internal.make_output_node( weave.types.Int(), _test_add_one.name, { @@ -101,7 +101,7 @@ def test_mapped_empty_use(): def test_mapped_empty_serialized(): - node = weave.weave_internal.make_output_node( + node = weave.legacy.weave_internal.make_output_node( weave.types.Int(), _test_add_one.name, {"x": weave.legacy.graph.ConstNode(weave.types.List(weave.types.Int()), [])}, diff --git a/weave/tests/legacy/test_mappers_python.py b/weave/tests/legacy/test_mappers_python.py index 192fdefb0410..61cd78e0c811 100644 --- a/weave/tests/legacy/test_mappers_python.py +++ b/weave/tests/legacy/test_mappers_python.py @@ -1,7 +1,6 @@ import math -from weave import weave_internal -from weave.legacy import api, context, mappers_python, val_const +from weave.legacy import api, context, mappers_python, val_const, weave_internal from weave.legacy import weave_types as types diff --git a/weave/tests/legacy/test_media.py b/weave/tests/legacy/test_media.py index 175f4ad38cfa..502679692c1d 100644 --- a/weave/tests/legacy/test_media.py +++ b/weave/tests/legacy/test_media.py @@ -3,10 +3,9 @@ import numpy as np import pytest +from weave.legacy import storage from weave.legacy import weave_types as types -from ... import storage - def test_nparray(): arr = np.array([[1, 2], [3, 4]]) diff --git a/weave/tests/legacy/test_mutation2.py b/weave/tests/legacy/test_mutation2.py index d344f10b0f9f..00f5619423d1 100644 --- a/weave/tests/legacy/test_mutation2.py +++ b/weave/tests/legacy/test_mutation2.py @@ -1,7 +1,5 @@ import weave -from weave.legacy import ref_base, uris - -from ... import weave_internal +from weave.legacy import ref_base, uris, weave_internal def test_mutation_set_direct_call(): diff --git a/weave/tests/legacy/test_mutations.py b/weave/tests/legacy/test_mutations.py index 983b777ee053..a83ff5a02725 100644 --- a/weave/tests/legacy/test_mutations.py +++ b/weave/tests/legacy/test_mutations.py @@ -1,7 +1,6 @@ -from weave.legacy import ops +from weave.legacy import ops, storage, weave_internal from ... import api as weave -from ... import storage, weave_internal def test_autocommit(cereal_csv): diff --git a/weave/tests/legacy/test_nullability.py b/weave/tests/legacy/test_nullability.py index 41ab3fd24e82..df8b08be96a6 100644 --- a/weave/tests/legacy/test_nullability.py +++ b/weave/tests/legacy/test_nullability.py @@ -4,7 +4,7 @@ import weave from weave.legacy import context_state as _context -from weave.weave_internal import make_const_node, make_output_node +from weave.legacy.weave_internal import make_const_node, make_output_node _loading_builtins_token = _context.set_loading_built_ins() diff --git a/weave/tests/legacy/test_op.py b/weave/tests/legacy/test_op.py index 46cea2177cbc..dfd0636c0c9f 100644 --- a/weave/tests/legacy/test_op.py +++ b/weave/tests/legacy/test_op.py @@ -2,10 +2,10 @@ import pytest -from weave import types, weave_internal from weave.legacy import api as weave -from weave.legacy import context_state, graph, storage, uris +from weave.legacy import context_state, graph, storage, uris, weave_internal from weave.legacy import context_state as _context_state +from weave.legacy import weave_types as types from . import test_helpers diff --git a/weave/tests/legacy/test_op_behaviors.py b/weave/tests/legacy/test_op_behaviors.py index e49ff51c9c1c..6a9f207acd99 100644 --- a/weave/tests/legacy/test_op_behaviors.py +++ b/weave/tests/legacy/test_op_behaviors.py @@ -19,13 +19,14 @@ op_def, ops_arrow, ops_primitives, + storage, + weave_internal, ) from weave.legacy.language_features.tagging import make_tag_getter_op from weave.legacy.language_features.tagging.tagged_value_type import ( TaggedValueType, ) -from ... import storage, weave_internal from ...legacy import registry_mem from ..concrete_tagged_value import ( TaggedValue, diff --git a/weave/tests/legacy/test_op_dispatching.py b/weave/tests/legacy/test_op_dispatching.py index fbd1d51df36a..7123a19e5530 100644 --- a/weave/tests/legacy/test_op_dispatching.py +++ b/weave/tests/legacy/test_op_dispatching.py @@ -2,13 +2,11 @@ import weave from weave.legacy import context_state as _context -from weave.legacy import graph +from weave.legacy import graph, weave_internal from weave.legacy.dispatch import _dispatch_first_arg, _resolve_op_ambiguity from weave.legacy.language_features.tagging.tagged_value_type import TaggedValueType from weave.legacy.ops_domain import wb_domain_types -from ... import weave_internal - _loading_builtins_token = _context.set_loading_built_ins() diff --git a/weave/tests/legacy/test_panels.py b/weave/tests/legacy/test_panels.py index 867f9842c0f3..14f162987d1f 100644 --- a/weave/tests/legacy/test_panels.py +++ b/weave/tests/legacy/test_panels.py @@ -1,9 +1,9 @@ import pytest import weave +from weave.legacy import storage, weave_internal from weave.legacy.panels import panel_plot -from ... import storage, weave_internal from ...legacy.panels.panel_group import Group from ...legacy.panels.panel_slider import Slider diff --git a/weave/tests/legacy/test_plot.py b/weave/tests/legacy/test_plot.py index 7f0658d25298..f124eabf81d4 100644 --- a/weave/tests/legacy/test_plot.py +++ b/weave/tests/legacy/test_plot.py @@ -4,11 +4,10 @@ import pytest import weave -from weave.legacy import graph +from weave.legacy import graph, storage from weave.legacy import weave_types as types from weave.legacy.panels.panel_plot import Plot, PlotConstants, Series -from ... import storage from .test_run_segment import create_experiment diff --git a/weave/tests/legacy/test_refs.py b/weave/tests/legacy/test_refs.py index ac9923eaaad7..e890134d0fff 100644 --- a/weave/tests/legacy/test_refs.py +++ b/weave/tests/legacy/test_refs.py @@ -2,7 +2,7 @@ import weave from weave.flow.obj import Object -from weave.legacy import artifact_local +from weave.legacy import artifact_local, storage from weave.legacy import ops_arrow as arrow from weave.trace import ref_util from weave.trace_server.refs_internal import ( @@ -11,8 +11,6 @@ OBJECT_ATTR_EDGE_NAME, ) -from ... import storage - def test_laref_artifact_version_1(): art = artifact_local.LocalArtifact("my-art", "v19") diff --git a/weave/tests/legacy/test_run_segment.py b/weave/tests/legacy/test_run_segment.py index eb0f36f81c6d..6ab3815c2008 100644 --- a/weave/tests/legacy/test_run_segment.py +++ b/weave/tests/legacy/test_run_segment.py @@ -6,12 +6,12 @@ import pytest import weave -from weave.legacy import ops +from weave.legacy import ops, storage, weave_internal from weave.legacy import weave_types as types from weave.legacy.ops_arrow import ArrowWeaveList, arrow_as_array from weave.legacy.ops_domain.run_segment import RunSegment -from ... import api, storage, weave_internal +from ... import api N_NUMERIC_METRICS = 99 # number of numerical columns in the metrics table diff --git a/weave/tests/legacy/test_serialize.py b/weave/tests/legacy/test_serialize.py index 030ddb134656..dc430c95cd16 100644 --- a/weave/tests/legacy/test_serialize.py +++ b/weave/tests/legacy/test_serialize.py @@ -1,12 +1,11 @@ import pytest import weave -from weave import weave_internal from weave.legacy import api as api -from weave.legacy import graph, op_args, ops, registry_mem, serialize +from weave.legacy import graph, op_args, ops, registry_mem, serialize, weave_internal from weave.legacy import weave_types as types from weave.legacy.ops_primitives import list_ -from weave.weave_internal import make_const_node +from weave.legacy.weave_internal import make_const_node from .. import fixture_fakewandb as fwb diff --git a/weave/tests/legacy/test_stitch.py b/weave/tests/legacy/test_stitch.py index 368f01ce553e..54accda3ebd9 100644 --- a/weave/tests/legacy/test_stitch.py +++ b/weave/tests/legacy/test_stitch.py @@ -3,12 +3,11 @@ import pytest import weave -from weave.legacy import compile_domain, compile_table +from weave.legacy import compile_domain, compile_table, weave_internal from weave.legacy import context_state as _context from weave.legacy.language_features.tagging import make_tag_getter_op from weave.legacy.ops_domain import run_ops -from ... import weave_internal from ...legacy import stitch from .. import fixture_fakewandb as fwb from . import test_wb diff --git a/weave/tests/legacy/test_storage.py b/weave/tests/legacy/test_storage.py index 4c31c43f9b7d..ab91835e742b 100644 --- a/weave/tests/legacy/test_storage.py +++ b/weave/tests/legacy/test_storage.py @@ -7,14 +7,19 @@ import pytest import wandb -from weave.legacy import artifact_mem, artifact_wandb, mappers_python, ops_arrow +from weave.legacy import ( + artifact_mem, + artifact_wandb, + mappers_python, + ops_arrow, + storage, +) from weave.legacy import weave_types as types from weave.legacy.arrow import list_ as arrow +from weave.legacy.weave_internal import make_const_node from ... import api as weave -from ... import storage from ...legacy.weavejs_fixes import recursively_unwrap_unions -from ...weave_internal import make_const_node from . import test_helpers diff --git a/weave/tests/legacy/test_table_ops.py b/weave/tests/legacy/test_table_ops.py index 9296cb2e2359..c5ece54c3ab1 100644 --- a/weave/tests/legacy/test_table_ops.py +++ b/weave/tests/legacy/test_table_ops.py @@ -3,12 +3,19 @@ import pytest -from weave.legacy import box, context, context_state, graph, ops +from weave.legacy import ( + box, + context, + context_state, + graph, + ops, + storage, + weave_internal, +) from weave.legacy import weave_types as types from weave.legacy.ops_domain import table as table_ops from ... import api as weave -from ... import storage, weave_internal from .. import weavejs_ops TABLE_TYPES = ["list", "pandas", "sql"] diff --git a/weave/tests/legacy/test_tagging.py b/weave/tests/legacy/test_tagging.py index fa691cdd77a8..da17be754088 100644 --- a/weave/tests/legacy/test_tagging.py +++ b/weave/tests/legacy/test_tagging.py @@ -1,7 +1,7 @@ import pytest import weave -from weave.legacy import box +from weave.legacy import box, weave_internal from weave.legacy import weave_types as types from weave.legacy.artifact_fs import FilesystemArtifactFileType from weave.legacy.language_features.tagging import ( @@ -15,8 +15,6 @@ from weave.legacy.ops_primitives import dict as dict_ops from weave.legacy.ops_primitives import list_ as list_ops -from ... import weave_internal - def test_tagged_value(): tv = tagged_value_type.TaggedValueType( diff --git a/weave/tests/legacy/test_trace.py b/weave/tests/legacy/test_trace.py index bd32cec3e01a..629ca15a4c34 100644 --- a/weave/tests/legacy/test_trace.py +++ b/weave/tests/legacy/test_trace.py @@ -1,10 +1,10 @@ import re -from weave.legacy import graph +from weave.legacy import graph, storage +from weave.legacy.weave_internal import make_const_node from ... import api as weave -from ... import storage, trace_legacy -from ...weave_internal import make_const_node +from ...legacy import trace_legacy def test_node_expr(): diff --git a/weave/tests/legacy/test_wb_domain_types.py b/weave/tests/legacy/test_wb_domain_types.py index e2a131a57f20..b035ebd3b7ac 100644 --- a/weave/tests/legacy/test_wb_domain_types.py +++ b/weave/tests/legacy/test_wb_domain_types.py @@ -1,8 +1,8 @@ +from weave.legacy import storage from weave.legacy import weave_types as types from weave.legacy.ops_domain import wb_domain_types as wdt from ... import api as weave -from ... import storage def test_with_keys_assignability(): diff --git a/weave/tests/legacy/test_wb_tables.py b/weave/tests/legacy/test_wb_tables.py index 98ccb6ed0765..0c89d128d291 100644 --- a/weave/tests/legacy/test_wb_tables.py +++ b/weave/tests/legacy/test_wb_tables.py @@ -9,7 +9,7 @@ from weave.legacy.ops_arrow.list_ops import filter from weave.legacy.ops_domain import wbmedia from weave.legacy.ops_domain.wandb_domain_gql import _make_alias -from weave.weave_internal import make_const_node +from weave.legacy.weave_internal import make_const_node def use_static_artifact_node( diff --git a/weave/tests/legacy/test_weavejs_fixes.py b/weave/tests/legacy/test_weavejs_fixes.py index 4488b4314ef9..c40a9d3145f3 100644 --- a/weave/tests/legacy/test_weavejs_fixes.py +++ b/weave/tests/legacy/test_weavejs_fixes.py @@ -2,10 +2,16 @@ import pytest -from weave.legacy import context_state, mappers_python, ops, weavejs_fixes +from weave.legacy import ( + context_state, + mappers_python, + ops, + weave_internal, + weavejs_fixes, +) from weave.legacy import weave_types as types -from ... import api, weave_internal +from ... import api @pytest.mark.skip( diff --git a/weave/tests/legacy/test_weavify.py b/weave/tests/legacy/test_weavify.py index f5971099b433..3e6a845b5173 100644 --- a/weave/tests/legacy/test_weavify.py +++ b/weave/tests/legacy/test_weavify.py @@ -1,9 +1,8 @@ import pytest -from weave.legacy import graph, ops +from weave.legacy import graph, ops, weave_internal from weave.legacy import weave_types as types -from ... import weave_internal from ...legacy import weavify from .. import geom diff --git a/weave/tests/trace/test_server.py b/weave/tests/trace/test_server.py index 1be4acbb3ccf..aaaf1f08ff74 100644 --- a/weave/tests/trace/test_server.py +++ b/weave/tests/trace/test_server.py @@ -12,7 +12,7 @@ from weave.legacy import server as _server from weave.legacy import weave_types as types from weave.legacy.decorator_op import op -from weave.weave_internal import make_const_node +from weave.legacy.weave_internal import make_const_node SERVER_TYPES = ["inprocess", "subprocess", "http"] diff --git a/weave/tests/weavejs_ops.py b/weave/tests/weavejs_ops.py index 2d4764e3f588..82bceb9fba8b 100644 --- a/weave/tests/weavejs_ops.py +++ b/weave/tests/weavejs_ops.py @@ -1,6 +1,6 @@ # WeaveJS ops used for testing. These are not used in production. -from weave.legacy import graph +from weave.legacy import graph, weave_internal from weave.legacy import weave_types as types from weave.legacy._dict_utils import typeddict_pick_output_type from weave.legacy.language_features.tagging import tagged_value_type @@ -9,8 +9,6 @@ op_make_type_tagged_resolver, ) -from .. import weave_internal - def ensure_node(v): if isinstance(v, graph.Node):