From 9253687d60f61544ac9d59f700d9c13720816609 Mon Sep 17 00:00:00 2001 From: Andrew Truong Date: Mon, 26 Aug 2024 17:43:44 -0400 Subject: [PATCH] delete: remaining trace code in legacy api --- weave/legacy/weave/api.py | 12 +++--------- weave/legacy/weave/monitoring/monitor.py | 4 +--- weave/legacy/weave/op_def.py | 6 ------ weave/legacy/weave/op_execute.py | 4 ++-- 4 files changed, 6 insertions(+), 20 deletions(-) diff --git a/weave/legacy/weave/api.py b/weave/legacy/weave/api.py index 13d34e60760..e0d8d73f023 100644 --- a/weave/legacy/weave/api.py +++ b/weave/legacy/weave/api.py @@ -8,8 +8,8 @@ # If this is not imported, serialization of Weave Nodes is incorrect! from weave.legacy.weave import graph_mapper as _graph_mapper -from . import storage as _storage -from . import ref_base as _ref_base +from weave.legacy.weave import storage as _storage +from weave.legacy.weave import ref_base as _ref_base from weave.legacy.weave import wandb_api as _wandb_api from weave.legacy.weave import weave_internal as _weave_internal @@ -17,14 +17,12 @@ from weave.legacy.weave import util as _util from weave.legacy.weave import context as _context -from ...trace import weave_init as _weave_init -from ...trace import weave_client as _weave_client # exposed as part of api from weave.legacy.weave import weave_types as types # needed to enable automatic numpy serialization -from . import types_numpy as _types_numpy +from weave.legacy.weave import types_numpy as _types_numpy from weave.legacy.weave import errors from weave.legacy.weave.decorators import weave_class, mutation, type @@ -41,8 +39,6 @@ from weave.legacy.weave.arrow.list_ import ArrowWeaveList as WeaveList -# TODO: This is here because the op overloaded... -from weave.trace.op import op # noqa: F401 def save(node_or_obj, name=None): # type: ignore from weave.legacy.weave.ops_primitives.weave_api import get, save @@ -128,8 +124,6 @@ def from_pandas(df): # type: ignore "_weave_internal", "_util", "_context", - "_weave_init", - "_weave_client", "types", "_types_numpy", "errors", diff --git a/weave/legacy/weave/monitoring/monitor.py b/weave/legacy/weave/monitoring/monitor.py index 440a72d1291..c2fe7e53880 100644 --- a/weave/legacy/weave/monitoring/monitor.py +++ b/weave/legacy/weave/monitoring/monitor.py @@ -2,7 +2,6 @@ import asyncio import contextlib -import contextvars import dataclasses import datetime import inspect @@ -14,11 +13,10 @@ from weave.legacy.weave import errors from weave.legacy.weave import ( graph, - run_streamtable_span, stream_data_interfaces ) from weave.legacy.weave.wandb_interface.wandb_stream_table import StreamTable -from weave.trace import call_context, context as trace_context +from weave.trace import context as trace_context from weave.trace.client_context import weave_client as weave_client_context logger = logging.getLogger(__name__) diff --git a/weave/legacy/weave/op_def.py b/weave/legacy/weave/op_def.py index f8e397a375e..19add4ee900 100644 --- a/weave/legacy/weave/op_def.py +++ b/weave/legacy/weave/op_def.py @@ -4,7 +4,6 @@ import copy import inspect import typing -from typing import Iterator, Sequence from weave.legacy.weave import weave_types as types from weave.legacy.weave import ( @@ -28,13 +27,8 @@ process_opdef_resolve_fn, tagged_value_type, ) -from weave.legacy.weave.run import Run from weave.legacy.weave.weavejs_fixes import fixup_node -if typing.TYPE_CHECKING: - from weave.trace import weave_client - from weave.legacy.weave.run_streamtable_span import RunStreamTableSpan - _no_refine: contextvars.ContextVar[bool] = contextvars.ContextVar( "_no_refine", default=False diff --git a/weave/legacy/weave/op_execute.py b/weave/legacy/weave/op_execute.py index 8ea3b9fc9d0..7410352eac5 100644 --- a/weave/legacy/weave/op_execute.py +++ b/weave/legacy/weave/op_execute.py @@ -1,10 +1,10 @@ import typing from typing import Mapping -from weave.trace.constants import TRACE_CALL_EMOJI - if typing.TYPE_CHECKING: from .op_def import OpDef + +TRACE_CALL_EMOJI = "🍩" def print_run_link(run):