From 7af3afb74feacf4eed49ecde7d03a0f518ce0efb Mon Sep 17 00:00:00 2001 From: Andrew Truong Date: Fri, 23 Aug 2024 11:05:36 -0400 Subject: [PATCH] move to legacy: errors (and add relevant errors to trace) --- weave/__init__.py | 2 +- weave/client_context/weave_client.py | 2 +- weave/filesystem.py | 4 +- weave/legacy/_dict_utils.py | 2 +- weave/legacy/api.py | 2 +- weave/legacy/arrow/arrow.py | 2 +- weave/legacy/arrow/concat.py | 2 +- weave/legacy/arrow/constructors.py | 2 +- weave/legacy/arrow/convert.py | 4 +- weave/legacy/arrow/list_.py | 2 +- weave/legacy/artifact_fs.py | 2 +- weave/legacy/artifact_local.py | 12 +- weave/legacy/artifact_mem.py | 2 +- weave/legacy/artifact_wandb.py | 2 +- weave/legacy/cache.py | 2 +- weave/legacy/compile.py | 2 +- weave/legacy/compile_domain.py | 2 +- weave/legacy/compile_table.py | 2 +- weave/legacy/decorator_class.py | 2 +- weave/legacy/decorator_type.py | 2 +- weave/legacy/derive_op.py | 2 +- weave/legacy/dispatch.py | 4 +- weave/legacy/environment.py | 4 +- weave/legacy/errors.py | 175 ++++++++++++++++++ weave/legacy/execute.py | 4 +- weave/legacy/execute_fast.py | 2 +- weave/legacy/forward_graph.py | 2 +- weave/legacy/gql_to_weave.py | 2 +- weave/legacy/graph.py | 4 +- weave/legacy/infer_types.py | 4 +- weave/legacy/io_service.py | 2 +- .../language_features/tagging/tag_store.py | 2 +- .../tagging/tagged_value_type.py | 2 +- weave/legacy/mappers_arrow.py | 2 +- weave/legacy/mappers_gql.py | 2 +- weave/legacy/mappers_publisher.py | 3 +- weave/legacy/mappers_python_def.py | 3 +- weave/legacy/monitoring/monitor.py | 2 +- weave/legacy/op_def.py | 2 +- weave/legacy/op_def_type.py | 12 +- weave/legacy/ops_arrow/vectorize.py | 4 +- .../ops_domain/artifact_collection_ops.py | 2 +- .../legacy/ops_domain/artifact_version_ops.py | 2 +- weave/legacy/ops_domain/project_ops.py | 2 +- weave/legacy/ops_domain/repo_insight_ops.py | 2 +- weave/legacy/ops_domain/report_ops.py | 2 +- .../run_history/history_op_common.py | 2 +- ...run_history_v3_parquet_stream_optimized.py | 2 +- weave/legacy/ops_domain/table.py | 3 +- weave/legacy/ops_domain/wandb_domain_gql.py | 4 +- weave/legacy/ops_domain/wbgqlquery_op.py | 2 +- weave/legacy/ops_domain/wbmedia.py | 4 +- weave/legacy/ops_primitives/_dict_utils.py | 2 +- weave/legacy/ops_primitives/file.py | 2 +- weave/legacy/ops_primitives/list_.py | 4 +- weave/legacy/ops_primitives/pandas_.py | 2 +- .../legacy/ops_primitives/projection_utils.py | 2 +- weave/legacy/ops_primitives/type.py | 2 +- weave/legacy/ops_primitives/weave_api.py | 2 +- weave/legacy/panel.py | 4 +- weave/legacy/panels/panel_group.py | 3 +- weave/legacy/panels/panel_plot.py | 4 +- weave/legacy/path_util.py | 2 +- weave/legacy/pyfunc_type_util.py | 2 +- weave/legacy/ref_base.py | 2 +- weave/legacy/registry_mem.py | 4 +- weave/legacy/runfiles_wandb.py | 11 +- weave/legacy/serialize.py | 4 +- weave/legacy/server_error_handling.py | 3 +- weave/legacy/show.py | 4 +- weave/legacy/stitch.py | 2 +- weave/legacy/uris.py | 2 +- weave/legacy/wandb_api.py | 2 +- weave/legacy/wandb_client_api.py | 2 +- weave/legacy/wandb_file_manager.py | 4 +- .../legacy/wandb_interface/wandb_lite_run.py | 2 +- .../wandb_interface/wandb_stream_table.py | 3 +- weave/legacy/wandb_util.py | 2 +- weave/legacy/weavify.py | 4 +- weave/storage.py | 2 +- weave/tests/legacy/test_access.py | 4 +- weave/tests/legacy/test_arrow.py | 4 +- weave/tests/legacy/test_arrow_vectorizer.py | 4 +- weave/tests/legacy/test_filesystem.py | 4 +- weave/trace/op_type.py | 4 +- weave/trace/serve_fastapi.py | 3 +- weave/util.py | 2 +- weave/weave_init.py | 3 +- weave/weave_internal.py | 3 +- weave/weave_server.py | 2 +- weave/weave_types.py | 10 +- 91 files changed, 326 insertions(+), 121 deletions(-) create mode 100644 weave/legacy/errors.py diff --git a/weave/__init__.py b/weave/__init__.py index 67afd523607..d6aca836e1c 100644 --- a/weave/__init__.py +++ b/weave/__init__.py @@ -18,7 +18,7 @@ from .legacy.api import * from .trace.api import * -from .errors import * +from .legacy.errors import * from weave.legacy import mappers_python_def diff --git a/weave/client_context/weave_client.py b/weave/client_context/weave_client.py index c0b3da823df..b80375adb56 100644 --- a/weave/client_context/weave_client.py +++ b/weave/client_context/weave_client.py @@ -1,8 +1,8 @@ import threading from typing import TYPE_CHECKING, Optional -from weave.errors import WeaveInitError from weave.legacy import context_state +from weave.legacy.errors import WeaveInitError if TYPE_CHECKING: from weave.trace.weave_client import WeaveClient diff --git a/weave/filesystem.py b/weave/filesystem.py index a3b03bee1ec..d46b06c6843 100644 --- a/weave/filesystem.py +++ b/weave/filesystem.py @@ -20,9 +20,9 @@ from aiofiles.threadpool import binary as aiofiles_binary from aiofiles.threadpool import text as aiofiles_text -from weave.legacy import cache, engine_trace, environment +from weave.legacy import cache, engine_trace, environment, errors -from . import errors, util +from . import util tracer = engine_trace.tracer() # type: ignore async_utime = aiofiles_os.wrap(os.utime) # type: ignore diff --git a/weave/legacy/_dict_utils.py b/weave/legacy/_dict_utils.py index ce3b41a9288..256a973fe98 100644 --- a/weave/legacy/_dict_utils.py +++ b/weave/legacy/_dict_utils.py @@ -3,7 +3,7 @@ from weave.legacy import box from weave.legacy.language_features.tagging import tag_store, tagged_value_type -from .. import errors +from weave.legacy import errors from .. import weave_types as types diff --git a/weave/legacy/api.py b/weave/legacy/api.py index 5fec25de8a7..177efdf3d20 100644 --- a/weave/legacy/api.py +++ b/weave/legacy/api.py @@ -26,7 +26,7 @@ # needed to enable automatic numpy serialization from . import types_numpy as _types_numpy -from .. import errors +from weave.legacy import errors from weave.legacy.decorators import weave_class, mutation, type from weave.legacy import usage_analytics diff --git a/weave/legacy/arrow/arrow.py b/weave/legacy/arrow/arrow.py index 2799fa249f6..d7f750f7caf 100644 --- a/weave/legacy/arrow/arrow.py +++ b/weave/legacy/arrow/arrow.py @@ -11,7 +11,7 @@ py_type = type -from weave import errors +from weave.legacy import errors from weave import weave_types as types from weave.legacy import artifact_fs, partial_object diff --git a/weave/legacy/arrow/concat.py b/weave/legacy/arrow/concat.py index 28198c3d339..4201da7d17d 100644 --- a/weave/legacy/arrow/concat.py +++ b/weave/legacy/arrow/concat.py @@ -12,7 +12,7 @@ import pyarrow as pa from pyarrow import compute as pc -from weave import errors +from weave.legacy import errors from weave import weave_types as types from weave.legacy.arrow.list_ import ( ArrowWeaveList, diff --git a/weave/legacy/arrow/constructors.py b/weave/legacy/arrow/constructors.py index ee0fe70318e..b7cab73103c 100644 --- a/weave/legacy/arrow/constructors.py +++ b/weave/legacy/arrow/constructors.py @@ -3,7 +3,7 @@ import pyarrow as pa -from weave import errors +from weave.legacy import errors from weave import weave_types as types from weave.legacy import artifact_base, box from weave.legacy.arrow import arrow_tags, convert diff --git a/weave/legacy/arrow/convert.py b/weave/legacy/arrow/convert.py index d4e41d2e16b..1b195a43283 100644 --- a/weave/legacy/arrow/convert.py +++ b/weave/legacy/arrow/convert.py @@ -4,9 +4,9 @@ import pyarrow.compute as pc from weave.legacy import api as api -from weave import errors, weave_internal +from weave import weave_internal from weave import weave_types as types -from weave.legacy import arrow_util, artifact_base, artifact_mem, box, mappers_arrow +from weave.legacy import errors, arrow_util, artifact_base, artifact_mem, box, mappers_arrow from weave.legacy.arrow.arrow import ( ArrowWeaveListType, ) diff --git a/weave/legacy/arrow/list_.py b/weave/legacy/arrow/list_.py index 7cc6e84ddba..cdd8dd1a5d7 100644 --- a/weave/legacy/arrow/list_.py +++ b/weave/legacy/arrow/list_.py @@ -11,11 +11,11 @@ import typing_extensions from weave import ( - errors, weave_internal, ) from weave import weave_types as types from weave.legacy import ( + errors, _dict_utils, artifact_base, box, diff --git a/weave/legacy/artifact_fs.py b/weave/legacy/artifact_fs.py index d5c71f3c643..9b5ca6a47a8 100644 --- a/weave/legacy/artifact_fs.py +++ b/weave/legacy/artifact_fs.py @@ -6,7 +6,7 @@ import os import typing -from weave import errors +from weave.legacy import errors from weave import weave_types as types from weave.legacy import artifact_base, file_base, object_context, ref_base, uris from weave.legacy.language_features.tagging import tag_store diff --git a/weave/legacy/artifact_local.py b/weave/legacy/artifact_local.py index 3bc114b8d96..498c3e5d2d5 100644 --- a/weave/legacy/artifact_local.py +++ b/weave/legacy/artifact_local.py @@ -9,9 +9,17 @@ import typing from datetime import datetime -from weave import errors, filesystem, util +from weave import filesystem, util from weave import weave_types as types -from weave.legacy import artifact_fs, artifact_wandb, environment, file_base, file_util, uris +from weave.legacy import ( + artifact_fs, + artifact_wandb, + environment, + errors, + file_base, + file_util, + uris, +) WORKING_DIR_PREFIX = "__working__" diff --git a/weave/legacy/artifact_mem.py b/weave/legacy/artifact_mem.py index 58471d6460f..bf8763b9da0 100644 --- a/weave/legacy/artifact_mem.py +++ b/weave/legacy/artifact_mem.py @@ -2,7 +2,7 @@ from . import artifact_base from weave import weave_types as types -from weave import errors +from weave.legacy import errors from weave.legacy import ref_base diff --git a/weave/legacy/artifact_wandb.py b/weave/legacy/artifact_wandb.py index 5a1378b8159..8f9a2fcfae1 100644 --- a/weave/legacy/artifact_wandb.py +++ b/weave/legacy/artifact_wandb.py @@ -14,13 +14,13 @@ from wandb.sdk.lib.hashutil import b64_to_hex_id, hex_to_b64_id from weave import ( - errors, filesystem, urls, util, ) from weave import weave_types as types from weave.legacy import ( + errors, engine_trace, artifact_fs, eager, diff --git a/weave/legacy/cache.py b/weave/legacy/cache.py index 7ebe820a715..bb254ca9473 100644 --- a/weave/legacy/cache.py +++ b/weave/legacy/cache.py @@ -6,7 +6,7 @@ import time import typing -from weave import errors +from weave.legacy import errors from weave.legacy import context_state, environment, wandb_api, engine_trace statsd = engine_trace.statsd() # type: ignore diff --git a/weave/legacy/compile.py b/weave/legacy/compile.py index eeec391beed..760a3527ff8 100644 --- a/weave/legacy/compile.py +++ b/weave/legacy/compile.py @@ -6,11 +6,11 @@ import typing from weave import ( - errors, weave_internal, ) from weave import weave_types as types from weave.legacy import ( + errors, engine_trace, box, compile_domain, diff --git a/weave/legacy/compile_domain.py b/weave/legacy/compile_domain.py index 2a0f686d676..3d9c6119220 100644 --- a/weave/legacy/compile_domain.py +++ b/weave/legacy/compile_domain.py @@ -2,7 +2,7 @@ import graphql -from weave import errors +from weave.legacy import errors from weave import weave_types as types from weave.legacy import gql_op_plugin, gql_to_weave, graph, op_args, stitch, registry_mem from weave.legacy.input_provider import InputAndStitchProvider diff --git a/weave/legacy/compile_table.py b/weave/legacy/compile_table.py index 59982717967..f0efcfc85ec 100644 --- a/weave/legacy/compile_table.py +++ b/weave/legacy/compile_table.py @@ -2,7 +2,7 @@ import typing -from weave import errors +from weave.legacy import errors from weave.legacy import stitch KeyTree = typing.Dict[str, "KeyTree"] # type:ignore diff --git a/weave/legacy/decorator_class.py b/weave/legacy/decorator_class.py index 99fadbcb16e..afcdc17690d 100644 --- a/weave/legacy/decorator_class.py +++ b/weave/legacy/decorator_class.py @@ -1,7 +1,7 @@ import inspect import typing -from weave import errors +from weave.legacy import errors from weave import weave_types as types from weave.legacy import context_state, derive_op, op_def, registry_mem diff --git a/weave/legacy/decorator_type.py b/weave/legacy/decorator_type.py index 9568a906f48..2f7ff2f0da9 100644 --- a/weave/legacy/decorator_type.py +++ b/weave/legacy/decorator_type.py @@ -2,7 +2,7 @@ import inspect import typing -from weave import errors +from weave.legacy import errors from weave import weave_types as types from weave.legacy import context_state, decorator_class, object_type_ref_util, infer_types diff --git a/weave/legacy/derive_op.py b/weave/legacy/derive_op.py index 255fe7c89aa..e591a652cc0 100644 --- a/weave/legacy/derive_op.py +++ b/weave/legacy/derive_op.py @@ -7,12 +7,12 @@ import typing from weave import ( - errors, storage, weave_internal, ) from weave import weave_types as types from weave.legacy import ( + errors, parallelism, registry_mem, box, diff --git a/weave/legacy/dispatch.py b/weave/legacy/dispatch.py index 4eaf2ca215f..872ad267e68 100644 --- a/weave/legacy/dispatch.py +++ b/weave/legacy/dispatch.py @@ -5,9 +5,9 @@ import typing from dataclasses import dataclass -from weave import errors, util +from weave import util from weave import weave_types as types -from weave.legacy import graph, memo, op_args, op_def, pyfunc_type_util, registry_mem +from weave.legacy import graph, memo, op_args, op_def, pyfunc_type_util, registry_mem, errors from weave.legacy.language_features.tagging.is_tag_getter import is_tag_getter from weave.legacy.language_features.tagging.tagged_value_type import TaggedValueType diff --git a/weave/legacy/environment.py b/weave/legacy/environment.py index eb5a5271ce5..1e22db8919f 100644 --- a/weave/legacy/environment.py +++ b/weave/legacy/environment.py @@ -10,8 +10,8 @@ import typing from distutils.util import strtobool from urllib.parse import urlparse - -from .. import errors, util +from weave.legacy import errors +from .. import util if typing.TYPE_CHECKING: from .. import logs diff --git a/weave/legacy/errors.py b/weave/legacy/errors.py new file mode 100644 index 00000000000..9bcba3faf94 --- /dev/null +++ b/weave/legacy/errors.py @@ -0,0 +1,175 @@ +from typing import Iterable, Optional + + +class WeaveUnmergableArtifactsError(Exception): + pass + + +class WeaveFingerprintErrorMixin: + fingerprint: Optional[Iterable] = None + + +class WeaveBaseError(Exception, WeaveFingerprintErrorMixin): + pass + + +class WeaveBaseWarning(Warning): + pass + + +# Only use this if you actually want to return an Http 400 +# to the client. This should only happen in cases where the +# client is wrong. +class WeaveBadRequest(WeaveBaseError): + pass + + +class WeaveInternalError(WeaveBaseError): + """Internal Weave Error (a programming error)""" + + pass + + +class WeaveSerializeError(WeaveBaseError): + pass + + +class WeaveConfigurationError(WeaveBaseError): + pass + + +class WeaveApiError(WeaveBaseError): + pass + + +class WeaveTypeError(WeaveBaseError): + pass + + +class WeaveTypeWarning(WeaveBaseWarning): + pass + + +class WeaveDefinitionError(WeaveBaseError): + pass + + +class WeaveMakeFunctionError(Exception): + pass + + +class WeaveExpectedConstError(Exception): + pass + + +class WeaveInvalidURIError(Exception): + pass + + +class WeaveStorageError(Exception): + pass + + +class WeaveExecutionError(Exception): + pass + + +class WeavifyError(Exception): + pass + + +class WeaveDispatchError(WeaveBaseError): + pass + + +class WeaveArtifactFileNotFound(WeaveBaseError): + pass + + +class WeaveArtifactCollectionNotFound(WeaveBaseError): + pass + + +class WeaveArtifactVersionNotFound(WeaveBaseError): + pass + + +class WeaveVectorizationError(WeaveBaseError): + pass + + +class WeaveValueError(WeaveBaseError): + pass + + +class WeaveClientArtifactResolutionFailure(WeaveBaseError): + pass + + +class WeaveTableDeserializationError(WeaveBaseError): + pass + + +class WeaveStitchGraphMergeError(WeaveBaseError): + pass + + +class WeaveHashConstTypeError(WeaveBaseError): + """Raised if __hash__ is called on a Const Type. + + To hash a Const Type, we'd need to hash the value, which is unbounded. + """ + + pass + + +class WeaveGQLCompileError(WeaveBaseError): + pass + + +class WeaveGQLExecuteMissingAliasError(WeaveBaseError): + pass + + +class WeaveAccessDeniedError(WeaveBaseError): + pass + + +class WeaveWandbArtifactManagerError(WeaveBaseError): + pass + + +class WeaveArtifactMediaFileLookupError(WeaveBaseError): + pass + + +class WeaveClientRequestError(WeaveBaseError): + pass + + +class WeaveMissingVariableError(WeaveBaseError): + pass + + +class WeaveWBHistoryTranslationError(WeaveBaseError): + pass + + +class WeaveWandbAuthenticationException(Exception): + pass + + +class WeaveMissingOpDefError(WeaveBaseError): + pass + + +class WeaveMergeArtifactSpecError(WeaveBaseError): + pass + + +class WeaveOpSerializeError(WeaveBaseError): + pass + + +class WeaveInitError(WeaveBaseError): + pass diff --git a/weave/legacy/execute.py b/weave/legacy/execute.py index 4fe5da5e78c..72d7ecd9764 100644 --- a/weave/legacy/execute.py +++ b/weave/legacy/execute.py @@ -9,9 +9,6 @@ import typing from collections.abc import Mapping -from weave import ( - errors, -) from weave import weave_types as types # Configuration @@ -21,6 +18,7 @@ # Trace / cache # Language Features from weave.legacy import ( + errors, engine_trace, environment, parallelism, diff --git a/weave/legacy/execute_fast.py b/weave/legacy/execute_fast.py index f4b571c86ea..4bcb4e418fd 100644 --- a/weave/legacy/execute_fast.py +++ b/weave/legacy/execute_fast.py @@ -1,11 +1,11 @@ import logging from weave import ( - errors, weave_internal, ) from weave import weave_types as types from weave.legacy import ( + errors, engine_trace, ref_base, registry_mem, diff --git a/weave/legacy/forward_graph.py b/weave/legacy/forward_graph.py index 8a3048a281d..7f3801e3024 100644 --- a/weave/legacy/forward_graph.py +++ b/weave/legacy/forward_graph.py @@ -5,7 +5,7 @@ from weave.legacy import graph -from .. import errors +from weave.legacy import errors ExecutableNode = typing.Union[graph.OutputNode, graph.ConstNode] diff --git a/weave/legacy/gql_to_weave.py b/weave/legacy/gql_to_weave.py index 6216e5d93b6..51c78413868 100644 --- a/weave/legacy/gql_to_weave.py +++ b/weave/legacy/gql_to_weave.py @@ -17,7 +17,7 @@ parse, ) -from weave import errors +from weave.legacy import errors from weave import weave_types as types from weave.legacy import gql_schema diff --git a/weave/legacy/graph.py b/weave/legacy/graph.py index cb05793a81d..85aeecd13c1 100644 --- a/weave/legacy/graph.py +++ b/weave/legacy/graph.py @@ -2,8 +2,8 @@ import json import typing -from weave import errors, storage, weave_types -from weave.legacy import uris +from weave import storage, weave_types +from weave.legacy import uris, errors if typing.TYPE_CHECKING: from weave.legacy import weave_inspector diff --git a/weave/legacy/infer_types.py b/weave/legacy/infer_types.py index 55d9988fb02..8a70475c7de 100644 --- a/weave/legacy/infer_types.py +++ b/weave/legacy/infer_types.py @@ -6,9 +6,9 @@ import typing_extensions -from weave.legacy import graph +from weave.legacy import errors, graph -from .. import errors, weave_types +from .. import weave_types class TypedDictLike: diff --git a/weave/legacy/io_service.py b/weave/legacy/io_service.py index 4ef61c6218c..701363c0a36 100644 --- a/weave/legacy/io_service.py +++ b/weave/legacy/io_service.py @@ -23,11 +23,11 @@ import aioprocessing from weave import ( - errors, filesystem, weave_http, ) from weave.legacy import ( + errors, engine_trace, server_error_handling, artifact_wandb, diff --git a/weave/legacy/language_features/tagging/tag_store.py b/weave/legacy/language_features/tagging/tag_store.py index 85a4c98de9f..c39c404e35f 100644 --- a/weave/legacy/language_features/tagging/tag_store.py +++ b/weave/legacy/language_features/tagging/tag_store.py @@ -22,7 +22,7 @@ from collections import defaultdict from contextlib import contextmanager -from weave import errors +from weave.legacy import errors from weave import weave_types as types from weave.legacy import engine_trace, box diff --git a/weave/legacy/language_features/tagging/tagged_value_type.py b/weave/legacy/language_features/tagging/tagged_value_type.py index e9d44ae5977..533e0f4af38 100644 --- a/weave/legacy/language_features/tagging/tagged_value_type.py +++ b/weave/legacy/language_features/tagging/tagged_value_type.py @@ -30,7 +30,7 @@ import json import typing -from weave import errors +from weave.legacy import errors from weave import weave_types as types from weave.legacy import box, mappers, mappers_python from weave.legacy.language_features.tagging import tag_store diff --git a/weave/legacy/mappers_arrow.py b/weave/legacy/mappers_arrow.py index 2f1ca904ef1..7c47d34b568 100644 --- a/weave/legacy/mappers_arrow.py +++ b/weave/legacy/mappers_arrow.py @@ -5,7 +5,7 @@ import pyarrow as pa -from weave import errors +from weave.legacy import errors from weave import weave_types as types from weave.legacy import ( arrow_util, diff --git a/weave/legacy/mappers_gql.py b/weave/legacy/mappers_gql.py index 1dbde410384..4a4ce875af4 100644 --- a/weave/legacy/mappers_gql.py +++ b/weave/legacy/mappers_gql.py @@ -1,6 +1,6 @@ import json -from weave import errors +from weave.legacy import errors from weave import weave_types as types from weave.legacy import gql_json_cache, mappers from weave.legacy.mappers_weave import UnionMapper diff --git a/weave/legacy/mappers_publisher.py b/weave/legacy/mappers_publisher.py index 2e57541b60e..4118232aca3 100644 --- a/weave/legacy/mappers_publisher.py +++ b/weave/legacy/mappers_publisher.py @@ -2,7 +2,7 @@ import dataclasses import typing -from weave import errors, storage, weave_internal +from weave import storage, weave_internal from weave import weave_types as types from weave.legacy.node_ref import ref_to_node @@ -16,6 +16,7 @@ mappers, mappers_python_def, ref_base, + errors, ) from weave.legacy.artifact_wandb import likely_commit_hash from weave.legacy.language_features.tagging import tag_store, tagged_value_type diff --git a/weave/legacy/mappers_python_def.py b/weave/legacy/mappers_python_def.py index 88a38b59af1..4551d783803 100644 --- a/weave/legacy/mappers_python_def.py +++ b/weave/legacy/mappers_python_def.py @@ -4,7 +4,7 @@ import math import typing -from weave import errors, storage +from weave import storage from weave import weave_types as types from weave.legacy import ( artifact_fs, @@ -14,6 +14,7 @@ mappers_weave, ref_base, val_const, + errors, ) from weave.legacy import timestamp as weave_timestamp from weave.legacy.language_features.tagging import tagged_value_type diff --git a/weave/legacy/monitoring/monitor.py b/weave/legacy/monitoring/monitor.py index ff0e67ba359..5a707af576c 100644 --- a/weave/legacy/monitoring/monitor.py +++ b/weave/legacy/monitoring/monitor.py @@ -11,7 +11,7 @@ import typing import uuid -from weave import errors +from weave.legacy import errors from weave.legacy import ( graph, run_streamtable_span, diff --git a/weave/legacy/op_def.py b/weave/legacy/op_def.py index 8784906cc06..d38d208a4ba 100644 --- a/weave/legacy/op_def.py +++ b/weave/legacy/op_def.py @@ -7,11 +7,11 @@ from typing import Iterator, Sequence from weave import ( - errors, weave_internal, ) from weave import weave_types as types from weave.legacy import ( + errors, context_state, engine_trace, graph, diff --git a/weave/legacy/op_def_type.py b/weave/legacy/op_def_type.py index 030ffad85c4..040eeef1415 100644 --- a/weave/legacy/op_def_type.py +++ b/weave/legacy/op_def_type.py @@ -11,9 +11,17 @@ from _ast import AsyncFunctionDef, ExceptHandler from typing import Any -from weave import errors, storage +from weave import storage from weave import weave_types as types -from weave.legacy import artifact_fs, artifact_local, context_state, environment, infer_types, registry_mem +from weave.legacy import ( + artifact_fs, + artifact_local, + context_state, + environment, + errors, + infer_types, + registry_mem, +) if typing.TYPE_CHECKING: from .op_def import OpDef diff --git a/weave/legacy/ops_arrow/vectorize.py b/weave/legacy/ops_arrow/vectorize.py index 0c9489397b8..5974c3e1402 100644 --- a/weave/legacy/ops_arrow/vectorize.py +++ b/weave/legacy/ops_arrow/vectorize.py @@ -7,10 +7,10 @@ import pyarrow as pa from weave import ( - errors, + weave_internal, ) -from weave.legacy import weavify, registry_mem +from weave.legacy import errors,weavify, registry_mem from weave import weave_types as types from weave.legacy.api import op, use from weave.legacy import dispatch, graph, graph_debug, op_args, op_def diff --git a/weave/legacy/ops_domain/artifact_collection_ops.py b/weave/legacy/ops_domain/artifact_collection_ops.py index 2ca057618dc..ed3f2d705fd 100644 --- a/weave/legacy/ops_domain/artifact_collection_ops.py +++ b/weave/legacy/ops_domain/artifact_collection_ops.py @@ -1,7 +1,7 @@ import typing import urllib -from weave import errors +from weave.legacy import errors from weave import weave_types as types from weave.legacy.api import op from weave.legacy.gql_op_plugin import wb_gql_op_plugin diff --git a/weave/legacy/ops_domain/artifact_version_ops.py b/weave/legacy/ops_domain/artifact_version_ops.py index cc13aa5d84e..ada1ba79201 100644 --- a/weave/legacy/ops_domain/artifact_version_ops.py +++ b/weave/legacy/ops_domain/artifact_version_ops.py @@ -2,7 +2,7 @@ import typing from urllib.parse import quote -from weave import errors +from weave.legacy import errors from weave import weave_types as types from weave.legacy.api import op from weave.legacy import artifact_fs, artifact_wandb, input_provider diff --git a/weave/legacy/ops_domain/project_ops.py b/weave/legacy/ops_domain/project_ops.py index c8f13427a8a..22ebabcd6b7 100644 --- a/weave/legacy/ops_domain/project_ops.py +++ b/weave/legacy/ops_domain/project_ops.py @@ -1,7 +1,7 @@ import json import typing -from weave import errors +from weave.legacy import errors from weave import weave_types as types from weave.legacy.api import op from weave.legacy import input_provider diff --git a/weave/legacy/ops_domain/repo_insight_ops.py b/weave/legacy/ops_domain/repo_insight_ops.py index 486192281eb..d03aaa61cc6 100644 --- a/weave/legacy/ops_domain/repo_insight_ops.py +++ b/weave/legacy/ops_domain/repo_insight_ops.py @@ -1,7 +1,7 @@ import datetime import json -from weave import errors +from weave.legacy import errors from weave import weave_types as types from weave.legacy.api import op from weave.legacy.gql_json_cache import use_json diff --git a/weave/legacy/ops_domain/report_ops.py b/weave/legacy/ops_domain/report_ops.py index 3173e4f8fa2..fe3c39e80c5 100644 --- a/weave/legacy/ops_domain/report_ops.py +++ b/weave/legacy/ops_domain/report_ops.py @@ -2,7 +2,7 @@ import typing import urllib -from weave import errors +from weave.legacy import errors from weave import weave_types as types from weave.legacy.api import op from weave.legacy.gql_op_plugin import wb_gql_op_plugin diff --git a/weave/legacy/ops_domain/run_history/history_op_common.py b/weave/legacy/ops_domain/run_history/history_op_common.py index fbfab866db7..b95c1bf14b4 100644 --- a/weave/legacy/ops_domain/run_history/history_op_common.py +++ b/weave/legacy/ops_domain/run_history/history_op_common.py @@ -5,12 +5,12 @@ from pyarrow import parquet as pq from weave import ( - errors, util, ) from weave import weave_types as types from weave.legacy.api import use from weave.legacy import ( + errors, engine_trace, registry_mem, _dict_utils, diff --git a/weave/legacy/ops_domain/run_history/run_history_v3_parquet_stream_optimized.py b/weave/legacy/ops_domain/run_history/run_history_v3_parquet_stream_optimized.py index 6b61d141ac0..b39fce58054 100644 --- a/weave/legacy/ops_domain/run_history/run_history_v3_parquet_stream_optimized.py +++ b/weave/legacy/ops_domain/run_history/run_history_v3_parquet_stream_optimized.py @@ -5,7 +5,7 @@ import pyarrow as pa -from weave import errors +from weave.legacy import errors from weave import weave_types as types from weave.legacy.api import op from weave.legacy import ( diff --git a/weave/legacy/ops_domain/table.py b/weave/legacy/ops_domain/table.py index ba5dcddf7e0..1253293fe95 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 errors, util, weave_internal +from weave import util, weave_internal from weave import weave_types as types from weave.legacy.api import op, weave_class from weave.legacy import ( @@ -15,6 +15,7 @@ ops_arrow, wandb_util, engine_trace, + errors, ) from weave.legacy import timestamp as weave_timestamp from weave.legacy.ops_domain import trace_tree, wbmedia diff --git a/weave/legacy/ops_domain/wandb_domain_gql.py b/weave/legacy/ops_domain/wandb_domain_gql.py index 2f8601a2f32..9cb25156608 100644 --- a/weave/legacy/ops_domain/wandb_domain_gql.py +++ b/weave/legacy/ops_domain/wandb_domain_gql.py @@ -4,9 +4,9 @@ import pyarrow as pa -from weave import errors, weave_types +from weave import weave_types from weave.legacy.api import op -from weave.legacy import gql_op_plugin, op_def, partial_object +from weave.legacy import errors, gql_op_plugin, op_def, partial_object from weave.legacy.decorator_arrow_op import arrow_op from weave.legacy.gql_op_plugin import wb_gql_op_plugin from weave.legacy.input_provider import InputProvider diff --git a/weave/legacy/ops_domain/wbgqlquery_op.py b/weave/legacy/ops_domain/wbgqlquery_op.py index 2ed399410b7..e16da74c830 100644 --- a/weave/legacy/ops_domain/wbgqlquery_op.py +++ b/weave/legacy/ops_domain/wbgqlquery_op.py @@ -1,7 +1,7 @@ import logging import typing -from weave import errors +from weave.legacy import errors from weave import weave_types as types from weave.legacy.api import op from weave.legacy import engine_trace, environment, mappers_gql, partial_object diff --git a/weave/legacy/ops_domain/wbmedia.py b/weave/legacy/ops_domain/wbmedia.py index 12683e376e1..72695599163 100644 --- a/weave/legacy/ops_domain/wbmedia.py +++ b/weave/legacy/ops_domain/wbmedia.py @@ -5,8 +5,8 @@ import typing from weave.legacy import api as weave -from weave import errors, types -from weave.legacy import engine_trace, artifact_fs, file_base +from weave import types +from weave.legacy import errors, engine_trace, artifact_fs, file_base from weave.legacy.language_features.tagging.tag_store import isolated_tagging_context from weave.legacy.ops_primitives import html, markdown diff --git a/weave/legacy/ops_primitives/_dict_utils.py b/weave/legacy/ops_primitives/_dict_utils.py index 06c0a9965ee..16b44d7b135 100644 --- a/weave/legacy/ops_primitives/_dict_utils.py +++ b/weave/legacy/ops_primitives/_dict_utils.py @@ -1,6 +1,6 @@ import typing -from weave import errors +from weave.legacy import errors from weave import weave_types as types from weave.legacy import box from weave.legacy.language_features.tagging import tag_store, tagged_value_type diff --git a/weave/legacy/ops_primitives/file.py b/weave/legacy/ops_primitives/file.py index 854da41e866..19d97a3b49a 100644 --- a/weave/legacy/ops_primitives/file.py +++ b/weave/legacy/ops_primitives/file.py @@ -2,7 +2,7 @@ import typing from weave.legacy import environment as weave_env -from weave import errors +from weave.legacy import errors from weave import weave_types as types from weave.legacy.api import op from weave.legacy import file_base, wandb_file_manager diff --git a/weave/legacy/ops_primitives/list_.py b/weave/legacy/ops_primitives/list_.py index 645a6e85a92..a58a2884955 100644 --- a/weave/legacy/ops_primitives/list_.py +++ b/weave/legacy/ops_primitives/list_.py @@ -6,9 +6,9 @@ import numpy as np import pandas as pd -from weave import errors, storage +from weave import storage from weave import weave_types as types -from weave.legacy import box, execute_fast +from weave.legacy import box, execute_fast, errors from weave.legacy._dict_utils import tag_aware_dict_val_for_escaped_key from weave.legacy.decorator_class import weave_class from weave.legacy.decorator_op import op diff --git a/weave/legacy/ops_primitives/pandas_.py b/weave/legacy/ops_primitives/pandas_.py index 3a0b5cad83b..70b15467e9d 100644 --- a/weave/legacy/ops_primitives/pandas_.py +++ b/weave/legacy/ops_primitives/pandas_.py @@ -8,7 +8,7 @@ import pyarrow as pa import pyarrow.parquet as pq -from weave import errors +from weave.legacy import errors from weave import weave_types as types from weave.legacy.api import op, weave_class from weave.legacy import box, file_base, graph, mappers_python diff --git a/weave/legacy/ops_primitives/projection_utils.py b/weave/legacy/ops_primitives/projection_utils.py index 8e05cf2753a..49e96d1e562 100644 --- a/weave/legacy/ops_primitives/projection_utils.py +++ b/weave/legacy/ops_primitives/projection_utils.py @@ -9,7 +9,7 @@ from sklearn.decomposition import PCA from sklearn.manifold import TSNE -from weave import errors +from weave.legacy import errors from weave.legacy import context_state, environment umap_lib = {} diff --git a/weave/legacy/ops_primitives/type.py b/weave/legacy/ops_primitives/type.py index e4364746014..46b7c987062 100644 --- a/weave/legacy/ops_primitives/type.py +++ b/weave/legacy/ops_primitives/type.py @@ -1,6 +1,6 @@ import typing -from weave import errors +from weave.legacy import errors from weave import weave_types as types from weave.legacy.api import op diff --git a/weave/legacy/ops_primitives/weave_api.py b/weave/legacy/ops_primitives/weave_api.py index a135508fe9d..fc34be66d49 100644 --- a/weave/legacy/ops_primitives/weave_api.py +++ b/weave/legacy/ops_primitives/weave_api.py @@ -3,7 +3,6 @@ import typing from weave import ( - errors, storage, trace_legacy, weave_internal, @@ -11,6 +10,7 @@ from weave import weave_types as types from weave.legacy.api import mutation, op, weave_class from weave.legacy import ( + errors, ref_base, registry_mem, artifact_fs, diff --git a/weave/legacy/panel.py b/weave/legacy/panel.py index 858bc39eeee..632a3d6e78a 100644 --- a/weave/legacy/panel.py +++ b/weave/legacy/panel.py @@ -4,9 +4,9 @@ from tarfile import DEFAULT_FORMAT from weave.legacy import api as weave -from weave import errors, storage, weave_internal +from weave import storage, weave_internal from weave import weave_types as types -from weave.legacy import graph, panel_util +from weave.legacy import graph, panel_util, errors def run_variable_lambdas( diff --git a/weave/legacy/panels/panel_group.py b/weave/legacy/panels/panel_group.py index 07b70604170..a7ea1847900 100644 --- a/weave/legacy/panels/panel_group.py +++ b/weave/legacy/panels/panel_group.py @@ -3,8 +3,9 @@ import typing import weave -from weave import errors, weave_internal +from weave import weave_internal from weave.legacy import ( + errors, codifiable_value_mixin, codify, dispatch, diff --git a/weave/legacy/panels/panel_plot.py b/weave/legacy/panels/panel_plot.py index ef6a606723b..3f3a2804988 100644 --- a/weave/legacy/panels/panel_plot.py +++ b/weave/legacy/panels/panel_plot.py @@ -4,9 +4,9 @@ import typing import weave -from weave import errors, weave_internal +from weave import weave_internal from weave import weave_types as types -from weave.legacy import codifiable_value_mixin, codify, graph, panel +from weave.legacy import errors, codifiable_value_mixin, codify, graph, panel from weave.legacy.ops_primitives import boolean, list_ from weave.legacy.ops_primitives import dict as dict_ from weave.legacy.panels import panel_table, table_state diff --git a/weave/legacy/path_util.py b/weave/legacy/path_util.py index 845bbc4aa9a..a6504697c37 100644 --- a/weave/legacy/path_util.py +++ b/weave/legacy/path_util.py @@ -1,7 +1,7 @@ import pathlib import typing -from .. import errors +from weave.legacy import errors def safe_join(*args: typing.Union[str, pathlib.Path]) -> str: diff --git a/weave/legacy/pyfunc_type_util.py b/weave/legacy/pyfunc_type_util.py index bb544dfd2f4..e327e18b4d5 100644 --- a/weave/legacy/pyfunc_type_util.py +++ b/weave/legacy/pyfunc_type_util.py @@ -3,7 +3,7 @@ from weave.legacy import infer_types, op_args -from .. import errors +from weave.legacy import errors from .. import weave_types as types InputTypeItemType = typing.Union[types.Type, typing.Callable[..., types.Type]] diff --git a/weave/legacy/ref_base.py b/weave/legacy/ref_base.py index e7742d9eb65..a085e044652 100644 --- a/weave/legacy/ref_base.py +++ b/weave/legacy/ref_base.py @@ -9,7 +9,7 @@ from weave.legacy import box, context_state, object_context, uris from weave.legacy.language_features.tagging import tag_store -from .. import errors +from weave.legacy import errors from .. import weave_types as types # We store Refs here if we can't attach them directly to the object diff --git a/weave/legacy/registry_mem.py b/weave/legacy/registry_mem.py index 62f4a42134f..6bfcb60d2ad 100644 --- a/weave/legacy/registry_mem.py +++ b/weave/legacy/registry_mem.py @@ -1,8 +1,8 @@ import datetime import typing -from weave import errors, storage, weave_types -from weave.legacy import context_state, op_aliases, op_args, uris +from weave import storage, weave_types +from weave.legacy import errors, context_state, op_aliases, op_args, uris from weave.legacy.op_args import OpNamedArgs if typing.TYPE_CHECKING: diff --git a/weave/legacy/runfiles_wandb.py b/weave/legacy/runfiles_wandb.py index d61f91f4c53..5aef4727961 100644 --- a/weave/legacy/runfiles_wandb.py +++ b/weave/legacy/runfiles_wandb.py @@ -7,9 +7,16 @@ import typing from weave.legacy import environment as weave_env -from weave import errors, filesystem +from weave import filesystem from weave import weave_types as types -from weave.legacy import artifact_fs, file_util, memo, uris, wandb_client_api +from weave.legacy import ( + artifact_fs, + errors, + file_util, + memo, + uris, + wandb_client_api, +) if typing.TYPE_CHECKING: from wandb.apis.public import Run as WBRun diff --git a/weave/legacy/serialize.py b/weave/legacy/serialize.py index 7a2b55d5e5c..f1b10819b29 100644 --- a/weave/legacy/serialize.py +++ b/weave/legacy/serialize.py @@ -7,9 +7,9 @@ import random import typing -from weave import errors, storage, weave_internal +from weave import storage, weave_internal from weave import weave_types as types -from weave.legacy import graph, memo, value_or_error +from weave.legacy import errors, graph, memo, value_or_error NodeOrOp = typing.Union[graph.Node, graph.Op] diff --git a/weave/legacy/server_error_handling.py b/weave/legacy/server_error_handling.py index bdc5a46ee2b..66c89590acc 100644 --- a/weave/legacy/server_error_handling.py +++ b/weave/legacy/server_error_handling.py @@ -26,8 +26,9 @@ from werkzeug import Response from werkzeug import exceptions as werkzeug_exceptions from werkzeug import http as werkzeug_http +from weave.legacy import errors -from .. import errors, util +from .. import util class WeaveInternalHttpException(werkzeug_exceptions.HTTPException): diff --git a/weave/legacy/show.py b/weave/legacy/show.py index 92ae3f7cf16..40543b67036 100644 --- a/weave/legacy/show.py +++ b/weave/legacy/show.py @@ -5,8 +5,8 @@ from IPython.display import IFrame, display -from weave.legacy import artifact_fs, context, graph, ops, node_ref, panel, ref_base -from weave import errors, storage, util +from weave.legacy import artifact_fs, context, errors, graph, ops, node_ref, panel, ref_base +from weave import storage, util from . import usage_analytics from .. import weave_types as types from . import weavejs_fixes diff --git a/weave/legacy/stitch.py b/weave/legacy/stitch.py index 3c2de9a04bc..878448292d5 100644 --- a/weave/legacy/stitch.py +++ b/weave/legacy/stitch.py @@ -25,7 +25,7 @@ from weave.legacy import graph, op_def, registry_mem from weave.legacy.language_features.tagging import opdef_util -from .. import errors +from weave.legacy import errors from .. import weave_types as types from . import _dict_utils diff --git a/weave/legacy/uris.py b/weave/legacy/uris.py index 7ce5150f23b..465dac98b9f 100644 --- a/weave/legacy/uris.py +++ b/weave/legacy/uris.py @@ -2,7 +2,7 @@ import typing from urllib import parse -from .. import errors +from weave.legacy import errors if typing.TYPE_CHECKING: from . import ref_base diff --git a/weave/legacy/wandb_api.py b/weave/legacy/wandb_api.py index 2ef082916f6..d93a11da936 100644 --- a/weave/legacy/wandb_api.py +++ b/weave/legacy/wandb_api.py @@ -14,7 +14,7 @@ from gql.transport.requests import RequestsHTTPTransport from requests.auth import HTTPBasicAuth -from weave import errors +from weave.legacy import errors from weave.legacy import environment as weave_env from weave.legacy import wandb_client_api, engine_trace diff --git a/weave/legacy/wandb_client_api.py b/weave/legacy/wandb_client_api.py index 524456e5d76..11bbff4e333 100644 --- a/weave/legacy/wandb_client_api.py +++ b/weave/legacy/wandb_client_api.py @@ -12,7 +12,7 @@ from wandb.errors import CommError as WandbCommError from wandb.sdk.internal.internal_api import _thread_local_api_settings -from weave import errors +from weave.legacy import errors def wandb_public_api() -> public.Api: diff --git a/weave/legacy/wandb_file_manager.py b/weave/legacy/wandb_file_manager.py index 6fd5a14a176..2e437c0021a 100644 --- a/weave/legacy/wandb_file_manager.py +++ b/weave/legacy/wandb_file_manager.py @@ -12,9 +12,9 @@ from requests.auth import HTTPBasicAuth from wandb.sdk.lib import hashutil -from weave import errors, filesystem, weave_http +from weave import filesystem, weave_http from weave.legacy import environment as weave_env -from weave.legacy import artifact_wandb, cache, wandb_api, engine_trace +from weave.legacy import artifact_wandb, cache, errors, wandb_api, engine_trace tracer = engine_trace.tracer() # type: ignore diff --git a/weave/legacy/wandb_interface/wandb_lite_run.py b/weave/legacy/wandb_interface/wandb_lite_run.py index 95fa4c8e3f0..4cd60b7452b 100644 --- a/weave/legacy/wandb_interface/wandb_lite_run.py +++ b/weave/legacy/wandb_interface/wandb_lite_run.py @@ -15,7 +15,7 @@ from wandb.sdk.internal.sender import _manifest_json_from_proto from wandb.sdk.lib import runid -from weave import errors +from weave.legacy import errors from weave.legacy import engine_trace, wandb_client_api logger = logging.getLogger(__name__) diff --git a/weave/legacy/wandb_interface/wandb_stream_table.py b/weave/legacy/wandb_interface/wandb_stream_table.py index 4f69e6b7299..4c8072a82f1 100644 --- a/weave/legacy/wandb_interface/wandb_stream_table.py +++ b/weave/legacy/wandb_interface/wandb_stream_table.py @@ -15,8 +15,9 @@ from wandb.sdk.lib.paths import LogicalPath from wandb.sdk.lib.printer import get_printer -from weave import errors, storage, weave_types +from weave import storage, weave_types from weave.legacy import ( + errors, artifact_base, box, environment, diff --git a/weave/legacy/wandb_util.py b/weave/legacy/wandb_util.py index b963eaed1c8..f160a46e2a0 100644 --- a/weave/legacy/wandb_util.py +++ b/weave/legacy/wandb_util.py @@ -1,6 +1,6 @@ import typing -from weave import errors +from weave.legacy import errors from weave import weave_types as types from weave.legacy import ops, ops_domain diff --git a/weave/legacy/weavify.py b/weave/legacy/weavify.py index e739a308e92..651cdc52b9d 100644 --- a/weave/legacy/weavify.py +++ b/weave/legacy/weavify.py @@ -1,8 +1,8 @@ import typing -from weave.legacy import graph, op_args, val_const +from weave.legacy import errors, graph, op_args, val_const -from .. import errors, weave_internal +from .. import weave_internal from .. import weave_types as types if typing.TYPE_CHECKING: diff --git a/weave/storage.py b/weave/storage.py index c87c1db4060..999f3ffd633 100644 --- a/weave/storage.py +++ b/weave/storage.py @@ -15,13 +15,13 @@ artifact_mem, artifact_wandb, box, + errors, graph, mappers_python, ref_base, timestamp, ) -from . import errors from . import weave_types as types Ref = ref_base.Ref diff --git a/weave/tests/legacy/test_access.py b/weave/tests/legacy/test_access.py index 1006a9e400b..cbcfbb6defe 100644 --- a/weave/tests/legacy/test_access.py +++ b/weave/tests/legacy/test_access.py @@ -1,9 +1,9 @@ import pytest import weave -from weave.legacy import artifact_fs, artifact_local, environment, wandb_api +from weave.legacy import artifact_fs, artifact_local, environment, errors, wandb_api -from ... import errors, storage +from ... import storage @pytest.fixture() diff --git a/weave/tests/legacy/test_arrow.py b/weave/tests/legacy/test_arrow.py index 6dc81439f05..87058e0e6ae 100644 --- a/weave/tests/legacy/test_arrow.py +++ b/weave/tests/legacy/test_arrow.py @@ -7,7 +7,7 @@ import pytest from PIL import Image -from weave.legacy import box, context_state, graph, mappers_arrow, ops +from weave.legacy import box, context_state, errors, graph, mappers_arrow, ops # If you're thinking of import vectorize here, don't! Put your # tests in test_arrow_vectorizer.py instead @@ -27,7 +27,7 @@ from weave.tests import list_arrow_test_helpers as lath from ... import api as weave -from ... import errors, storage, weave_internal +from ... import storage, weave_internal from ... import weave_types as types from ...tests import tag_test_util as ttu from ...tests import weavejs_ops diff --git a/weave/tests/legacy/test_arrow_vectorizer.py b/weave/tests/legacy/test_arrow_vectorizer.py index 51aeb512543..b5e38bf8286 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, ops +from weave.legacy import box, dispatch, errors, ops from weave.legacy import ops_arrow as arrow from weave.legacy.language_features.tagging import ( make_tag_getter_op, @@ -18,7 +18,7 @@ from weave.legacy.ops_primitives import Boolean, Number, date, dict_, list_ from ... import api as weave -from ... import errors, weave_internal +from ... import weave_internal from ... import weave_types as types string_ops_test_cases = [ diff --git a/weave/tests/legacy/test_filesystem.py b/weave/tests/legacy/test_filesystem.py index 7faa4668230..aaae05b21e9 100644 --- a/weave/tests/legacy/test_filesystem.py +++ b/weave/tests/legacy/test_filesystem.py @@ -2,9 +2,9 @@ import pytest -from weave.legacy import environment +from weave.legacy import environment, errors -from ... import errors, filesystem +from ... import filesystem @pytest.fixture() diff --git a/weave/trace/op_type.py b/weave/trace/op_type.py index c7566e07756..ad447c1c4d2 100644 --- a/weave/trace/op_type.py +++ b/weave/trace/op_type.py @@ -13,7 +13,7 @@ from _ast import AsyncFunctionDef, ExceptHandler from typing import Any, Callable, Optional, Union, get_args, get_origin -from weave.legacy import artifact_fs, context_state +from weave.legacy import artifact_fs, context_state, errors from weave.trace.ipython import ( ClassNotFoundError, get_class_source, @@ -21,7 +21,7 @@ ) from weave.trace.refs import ObjectRef -from .. import errors, storage +from .. import storage from ..legacy import environment from . import serializer from .op import Op diff --git a/weave/trace/serve_fastapi.py b/weave/trace/serve_fastapi.py index 3e3bc7b7286..89ef88b1d8c 100644 --- a/weave/trace/serve_fastapi.py +++ b/weave/trace/serve_fastapi.py @@ -17,8 +17,7 @@ from weave.trace.op import Op from weave.trace.refs import ObjectRef -from .. import errors -from ..legacy import weave_pydantic +from ..legacy import errors, weave_pydantic key_cache: cache.LruTimeWindowCache[str, typing.Optional[bool]] = ( cache.LruTimeWindowCache(datetime.timedelta(minutes=5)) diff --git a/weave/util.py b/weave/util.py index 81ce7070c89..1053f197c2b 100644 --- a/weave/util.py +++ b/weave/util.py @@ -8,7 +8,7 @@ # import ipynbname import typing -from .errors import WeaveFingerprintErrorMixin +from .legacy.errors import WeaveFingerprintErrorMixin sentry_inited = False diff --git a/weave/weave_init.py b/weave/weave_init.py index 21d0e31ab6a..3d0a0233aa5 100644 --- a/weave/weave_init.py +++ b/weave/weave_init.py @@ -1,8 +1,9 @@ import typing from weave.client_context import weave_client as weave_client_context +from weave.legacy import errors -from . import errors, init_message +from . import init_message from .trace import autopatch, trace_sentry, weave_client from .trace_server import remote_http_trace_server, sqlite_trace_server diff --git a/weave/weave_internal.py b/weave/weave_internal.py index 2b6e07b294b..3e6e82a7eb3 100644 --- a/weave/weave_internal.py +++ b/weave/weave_internal.py @@ -1,8 +1,7 @@ import typing -from weave.legacy import client_interface, context_state, graph +from weave.legacy import client_interface, context_state, errors, graph -from . import errors from . import weave_types as types diff --git a/weave/weave_server.py b/weave/weave_server.py index cb77de12faf..a2684fc0aa3 100644 --- a/weave/weave_server.py +++ b/weave/weave_server.py @@ -26,7 +26,6 @@ from werkzeug.exceptions import HTTPException from weave import ( - errors, filesystem, logs, storage, @@ -36,6 +35,7 @@ context_state, engine_trace, environment, + errors, graph, registry_mem, server, diff --git a/weave/weave_types.py b/weave/weave_types.py index 039b7377c1a..3621eaa0de4 100644 --- a/weave/weave_types.py +++ b/weave/weave_types.py @@ -11,11 +11,15 @@ import pydantic from dateutil.parser import isoparse -from weave.legacy import box, context_state, mappers_python, object_type_ref_util +from weave.legacy import ( + box, + context_state, + errors, + mappers_python, + object_type_ref_util, +) from weave.legacy import timestamp as weave_timestamp -from . import errors - if typing.TYPE_CHECKING: from weave.legacy import artifact_base from weave.legacy.artifact_fs import FilesystemArtifact