diff --git a/examples/experimental/skip_test/branching_runs.ipynb b/examples/experimental/skip_test/branching_runs.ipynb index bfad154cea77..86b3c167e318 100644 --- a/examples/experimental/skip_test/branching_runs.ipynb +++ b/examples/experimental/skip_test/branching_runs.ipynb @@ -13,7 +13,7 @@ "from weave.legacy.ops_domain import RunSegment\n", "from weave.legacy import storage\n", "from weave import publish, type_of\n", - "from weave.weave_types import List\n", + "from weave.legacy.weave_types import List\n", "import typing\n", "import time\n", "import sys\n", diff --git a/mypy.ini b/mypy.ini index 3f47e1f0dd1e..b8c601a669ff 100644 --- a/mypy.ini +++ b/mypy.ini @@ -151,7 +151,7 @@ disallow_untyped_calls = False disallow_untyped_defs = False disallow_untyped_calls = False -[mypy-weave.weave_types] +[mypy-weave.legacy.weave_types] disallow_untyped_defs = False disallow_untyped_calls = False diff --git a/weave/__init__.py b/weave/__init__.py index d75cd14713be..0ed50283b77b 100644 --- a/weave/__init__.py +++ b/weave/__init__.py @@ -12,7 +12,7 @@ _loading_builtins_token = _context_state.set_loading_built_ins() -from . import weave_types as types +from weave.legacy import weave_types as types from .legacy import storage from .legacy.api import * diff --git a/weave/legacy/_dict_utils.py b/weave/legacy/_dict_utils.py index 256a973fe982..744b62474ffe 100644 --- a/weave/legacy/_dict_utils.py +++ b/weave/legacy/_dict_utils.py @@ -4,7 +4,7 @@ from weave.legacy.language_features.tagging import tag_store, tagged_value_type from weave.legacy import errors -from .. import weave_types as types +from weave.legacy import weave_types as types def typeddict_pick_output_type(input_types): diff --git a/weave/legacy/api.py b/weave/legacy/api.py index 54ad4e2fcb5b..c310b40db086 100644 --- a/weave/legacy/api.py +++ b/weave/legacy/api.py @@ -21,7 +21,7 @@ from ..trace import weave_client as _weave_client # exposed as part of api -from .. import weave_types as types +from weave.legacy import weave_types as types # needed to enable automatic numpy serialization from . import types_numpy as _types_numpy diff --git a/weave/legacy/arrow/arrow.py b/weave/legacy/arrow/arrow.py index d7f750f7caf9..0c5576eaa993 100644 --- a/weave/legacy/arrow/arrow.py +++ b/weave/legacy/arrow/arrow.py @@ -12,7 +12,7 @@ py_type = type from weave.legacy import errors -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy import artifact_fs, partial_object diff --git a/weave/legacy/arrow/arrow_tags.py b/weave/legacy/arrow/arrow_tags.py index fc53c901f290..52ba674abca2 100644 --- a/weave/legacy/arrow/arrow_tags.py +++ b/weave/legacy/arrow/arrow_tags.py @@ -3,7 +3,7 @@ import pyarrow as pa from pyarrow import compute as pc -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy.arrow import convert from weave.legacy.arrow.arrow import offsets_starting_at_zero from weave.legacy.language_features.tagging import ( diff --git a/weave/legacy/arrow/concat.py b/weave/legacy/arrow/concat.py index 4201da7d17d7..46453d7de70c 100644 --- a/weave/legacy/arrow/concat.py +++ b/weave/legacy/arrow/concat.py @@ -13,7 +13,7 @@ from pyarrow import compute as pc from weave.legacy import errors -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy.arrow.list_ import ( ArrowWeaveList, ArrowWeaveListGeneric, diff --git a/weave/legacy/arrow/constructors.py b/weave/legacy/arrow/constructors.py index b7cab73103ce..578643160c8d 100644 --- a/weave/legacy/arrow/constructors.py +++ b/weave/legacy/arrow/constructors.py @@ -4,7 +4,7 @@ import pyarrow as pa from weave.legacy import errors -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy import artifact_base, box from weave.legacy.arrow import arrow_tags, convert from weave.legacy.arrow.arrow import ArrowWeaveListType, arrow_as_array diff --git a/weave/legacy/arrow/convert.py b/weave/legacy/arrow/convert.py index 1b195a432838..d76edeaef7b7 100644 --- a/weave/legacy/arrow/convert.py +++ b/weave/legacy/arrow/convert.py @@ -5,7 +5,7 @@ from weave.legacy import api as api from weave import weave_internal -from weave import weave_types as types +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 ( ArrowWeaveListType, diff --git a/weave/legacy/arrow/list_.py b/weave/legacy/arrow/list_.py index cdd8dd1a5d76..e90c860fead6 100644 --- a/weave/legacy/arrow/list_.py +++ b/weave/legacy/arrow/list_.py @@ -13,7 +13,7 @@ from weave import ( weave_internal, ) -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy import ( errors, _dict_utils, diff --git a/weave/legacy/artifact_base.py b/weave/legacy/artifact_base.py index 02b2e35d2132..ae98ed7bc848 100644 --- a/weave/legacy/artifact_base.py +++ b/weave/legacy/artifact_base.py @@ -7,7 +7,7 @@ import typing -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy import ref_base diff --git a/weave/legacy/artifact_fs.py b/weave/legacy/artifact_fs.py index 9b5ca6a47a8b..36ab31229a8e 100644 --- a/weave/legacy/artifact_fs.py +++ b/weave/legacy/artifact_fs.py @@ -7,7 +7,7 @@ import typing from weave.legacy import errors -from weave import weave_types as types +from weave.legacy 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 from weave.trace import ref_util diff --git a/weave/legacy/artifact_local.py b/weave/legacy/artifact_local.py index 0a4e9f6ad003..a22b6ea30e9f 100644 --- a/weave/legacy/artifact_local.py +++ b/weave/legacy/artifact_local.py @@ -10,7 +10,7 @@ from datetime import datetime from weave.legacy import filesystem -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy import ( artifact_fs, artifact_wandb, diff --git a/weave/legacy/artifact_mem.py b/weave/legacy/artifact_mem.py index bf8763b9da00..3e01f70ccb39 100644 --- a/weave/legacy/artifact_mem.py +++ b/weave/legacy/artifact_mem.py @@ -1,7 +1,7 @@ import typing from . import artifact_base -from weave import weave_types as types +from weave.legacy import weave_types as types 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 575f2a3a14c4..eff48f0519db 100644 --- a/weave/legacy/artifact_wandb.py +++ b/weave/legacy/artifact_wandb.py @@ -13,7 +13,7 @@ from wandb.apis.public import api as wb_public from wandb.sdk.lib.hashutil import b64_to_hex_id, hex_to_b64_id -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy import ( filesystem, urls, diff --git a/weave/legacy/client.py b/weave/legacy/client.py index ab9ce10af258..e1a3a32ce0cd 100644 --- a/weave/legacy/client.py +++ b/weave/legacy/client.py @@ -1,4 +1,4 @@ -from weave import weave_types +from weave.legacy import weave_types from weave.legacy import storage diff --git a/weave/legacy/codify.py b/weave/legacy/codify.py index e06006e936ac..e1017261d778 100644 --- a/weave/legacy/codify.py +++ b/weave/legacy/codify.py @@ -6,7 +6,7 @@ import black -from weave import weave_types +from weave.legacy import weave_types from weave.legacy import storage, graph, registry_mem from . import codifiable_value_mixin @@ -128,7 +128,7 @@ def _try_otc_using_dataclasses(obj: typing.Any) -> typing.Optional[str]: if class_type.__module__.startswith("weave.decorator_type") and issubclass( class_type, weave_types.Type ): - qualified_classpath = "weave.weave_types" + qualified_classpath = "weave.legacy.weave_types" qualified_classname = f"type_name_to_type('{class_type.name}')" else: qualified_classpath = _module_name_corrections(class_type.__module__) diff --git a/weave/legacy/compile.py b/weave/legacy/compile.py index 760a3527ff80..1e307054bd0e 100644 --- a/weave/legacy/compile.py +++ b/weave/legacy/compile.py @@ -8,7 +8,7 @@ from weave import ( weave_internal, ) -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy import ( errors, engine_trace, diff --git a/weave/legacy/compile_domain.py b/weave/legacy/compile_domain.py index 3d9c61192203..65730e05ab3e 100644 --- a/weave/legacy/compile_domain.py +++ b/weave/legacy/compile_domain.py @@ -3,7 +3,7 @@ import graphql from weave.legacy import errors -from weave import weave_types as types +from weave.legacy 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/debug_types.py b/weave/legacy/debug_types.py index d1b71dea4197..c2a77b2c0cf2 100644 --- a/weave/legacy/debug_types.py +++ b/weave/legacy/debug_types.py @@ -1,7 +1,7 @@ import textwrap from weave.legacy.language_features.tagging import tagged_value_type -from weave.weave_types import * +from weave.legacy.weave_types import * def short_type(type: Type) -> str: diff --git a/weave/legacy/decorator_arrow_op.py b/weave/legacy/decorator_arrow_op.py index cc8bea94e338..51869d03760b 100644 --- a/weave/legacy/decorator_arrow_op.py +++ b/weave/legacy/decorator_arrow_op.py @@ -1,6 +1,6 @@ import typing -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy import op_def from weave.legacy.arrow.arrow import ArrowWeaveListType from weave.legacy.language_features.tagging import tagged_value_type diff --git a/weave/legacy/decorator_class.py b/weave/legacy/decorator_class.py index afcdc17690df..c2b2d5314d2b 100644 --- a/weave/legacy/decorator_class.py +++ b/weave/legacy/decorator_class.py @@ -2,7 +2,7 @@ import typing from weave.legacy import errors -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy import context_state, derive_op, op_def, registry_mem # Contrary to the way it is read, the weave.class() decorator runs AFTER the diff --git a/weave/legacy/decorator_op.py b/weave/legacy/decorator_op.py index e193e4b1e385..d0081d8494aa 100644 --- a/weave/legacy/decorator_op.py +++ b/weave/legacy/decorator_op.py @@ -4,7 +4,7 @@ from typing_extensions import ParamSpec -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy import context_state, derive_op, op_args, op_def, pyfunc_type_util, registry_mem if typing.TYPE_CHECKING: diff --git a/weave/legacy/decorator_type.py b/weave/legacy/decorator_type.py index 2f7ff2f0da9b..2b761f2838f1 100644 --- a/weave/legacy/decorator_type.py +++ b/weave/legacy/decorator_type.py @@ -3,7 +3,7 @@ import typing from weave.legacy import errors -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy import context_state, decorator_class, object_type_ref_util, infer_types _py_type = type diff --git a/weave/legacy/derive_op.py b/weave/legacy/derive_op.py index e591a652cc0a..dcf1010b024c 100644 --- a/weave/legacy/derive_op.py +++ b/weave/legacy/derive_op.py @@ -10,7 +10,7 @@ storage, weave_internal, ) -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy import ( errors, parallelism, diff --git a/weave/legacy/dispatch.py b/weave/legacy/dispatch.py index 9ab44a173120..39baffd75a81 100644 --- a/weave/legacy/dispatch.py +++ b/weave/legacy/dispatch.py @@ -6,7 +6,7 @@ from dataclasses import dataclass from weave.legacy import util -from weave import weave_types as types +from weave.legacy import weave_types as types 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/eager.py b/weave/legacy/eager.py index 5136297e7beb..88ea1c453b67 100644 --- a/weave/legacy/eager.py +++ b/weave/legacy/eager.py @@ -3,7 +3,7 @@ from weave.legacy import context_state, graph from .. import weave_internal -from .. import weave_types as types +from weave.legacy import weave_types as types WeaveIterObjectType = typing.TypeVar("WeaveIterObjectType") diff --git a/weave/legacy/ecosystem/langchain/lc.py b/weave/legacy/ecosystem/langchain/lc.py index 54a5b8706247..46fd02f6a656 100644 --- a/weave/legacy/ecosystem/langchain/lc.py +++ b/weave/legacy/ecosystem/langchain/lc.py @@ -46,7 +46,7 @@ from weave.legacy.artifact_fs import FilesystemArtifact from weave.legacy.ecosystem.langchain import util from weave.legacy.ops_domain import trace_tree -from weave.weave_types import Type +from weave.legacy.weave_types import Type class WeaveTracer(BaseTracer): diff --git a/weave/legacy/execute.py b/weave/legacy/execute.py index 72d7ecd97646..b4cc7a81570a 100644 --- a/weave/legacy/execute.py +++ b/weave/legacy/execute.py @@ -9,7 +9,7 @@ import typing from collections.abc import Mapping -from weave import weave_types as types +from weave.legacy import weave_types as types # Configuration # Libraries diff --git a/weave/legacy/execute_fast.py b/weave/legacy/execute_fast.py index 4bcb4e418fdd..b7331ded9985 100644 --- a/weave/legacy/execute_fast.py +++ b/weave/legacy/execute_fast.py @@ -3,7 +3,7 @@ from weave import ( weave_internal, ) -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy import ( errors, engine_trace, diff --git a/weave/legacy/file_base.py b/weave/legacy/file_base.py index 680208ab5985..ff03c072471c 100644 --- a/weave/legacy/file_base.py +++ b/weave/legacy/file_base.py @@ -2,7 +2,7 @@ import dataclasses import typing -from weave import weave_types as types +from weave.legacy import weave_types as types TRACE_EXT = "trace.json" diff --git a/weave/legacy/file_local.py b/weave/legacy/file_local.py index 07898c7152ad..e20a0a2248ba 100644 --- a/weave/legacy/file_local.py +++ b/weave/legacy/file_local.py @@ -2,7 +2,7 @@ import os import typing -from weave import weave_types as types +from weave.legacy import weave_types as types from . import file_base, file_util diff --git a/weave/legacy/gql_op_plugin.py b/weave/legacy/gql_op_plugin.py index 1068c7a87127..090a1536c409 100644 --- a/weave/legacy/gql_op_plugin.py +++ b/weave/legacy/gql_op_plugin.py @@ -1,7 +1,7 @@ import typing from dataclasses import dataclass -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy import input_provider, op_args, op_def # A GQLOutputTypeFn is a function that is called during the refinement phase of the compile pass diff --git a/weave/legacy/gql_to_weave.py b/weave/legacy/gql_to_weave.py index 51c784138682..117e3511deaa 100644 --- a/weave/legacy/gql_to_weave.py +++ b/weave/legacy/gql_to_weave.py @@ -18,7 +18,7 @@ ) from weave.legacy import errors -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy import gql_schema diff --git a/weave/legacy/graph.py b/weave/legacy/graph.py index b12d85dfdf91..9517b687b34d 100644 --- a/weave/legacy/graph.py +++ b/weave/legacy/graph.py @@ -2,7 +2,7 @@ import json import typing -from weave import weave_types +from weave.legacy import weave_types from weave.legacy import uris, errors, storage if typing.TYPE_CHECKING: diff --git a/weave/legacy/graph_debug.py b/weave/legacy/graph_debug.py index f9e5d96b4f24..d82a73536619 100644 --- a/weave/legacy/graph_debug.py +++ b/weave/legacy/graph_debug.py @@ -2,7 +2,7 @@ import textwrap import typing -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy import forward_graph, graph diff --git a/weave/legacy/graph_mapper.py b/weave/legacy/graph_mapper.py index f2c68399433f..1cf5a6c9e138 100644 --- a/weave/legacy/graph_mapper.py +++ b/weave/legacy/graph_mapper.py @@ -1,5 +1,5 @@ from weave.legacy import ref_base -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy import graph, mappers, node_ref from weave.legacy import mappers_python_def as mappers_python diff --git a/weave/legacy/infer_types.py b/weave/legacy/infer_types.py index 8a70475c7dee..9eedc3a4c03b 100644 --- a/weave/legacy/infer_types.py +++ b/weave/legacy/infer_types.py @@ -8,7 +8,7 @@ from weave.legacy import errors, graph -from .. import weave_types +from weave.legacy import weave_types class TypedDictLike: diff --git a/weave/legacy/language_autocall.py b/weave/legacy/language_autocall.py index de8301154353..73822279ed7d 100644 --- a/weave/legacy/language_autocall.py +++ b/weave/legacy/language_autocall.py @@ -15,7 +15,7 @@ import typing -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy import op_args diff --git a/weave/legacy/language_features/tagging/is_tag_getter.py b/weave/legacy/language_features/tagging/is_tag_getter.py index 5b387e7e684d..d4d6b83c4014 100644 --- a/weave/legacy/language_features/tagging/is_tag_getter.py +++ b/weave/legacy/language_features/tagging/is_tag_getter.py @@ -1,6 +1,6 @@ import typing -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy import op_args from weave.legacy.language_features.tagging import tagged_value_type diff --git a/weave/legacy/language_features/tagging/make_tag_getter_op.py b/weave/legacy/language_features/tagging/make_tag_getter_op.py index decf0ae32eb7..9cb06bd9f2ff 100644 --- a/weave/legacy/language_features/tagging/make_tag_getter_op.py +++ b/weave/legacy/language_features/tagging/make_tag_getter_op.py @@ -1,6 +1,6 @@ import typing -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy import context_state as _context_state from weave.legacy import decorator_op from weave.legacy.language_features.tagging import tag_store, tagged_value_type diff --git a/weave/legacy/language_features/tagging/opdef_util.py b/weave/legacy/language_features/tagging/opdef_util.py index f74d78956f06..f52a748414b7 100644 --- a/weave/legacy/language_features/tagging/opdef_util.py +++ b/weave/legacy/language_features/tagging/opdef_util.py @@ -1,6 +1,6 @@ import typing -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy.language_features.tagging import tagged_value_type if typing.TYPE_CHECKING: diff --git a/weave/legacy/language_features/tagging/process_opdef_output_type.py b/weave/legacy/language_features/tagging/process_opdef_output_type.py index a445e7485279..b9e1a65b4cc8 100644 --- a/weave/legacy/language_features/tagging/process_opdef_output_type.py +++ b/weave/legacy/language_features/tagging/process_opdef_output_type.py @@ -6,7 +6,7 @@ import typing from weave.legacy import registry_mem -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy import graph from weave.legacy.language_features.tagging.opdef_util import ( should_flow_tags, diff --git a/weave/legacy/language_features/tagging/process_opdef_resolve_fn.py b/weave/legacy/language_features/tagging/process_opdef_resolve_fn.py index a4f474357ceb..720c8db3931b 100644 --- a/weave/legacy/language_features/tagging/process_opdef_resolve_fn.py +++ b/weave/legacy/language_features/tagging/process_opdef_resolve_fn.py @@ -11,7 +11,7 @@ import typing_extensions from pyarrow import compute as pc -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy import box from weave.legacy.arrow.arrow_tags import awl_add_arrow_tags from weave.legacy.arrow.list_ import ArrowWeaveList diff --git a/weave/legacy/language_features/tagging/tag_store.py b/weave/legacy/language_features/tagging/tag_store.py index c39c404e35fc..f6fea94eb79d 100644 --- a/weave/legacy/language_features/tagging/tag_store.py +++ b/weave/legacy/language_features/tagging/tag_store.py @@ -23,7 +23,7 @@ from contextlib import contextmanager from weave.legacy import errors -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy import engine_trace, box statsd = engine_trace.statsd() # type: ignore diff --git a/weave/legacy/language_features/tagging/tagged_value_type.py b/weave/legacy/language_features/tagging/tagged_value_type.py index 533e0f4af388..9ae900a28351 100644 --- a/weave/legacy/language_features/tagging/tagged_value_type.py +++ b/weave/legacy/language_features/tagging/tagged_value_type.py @@ -31,7 +31,7 @@ import typing from weave.legacy import errors -from weave import weave_types as types +from weave.legacy 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/language_features/tagging/tagged_value_type_helpers.py b/weave/legacy/language_features/tagging/tagged_value_type_helpers.py index 72672f13115b..a5b1a83f4462 100644 --- a/weave/legacy/language_features/tagging/tagged_value_type_helpers.py +++ b/weave/legacy/language_features/tagging/tagged_value_type_helpers.py @@ -1,6 +1,6 @@ import typing -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy.language_features.tagging import tagged_value_type diff --git a/weave/legacy/language_features/tagging/tagging_op_logic.py b/weave/legacy/language_features/tagging/tagging_op_logic.py index 7fc16b4fb3b1..2c2bcc041381 100644 --- a/weave/legacy/language_features/tagging/tagging_op_logic.py +++ b/weave/legacy/language_features/tagging/tagging_op_logic.py @@ -1,4 +1,4 @@ -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy.language_features.tagging.tagged_value_type import TaggedValueType diff --git a/weave/legacy/language_features/tagging/tagging_ops.py b/weave/legacy/language_features/tagging/tagging_ops.py index 9033b0361230..abb6dfeb9aa1 100644 --- a/weave/legacy/language_features/tagging/tagging_ops.py +++ b/weave/legacy/language_features/tagging/tagging_ops.py @@ -1,4 +1,4 @@ -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy import decorator_op from weave.legacy.language_features.tagging import tagging_op_logic diff --git a/weave/legacy/language_nullability.py b/weave/legacy/language_nullability.py index 0cb5bbd9e9f1..2541721b19a5 100644 --- a/weave/legacy/language_nullability.py +++ b/weave/legacy/language_nullability.py @@ -1,6 +1,6 @@ import typing -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy import box from weave.legacy.language_features.tagging import tagged_value_type diff --git a/weave/legacy/make_type.py b/weave/legacy/make_type.py index 3eb3a5f961b4..765bc06636dc 100644 --- a/weave/legacy/make_type.py +++ b/weave/legacy/make_type.py @@ -1,5 +1,5 @@ from .. import weave_internal -from .. import weave_types as types +from weave.legacy import weave_types as types # TODO: Consider if this should accept a *args, **kwargs? diff --git a/weave/legacy/mappers.py b/weave/legacy/mappers.py index 3ca05e17439e..b7a25b0e6057 100644 --- a/weave/legacy/mappers.py +++ b/weave/legacy/mappers.py @@ -1,7 +1,7 @@ import typing if typing.TYPE_CHECKING: - from weave import weave_types as types + from weave.legacy import weave_types as types from weave.legacy import artifact_local diff --git a/weave/legacy/mappers_arrow.py b/weave/legacy/mappers_arrow.py index 7c47d34b568d..f74e1ca2ba59 100644 --- a/weave/legacy/mappers_arrow.py +++ b/weave/legacy/mappers_arrow.py @@ -6,7 +6,7 @@ import pyarrow as pa from weave.legacy import errors -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy import ( arrow_util, artifact_base, diff --git a/weave/legacy/mappers_gql.py b/weave/legacy/mappers_gql.py index 4a4ce875af4a..1f7da87687e5 100644 --- a/weave/legacy/mappers_gql.py +++ b/weave/legacy/mappers_gql.py @@ -1,7 +1,7 @@ import json from weave.legacy import errors -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy import gql_json_cache, mappers from weave.legacy.mappers_weave import UnionMapper from weave.legacy.partial_object import PartialObjectType diff --git a/weave/legacy/mappers_publisher.py b/weave/legacy/mappers_publisher.py index b80f2d1c357a..667d47a54143 100644 --- a/weave/legacy/mappers_publisher.py +++ b/weave/legacy/mappers_publisher.py @@ -4,7 +4,7 @@ from weave.legacy import storage from weave import weave_internal -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy.node_ref import ref_to_node # from weave.legacy.ops_primitives import weave_api diff --git a/weave/legacy/mappers_python.py b/weave/legacy/mappers_python.py index 53aec98ab8fe..ad3f240eb357 100644 --- a/weave/legacy/mappers_python.py +++ b/weave/legacy/mappers_python.py @@ -3,7 +3,7 @@ import typing if typing.TYPE_CHECKING: - from weave import weave_types + from weave.legacy import weave_types from weave.legacy import artifact_base, mappers diff --git a/weave/legacy/mappers_python_def.py b/weave/legacy/mappers_python_def.py index b78e684ca316..5a1ee099220e 100644 --- a/weave/legacy/mappers_python_def.py +++ b/weave/legacy/mappers_python_def.py @@ -5,7 +5,7 @@ import typing from weave.legacy import storage -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy import ( artifact_fs, box, diff --git a/weave/legacy/mappers_weave.py b/weave/legacy/mappers_weave.py index 41c0fcbd2c96..133e1456ccef 100644 --- a/weave/legacy/mappers_weave.py +++ b/weave/legacy/mappers_weave.py @@ -1,6 +1,6 @@ import typing -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy import mappers from weave.legacy.partial_object import PartialObjectType diff --git a/weave/legacy/monitoring/openai/models.py b/weave/legacy/monitoring/openai/models.py index e5ab01964353..d9688f8b2813 100644 --- a/weave/legacy/monitoring/openai/models.py +++ b/weave/legacy/monitoring/openai/models.py @@ -7,7 +7,7 @@ ) from pydantic import BaseModel, Field -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy.monitoring import monitor diff --git a/weave/legacy/object_context.py b/weave/legacy/object_context.py index b8d916063e27..3ed119fa154c 100644 --- a/weave/legacy/object_context.py +++ b/weave/legacy/object_context.py @@ -13,7 +13,7 @@ if typing.TYPE_CHECKING: from weave.legacy import ref_base -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy import box, uris diff --git a/weave/legacy/op_args.py b/weave/legacy/op_args.py index 5487ed1f530d..15fae9a443be 100644 --- a/weave/legacy/op_args.py +++ b/weave/legacy/op_args.py @@ -1,7 +1,7 @@ import typing from dataclasses import dataclass -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy import debug_types BT = typing.TypeVar("BT") diff --git a/weave/legacy/op_def.py b/weave/legacy/op_def.py index 8c63b15faaac..7581773e09fe 100644 --- a/weave/legacy/op_def.py +++ b/weave/legacy/op_def.py @@ -9,7 +9,7 @@ from weave import ( weave_internal, ) -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy import ( errors, context_state, diff --git a/weave/legacy/op_def_type.py b/weave/legacy/op_def_type.py index bb2648992604..8fd598aa0ca1 100644 --- a/weave/legacy/op_def_type.py +++ b/weave/legacy/op_def_type.py @@ -12,7 +12,7 @@ from typing import Any from weave.legacy import storage -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy import ( artifact_fs, artifact_local, diff --git a/weave/legacy/ops_arrow/arraylist_ops.py b/weave/legacy/ops_arrow/arraylist_ops.py index 02c519fc9e75..cd0d4752f948 100644 --- a/weave/legacy/ops_arrow/arraylist_ops.py +++ b/weave/legacy/ops_arrow/arraylist_ops.py @@ -3,7 +3,7 @@ import pyarrow as pa from pyarrow import compute as pc -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy.arrow.arrow import ArrowWeaveListType, arrow_as_array from weave.legacy.arrow.list_ import ArrowWeaveList from weave.legacy.decorator_arrow_op import arrow_op diff --git a/weave/legacy/ops_arrow/boolean.py b/weave/legacy/ops_arrow/boolean.py index 3ad4caa354bb..68b09327c61e 100644 --- a/weave/legacy/ops_arrow/boolean.py +++ b/weave/legacy/ops_arrow/boolean.py @@ -1,7 +1,7 @@ import pyarrow as pa import pyarrow.compute as pc -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy.arrow.list_ import ArrowWeaveList, ArrowWeaveListType from weave.legacy.decorator_arrow_op import arrow_op from weave.legacy.decorator_op import op diff --git a/weave/legacy/ops_arrow/convert_ops.py b/weave/legacy/ops_arrow/convert_ops.py index af7c3fc72730..b2538128b424 100644 --- a/weave/legacy/ops_arrow/convert_ops.py +++ b/weave/legacy/ops_arrow/convert_ops.py @@ -1,4 +1,4 @@ -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy.api import op from weave.legacy.arrow import convert from weave.legacy.arrow.arrow import ArrowWeaveListType diff --git a/weave/legacy/ops_arrow/date.py b/weave/legacy/ops_arrow/date.py index f8b3d36c2812..9d93ee161d64 100644 --- a/weave/legacy/ops_arrow/date.py +++ b/weave/legacy/ops_arrow/date.py @@ -3,7 +3,7 @@ import pyarrow as pa import pyarrow.compute as pc -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy.api import op from weave.legacy import timestamp as weave_timestamp from weave.legacy.arrow.list_ import ArrowWeaveList, ArrowWeaveListType diff --git a/weave/legacy/ops_arrow/dict.py b/weave/legacy/ops_arrow/dict.py index ab3b90cb4b39..996ef2e4ffc0 100644 --- a/weave/legacy/ops_arrow/dict.py +++ b/weave/legacy/ops_arrow/dict.py @@ -3,7 +3,7 @@ import numpy as np import pyarrow as pa -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy import _dict_utils from weave.legacy.arrow import convert from weave.legacy.arrow.arrow import arrow_as_array, offsets_starting_at_zero diff --git a/weave/legacy/ops_arrow/list_join.py b/weave/legacy/ops_arrow/list_join.py index 3fd533ed54eb..1f026ab61e9d 100644 --- a/weave/legacy/ops_arrow/list_join.py +++ b/weave/legacy/ops_arrow/list_join.py @@ -5,7 +5,7 @@ import pyarrow.compute as pc from weave.legacy import engine_trace -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy.api import op from weave.legacy import graph from weave.legacy.arrow import convert diff --git a/weave/legacy/ops_arrow/list_ops.py b/weave/legacy/ops_arrow/list_ops.py index 7e9308f3330e..1f034738bf99 100644 --- a/weave/legacy/ops_arrow/list_ops.py +++ b/weave/legacy/ops_arrow/list_ops.py @@ -7,7 +7,7 @@ import pyarrow as pa import pyarrow.compute as pc -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy.api import op, type_of from weave.legacy import op_args, op_def from weave.legacy.arrow import arrow_tags, convert diff --git a/weave/legacy/ops_arrow/list_range.py b/weave/legacy/ops_arrow/list_range.py index 809faae29187..064e8e29a224 100644 --- a/weave/legacy/ops_arrow/list_range.py +++ b/weave/legacy/ops_arrow/list_range.py @@ -2,7 +2,7 @@ import pyarrow as pa -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy.api import op from weave.legacy.arrow.list_ import ArrowWeaveList diff --git a/weave/legacy/ops_arrow/number.py b/weave/legacy/ops_arrow/number.py index 3327c4222c39..071b4d37ec98 100644 --- a/weave/legacy/ops_arrow/number.py +++ b/weave/legacy/ops_arrow/number.py @@ -4,7 +4,7 @@ import pyarrow as pa import pyarrow.compute as pc -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy.api import op from weave.legacy import timestamp as weave_timestamp from weave.legacy.arrow.list_ import ArrowWeaveList, ArrowWeaveListType diff --git a/weave/legacy/ops_arrow/obj.py b/weave/legacy/ops_arrow/obj.py index 103b3e0da52a..7e38e90297be 100644 --- a/weave/legacy/ops_arrow/obj.py +++ b/weave/legacy/ops_arrow/obj.py @@ -1,4 +1,4 @@ -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy.arrow.list_ import ArrowWeaveList, ArrowWeaveListType from weave.legacy.decorator_arrow_op import arrow_op from weave.legacy.ops_primitives import obj as primitives_obj diff --git a/weave/legacy/ops_arrow/ref_ops.py b/weave/legacy/ops_arrow/ref_ops.py index b5edd10d227b..d40ee05949c1 100644 --- a/weave/legacy/ops_arrow/ref_ops.py +++ b/weave/legacy/ops_arrow/ref_ops.py @@ -1,7 +1,7 @@ import pyarrow as pa import pyarrow.compute as pc -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy.arrow.list_ import ArrowWeaveList, ArrowWeaveListType from weave.legacy.decorator_arrow_op import arrow_op from weave.legacy.decorator_op import op diff --git a/weave/legacy/ops_arrow/string.py b/weave/legacy/ops_arrow/string.py index a74db7d2550a..491ad640a6e4 100644 --- a/weave/legacy/ops_arrow/string.py +++ b/weave/legacy/ops_arrow/string.py @@ -3,7 +3,7 @@ import pyarrow as pa import pyarrow.compute as pc -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy.api import op from weave.legacy.arrow.arrow import ArrowWeaveListType, offsets_starting_at_zero from weave.legacy.arrow.list_ import ArrowWeaveList, ArrowWeaveListType diff --git a/weave/legacy/ops_arrow/util.py b/weave/legacy/ops_arrow/util.py index e31000a9fb07..5d515d9984a5 100644 --- a/weave/legacy/ops_arrow/util.py +++ b/weave/legacy/ops_arrow/util.py @@ -3,7 +3,7 @@ import pyarrow as pa from pyarrow import compute as pc -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy import graph diff --git a/weave/legacy/ops_arrow/vectorize.py b/weave/legacy/ops_arrow/vectorize.py index 5974c3e14028..107666929e14 100644 --- a/weave/legacy/ops_arrow/vectorize.py +++ b/weave/legacy/ops_arrow/vectorize.py @@ -11,7 +11,7 @@ weave_internal, ) from weave.legacy import errors,weavify, registry_mem -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy.api import op, use from weave.legacy import dispatch, graph, graph_debug, op_args, op_def from weave.legacy.arrow import convert diff --git a/weave/legacy/ops_domain/artifact_alias_ops.py b/weave/legacy/ops_domain/artifact_alias_ops.py index 4d93dbfbc071..140ffadfbafa 100644 --- a/weave/legacy/ops_domain/artifact_alias_ops.py +++ b/weave/legacy/ops_domain/artifact_alias_ops.py @@ -1,4 +1,4 @@ -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy.api import op from weave.legacy.gql_op_plugin import wb_gql_op_plugin from weave.legacy.language_features.tagging.make_tag_getter_op import ( diff --git a/weave/legacy/ops_domain/artifact_collection_ops.py b/weave/legacy/ops_domain/artifact_collection_ops.py index ed3f2d705fd9..aaf6231a37ed 100644 --- a/weave/legacy/ops_domain/artifact_collection_ops.py +++ b/weave/legacy/ops_domain/artifact_collection_ops.py @@ -2,7 +2,7 @@ import urllib from weave.legacy import errors -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy.api import op from weave.legacy.gql_op_plugin import wb_gql_op_plugin from weave.legacy.ops_domain import wb_domain_types as wdt diff --git a/weave/legacy/ops_domain/artifact_membership_ops.py b/weave/legacy/ops_domain/artifact_membership_ops.py index ed17d75006c1..ab0422653041 100644 --- a/weave/legacy/ops_domain/artifact_membership_ops.py +++ b/weave/legacy/ops_domain/artifact_membership_ops.py @@ -1,6 +1,6 @@ import urllib -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy.api import op from weave.legacy.gql_op_plugin import wb_gql_op_plugin from weave.legacy.ops_domain import wb_domain_types as wdt diff --git a/weave/legacy/ops_domain/artifact_type_ops.py b/weave/legacy/ops_domain/artifact_type_ops.py index d29445538d7a..4b62b70929e2 100644 --- a/weave/legacy/ops_domain/artifact_type_ops.py +++ b/weave/legacy/ops_domain/artifact_type_ops.py @@ -1,6 +1,6 @@ import typing -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy.api import op from weave.legacy.gql_op_plugin import wb_gql_op_plugin from weave.legacy.ops_domain import wb_domain_types as wdt diff --git a/weave/legacy/ops_domain/artifact_version_ops.py b/weave/legacy/ops_domain/artifact_version_ops.py index ada1ba792014..aa816e3f716a 100644 --- a/weave/legacy/ops_domain/artifact_version_ops.py +++ b/weave/legacy/ops_domain/artifact_version_ops.py @@ -3,7 +3,7 @@ from urllib.parse import quote from weave.legacy import errors -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy.api import op from weave.legacy import artifact_fs, artifact_wandb, input_provider from weave.legacy.gql_op_plugin import wb_gql_op_plugin diff --git a/weave/legacy/ops_domain/entity_ops.py b/weave/legacy/ops_domain/entity_ops.py index 8a6ff5986226..89b45216863f 100644 --- a/weave/legacy/ops_domain/entity_ops.py +++ b/weave/legacy/ops_domain/entity_ops.py @@ -1,4 +1,4 @@ -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy.api import op from weave.legacy.gql_op_plugin import wb_gql_op_plugin from weave.legacy.language_features.tagging.make_tag_getter_op import ( diff --git a/weave/legacy/ops_domain/org_ops.py b/weave/legacy/ops_domain/org_ops.py index 1abeb1dfbdde..c0ce7588ba02 100644 --- a/weave/legacy/ops_domain/org_ops.py +++ b/weave/legacy/ops_domain/org_ops.py @@ -1,4 +1,4 @@ -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy.ops_domain import wb_domain_types as wdt from weave.legacy.ops_domain.wandb_domain_gql import ( gql_connection_op, diff --git a/weave/legacy/ops_domain/project_ops.py b/weave/legacy/ops_domain/project_ops.py index 22ebabcd6b7f..b4463818c8ad 100644 --- a/weave/legacy/ops_domain/project_ops.py +++ b/weave/legacy/ops_domain/project_ops.py @@ -2,7 +2,7 @@ import typing from weave.legacy import errors -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy.api import op from weave.legacy import input_provider from weave.legacy.gql_op_plugin import wb_gql_op_plugin diff --git a/weave/legacy/ops_domain/repo_insight_ops.py b/weave/legacy/ops_domain/repo_insight_ops.py index d03aaa61cc6a..5baa89dec295 100644 --- a/weave/legacy/ops_domain/repo_insight_ops.py +++ b/weave/legacy/ops_domain/repo_insight_ops.py @@ -2,7 +2,7 @@ import json from weave.legacy import errors -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy.api import op from weave.legacy.gql_json_cache import use_json from weave.legacy.gql_op_plugin import wb_gql_op_plugin diff --git a/weave/legacy/ops_domain/report_ops.py b/weave/legacy/ops_domain/report_ops.py index fe3c39e80c58..f0f0db1a61d1 100644 --- a/weave/legacy/ops_domain/report_ops.py +++ b/weave/legacy/ops_domain/report_ops.py @@ -3,7 +3,7 @@ import urllib from weave.legacy import errors -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy.api import op from weave.legacy.gql_op_plugin import wb_gql_op_plugin from weave.legacy.ops_domain import wb_domain_types as wdt 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 c1e6f7a1f0fb..3712e488bfc5 100644 --- a/weave/legacy/ops_domain/run_history/history_op_common.py +++ b/weave/legacy/ops_domain/run_history/history_op_common.py @@ -4,7 +4,7 @@ import pyarrow as pa from pyarrow import parquet as pq -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy.api import use from weave.legacy import ( util, diff --git a/weave/legacy/ops_domain/run_history/run_history_v1_legacy_ops.py b/weave/legacy/ops_domain/run_history/run_history_v1_legacy_ops.py index 782017fd1ea2..d12822b462b9 100644 --- a/weave/legacy/ops_domain/run_history/run_history_v1_legacy_ops.py +++ b/weave/legacy/ops_domain/run_history/run_history_v1_legacy_ops.py @@ -3,7 +3,7 @@ import pyarrow as pa from weave.legacy import engine_trace -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy.api import op from weave.legacy import gql_json_cache from weave.legacy.gql_op_plugin import wb_gql_op_plugin diff --git a/weave/legacy/ops_domain/run_history/run_history_v2_parquet_media.py b/weave/legacy/ops_domain/run_history/run_history_v2_parquet_media.py index 540b068fa54a..db2c0a7a50f6 100644 --- a/weave/legacy/ops_domain/run_history/run_history_v2_parquet_media.py +++ b/weave/legacy/ops_domain/run_history/run_history_v2_parquet_media.py @@ -7,7 +7,7 @@ import pyarrow as pa from weave.legacy import engine_trace -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy.api import op, use from weave.legacy import artifact_mem, gql_json_cache from weave.legacy.arrow import convert 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 b39fce58054a..0b7750ddf1b2 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 @@ -6,7 +6,7 @@ import pyarrow as pa from weave.legacy import errors -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy.api import op from weave.legacy import ( engine_trace, diff --git a/weave/legacy/ops_domain/run_ops.py b/weave/legacy/ops_domain/run_ops.py index 4c73766d9a47..542f21fb6658 100644 --- a/weave/legacy/ops_domain/run_ops.py +++ b/weave/legacy/ops_domain/run_ops.py @@ -38,7 +38,7 @@ import typing from weave.legacy import engine_trace -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy.api import op from weave.legacy import compile_table from weave.legacy.gql_op_plugin import wb_gql_op_plugin diff --git a/weave/legacy/ops_domain/run_queue_ops.py b/weave/legacy/ops_domain/run_queue_ops.py index d0f7c72d1855..4211cfdb5cdc 100644 --- a/weave/legacy/ops_domain/run_queue_ops.py +++ b/weave/legacy/ops_domain/run_queue_ops.py @@ -1,6 +1,6 @@ import json -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy.api import op from weave.legacy.gql_op_plugin import wb_gql_op_plugin from weave.legacy.language_features.tagging.make_tag_getter_op import ( diff --git a/weave/legacy/ops_domain/run_segment.py b/weave/legacy/ops_domain/run_segment.py index 02d09567744a..9dff1c01eaaf 100644 --- a/weave/legacy/ops_domain/run_segment.py +++ b/weave/legacy/ops_domain/run_segment.py @@ -3,7 +3,7 @@ from typing import Optional, cast import weave -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy.api import Node, get, use from weave.legacy import context_state as _context from weave.legacy import panels diff --git a/weave/legacy/ops_domain/stream_table_ops.py b/weave/legacy/ops_domain/stream_table_ops.py index ca9c867ebd6f..bc750f574e51 100644 --- a/weave/legacy/ops_domain/stream_table_ops.py +++ b/weave/legacy/ops_domain/stream_table_ops.py @@ -1,4 +1,4 @@ -from weave import weave_types +from weave.legacy import weave_types from weave.legacy.api import op from weave.legacy import compile, op_def from weave.legacy.arrow.arrow import ArrowWeaveListType diff --git a/weave/legacy/ops_domain/table.py b/weave/legacy/ops_domain/table.py index 1f295cf62b52..7f4fbf91daed 100644 --- a/weave/legacy/ops_domain/table.py +++ b/weave/legacy/ops_domain/table.py @@ -6,7 +6,7 @@ import typing from weave import weave_internal -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy.api import op, weave_class from weave.legacy import ( artifact_fs, diff --git a/weave/legacy/ops_domain/trace_tree.py b/weave/legacy/ops_domain/trace_tree.py index 5a8487652f6a..595916d1028e 100644 --- a/weave/legacy/ops_domain/trace_tree.py +++ b/weave/legacy/ops_domain/trace_tree.py @@ -13,7 +13,7 @@ from weave.legacy import api as weave from weave.legacy import stream_data_interfaces -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy import op_def from weave.legacy.decorator_op import op diff --git a/weave/legacy/ops_domain/user_ops.py b/weave/legacy/ops_domain/user_ops.py index f9b77f4f4f24..0c6527eea79e 100644 --- a/weave/legacy/ops_domain/user_ops.py +++ b/weave/legacy/ops_domain/user_ops.py @@ -1,4 +1,4 @@ -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy.api import op from weave.legacy.gql_op_plugin import wb_gql_op_plugin from weave.legacy.language_features.tagging.make_tag_getter_op import ( diff --git a/weave/legacy/ops_domain/wandb_domain_gql.py b/weave/legacy/ops_domain/wandb_domain_gql.py index 9cb25156608d..554e52f06517 100644 --- a/weave/legacy/ops_domain/wandb_domain_gql.py +++ b/weave/legacy/ops_domain/wandb_domain_gql.py @@ -4,7 +4,7 @@ import pyarrow as pa -from weave import weave_types +from weave.legacy import weave_types from weave.legacy.api import op from weave.legacy import errors, gql_op_plugin, op_def, partial_object from weave.legacy.decorator_arrow_op import arrow_op diff --git a/weave/legacy/ops_domain/wb_domain_types.py b/weave/legacy/ops_domain/wb_domain_types.py index df20f7a69bb6..b1bf98bef0dc 100644 --- a/weave/legacy/ops_domain/wb_domain_types.py +++ b/weave/legacy/ops_domain/wb_domain_types.py @@ -1,6 +1,6 @@ import typing -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy.decorator_type import type as weave_type from weave.legacy.partial_object import ( PartialObject, diff --git a/weave/legacy/ops_domain/wb_util.py b/weave/legacy/ops_domain/wb_util.py index ccda04fdcb9a..8ba2582a2cae 100644 --- a/weave/legacy/ops_domain/wb_util.py +++ b/weave/legacy/ops_domain/wb_util.py @@ -2,7 +2,7 @@ from dataclasses import dataclass from urllib import parse -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy import artifact_fs, decorator_type from weave.legacy.artifact_wandb import ( WandbArtifact, diff --git a/weave/legacy/ops_domain/wbgqlquery_op.py b/weave/legacy/ops_domain/wbgqlquery_op.py index e16da74c8300..4841ee249e32 100644 --- a/weave/legacy/ops_domain/wbgqlquery_op.py +++ b/weave/legacy/ops_domain/wbgqlquery_op.py @@ -2,7 +2,7 @@ import typing from weave.legacy import errors -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy.api import op from weave.legacy import engine_trace, environment, mappers_gql, partial_object from weave.legacy.language_features.tagging import tagged_value_type diff --git a/weave/legacy/ops_primitives/_dict_utils.py b/weave/legacy/ops_primitives/_dict_utils.py index 16b44d7b1351..066c47b86164 100644 --- a/weave/legacy/ops_primitives/_dict_utils.py +++ b/weave/legacy/ops_primitives/_dict_utils.py @@ -1,7 +1,7 @@ import typing from weave.legacy import errors -from weave import weave_types as types +from weave.legacy 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/any.py b/weave/legacy/ops_primitives/any.py index c678d5eabb87..f1895ae6c2bf 100644 --- a/weave/legacy/ops_primitives/any.py +++ b/weave/legacy/ops_primitives/any.py @@ -1,4 +1,4 @@ -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy.decorator_op import op diff --git a/weave/legacy/ops_primitives/boolean.py b/weave/legacy/ops_primitives/boolean.py index 531faf430767..29c6d1ab2837 100644 --- a/weave/legacy/ops_primitives/boolean.py +++ b/weave/legacy/ops_primitives/boolean.py @@ -1,6 +1,6 @@ import typing -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy.api import op, weave_class from weave.legacy import dispatch from weave.legacy.ops_primitives.dict import dict_ diff --git a/weave/legacy/ops_primitives/date.py b/weave/legacy/ops_primitives/date.py index 073014b593d2..08a5083bfa84 100644 --- a/weave/legacy/ops_primitives/date.py +++ b/weave/legacy/ops_primitives/date.py @@ -4,7 +4,7 @@ import dateutil import dateutil.parser -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy.api import op, type diff --git a/weave/legacy/ops_primitives/dict.py b/weave/legacy/ops_primitives/dict.py index 9d6b76ebd989..cc6e2a252333 100644 --- a/weave/legacy/ops_primitives/dict.py +++ b/weave/legacy/ops_primitives/dict.py @@ -1,6 +1,6 @@ import typing -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy._dict_utils import typeddict_pick_output_type from weave.legacy.decorator_class import weave_class from weave.legacy.decorator_op import op diff --git a/weave/legacy/ops_primitives/file.py b/weave/legacy/ops_primitives/file.py index 19d97a3b49a8..75d37ea08db8 100644 --- a/weave/legacy/ops_primitives/file.py +++ b/weave/legacy/ops_primitives/file.py @@ -3,7 +3,7 @@ from weave.legacy import environment as weave_env from weave.legacy import errors -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy.api import op from weave.legacy import file_base, wandb_file_manager from weave.legacy.artifact_fs import FilesystemArtifactDir, FilesystemArtifactFile diff --git a/weave/legacy/ops_primitives/file_local.py b/weave/legacy/ops_primitives/file_local.py index f6e2a29f2065..022bf141e19b 100644 --- a/weave/legacy/ops_primitives/file_local.py +++ b/weave/legacy/ops_primitives/file_local.py @@ -2,7 +2,7 @@ import typing from weave.legacy import environment -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy.api import op from weave.legacy import file_local diff --git a/weave/legacy/ops_primitives/html.py b/weave/legacy/ops_primitives/html.py index 358b9e7d0dd8..2103ff694287 100644 --- a/weave/legacy/ops_primitives/html.py +++ b/weave/legacy/ops_primitives/html.py @@ -1,7 +1,7 @@ import dataclasses from weave.legacy import api as weave -from weave import weave_types as types +from weave.legacy import weave_types as types class HtmlType(types.Type): diff --git a/weave/legacy/ops_primitives/image.py b/weave/legacy/ops_primitives/image.py index 64ea6ace2d55..f44f14357add 100644 --- a/weave/legacy/ops_primitives/image.py +++ b/weave/legacy/ops_primitives/image.py @@ -6,7 +6,7 @@ import PIL.Image from weave.legacy import api as weave -from weave import weave_types as types +from weave.legacy import weave_types as types class ImageType(types.Type): diff --git a/weave/legacy/ops_primitives/list_.py b/weave/legacy/ops_primitives/list_.py index d2aab966eef5..e61826f6003b 100644 --- a/weave/legacy/ops_primitives/list_.py +++ b/weave/legacy/ops_primitives/list_.py @@ -7,7 +7,7 @@ import pandas as pd from weave.legacy import storage -from weave import weave_types as types +from weave.legacy import weave_types as types 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 diff --git a/weave/legacy/ops_primitives/list_tag_getters.py b/weave/legacy/ops_primitives/list_tag_getters.py index 7c91cd21f8c0..61e57c3ae934 100644 --- a/weave/legacy/ops_primitives/list_tag_getters.py +++ b/weave/legacy/ops_primitives/list_tag_getters.py @@ -1,4 +1,4 @@ -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy.language_features.tagging import make_tag_getter_op group_tag_getter_op = make_tag_getter_op.make_tag_getter_op( diff --git a/weave/legacy/ops_primitives/markdown.py b/weave/legacy/ops_primitives/markdown.py index 1f685c652798..ad3822dfdfc2 100644 --- a/weave/legacy/ops_primitives/markdown.py +++ b/weave/legacy/ops_primitives/markdown.py @@ -1,7 +1,7 @@ import dataclasses from weave.legacy import api as weave -from weave import weave_types as types +from weave.legacy import weave_types as types class MarkdownType(types.Type): diff --git a/weave/legacy/ops_primitives/number.py b/weave/legacy/ops_primitives/number.py index bddd25b7fca0..2cb4aec12541 100644 --- a/weave/legacy/ops_primitives/number.py +++ b/weave/legacy/ops_primitives/number.py @@ -4,7 +4,7 @@ import numpy as np -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy.api import op, weave_class from weave.legacy import timestamp as weave_timestamp diff --git a/weave/legacy/ops_primitives/number_bin.py b/weave/legacy/ops_primitives/number_bin.py index 5213ce95d217..c06de46703d7 100644 --- a/weave/legacy/ops_primitives/number_bin.py +++ b/weave/legacy/ops_primitives/number_bin.py @@ -1,12 +1,12 @@ import math -from weave import weave_types as types +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 import date from weave.legacy.ops_primitives.dict import dict_ from weave.weave_internal import call_fn, define_fn, make_const_node -from weave.weave_types import Function, NumberBinType +from weave.legacy.weave_types import Function, NumberBinType @op( diff --git a/weave/legacy/ops_primitives/obj.py b/weave/legacy/ops_primitives/obj.py index b05ae9a9d28a..615fe8eea3f0 100644 --- a/weave/legacy/ops_primitives/obj.py +++ b/weave/legacy/ops_primitives/obj.py @@ -1,7 +1,7 @@ import typing from weave.legacy import codify -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy.api import op, weave_class diff --git a/weave/legacy/ops_primitives/op_def.py b/weave/legacy/ops_primitives/op_def.py index 48e4253c6dd2..81caf0be0e28 100644 --- a/weave/legacy/ops_primitives/op_def.py +++ b/weave/legacy/ops_primitives/op_def.py @@ -1,5 +1,5 @@ from weave.legacy import api as weave -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy.op_def import OpDef from weave.legacy.op_def_type import OpDefType diff --git a/weave/legacy/ops_primitives/pandas_.py b/weave/legacy/ops_primitives/pandas_.py index 70b15467e9d0..97a9f30c2dba 100644 --- a/weave/legacy/ops_primitives/pandas_.py +++ b/weave/legacy/ops_primitives/pandas_.py @@ -9,7 +9,7 @@ import pyarrow.parquet as pq from weave.legacy import errors -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy.api import op, weave_class from weave.legacy import box, file_base, graph, mappers_python from weave.legacy.language_features.tagging import tag_store, tagged_value_type diff --git a/weave/legacy/ops_primitives/random_junk.py b/weave/legacy/ops_primitives/random_junk.py index b1bc875fd6a4..e77ffe0a48b5 100644 --- a/weave/legacy/ops_primitives/random_junk.py +++ b/weave/legacy/ops_primitives/random_junk.py @@ -1,7 +1,7 @@ # Ideas for ops, but not production ready. from weave.legacy import api as api -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy.api import op, weave_class op( diff --git a/weave/legacy/ops_primitives/set_.py b/weave/legacy/ops_primitives/set_.py index 6786c7c3f4fe..d64e7e9f8459 100644 --- a/weave/legacy/ops_primitives/set_.py +++ b/weave/legacy/ops_primitives/set_.py @@ -1,4 +1,4 @@ -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy.decorators import op diff --git a/weave/legacy/ops_primitives/sql.py b/weave/legacy/ops_primitives/sql.py index 3e179f727d24..7c05a41a2137 100644 --- a/weave/legacy/ops_primitives/sql.py +++ b/weave/legacy/ops_primitives/sql.py @@ -2,7 +2,7 @@ import functools import math -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy.api import op, weave_class from weave.legacy import decorator_type from weave.legacy.language_features.tagging import tagged_value_type diff --git a/weave/legacy/ops_primitives/string.py b/weave/legacy/ops_primitives/string.py index fbfa4aaec974..db86ae6d2336 100644 --- a/weave/legacy/ops_primitives/string.py +++ b/weave/legacy/ops_primitives/string.py @@ -4,7 +4,7 @@ import numpy as np -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy.api import op, weave_class diff --git a/weave/legacy/ops_primitives/test_list.py b/weave/legacy/ops_primitives/test_list.py index a24786177497..2856054b5ab6 100644 --- a/weave/legacy/ops_primitives/test_list.py +++ b/weave/legacy/ops_primitives/test_list.py @@ -2,7 +2,7 @@ from weave.legacy import api as weave from weave import weave_internal -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy import box from weave.legacy.language_features.tagging import ( make_tag_getter_op, diff --git a/weave/legacy/ops_primitives/test_pandas.py b/weave/legacy/ops_primitives/test_pandas.py index 2b0dc05a6b54..835aeba71f84 100644 --- a/weave/legacy/ops_primitives/test_pandas.py +++ b/weave/legacy/ops_primitives/test_pandas.py @@ -1,7 +1,7 @@ import pandas as pd from weave.legacy import api as weave -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy.ops_primitives import pandas_ as op_pandas diff --git a/weave/legacy/ops_primitives/timestamp_bin.py b/weave/legacy/ops_primitives/timestamp_bin.py index 55bd192de550..ef153be48da4 100644 --- a/weave/legacy/ops_primitives/timestamp_bin.py +++ b/weave/legacy/ops_primitives/timestamp_bin.py @@ -1,10 +1,10 @@ from weave import weave_internal -from weave import weave_types as types +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.weave_types import Function, TimestampBinType +from weave.legacy.weave_types import Function, TimestampBinType NICE_BIN_SIZES_SEC = [ # TODO: will need more steps along here for smooth zooming. diff --git a/weave/legacy/ops_primitives/type.py b/weave/legacy/ops_primitives/type.py index 46b7c987062e..4b39df3143ea 100644 --- a/weave/legacy/ops_primitives/type.py +++ b/weave/legacy/ops_primitives/type.py @@ -1,7 +1,7 @@ import typing from weave.legacy import errors -from weave import weave_types as types +from weave.legacy 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 fc34be66d49b..187439a7cfac 100644 --- a/weave/legacy/ops_primitives/weave_api.py +++ b/weave/legacy/ops_primitives/weave_api.py @@ -7,7 +7,7 @@ trace_legacy, weave_internal, ) -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy.api import mutation, op, weave_class from weave.legacy import ( errors, diff --git a/weave/legacy/panel.py b/weave/legacy/panel.py index 922023202fe1..7ec6daab4e0b 100644 --- a/weave/legacy/panel.py +++ b/weave/legacy/panel.py @@ -5,7 +5,7 @@ from weave.legacy import api as weave from weave import weave_internal -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy import graph, panel_util, errors, storage diff --git a/weave/legacy/panel_util.py b/weave/legacy/panel_util.py index 3da288431dc8..5c86926c92e1 100644 --- a/weave/legacy/panel_util.py +++ b/weave/legacy/panel_util.py @@ -1,6 +1,6 @@ import typing -from weave import weave_types +from weave.legacy import weave_types from weave.legacy import storage, graph, panel diff --git a/weave/legacy/panels/panel_facet.py b/weave/legacy/panels/panel_facet.py index 228f5c8b74bd..54e079f333f7 100644 --- a/weave/legacy/panels/panel_facet.py +++ b/weave/legacy/panels/panel_facet.py @@ -3,7 +3,7 @@ import weave from weave import weave_internal -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy import graph, panel, panel_util from weave.legacy.arrow import list_ from weave.legacy.panels import table_state diff --git a/weave/legacy/panels/panel_plot.py b/weave/legacy/panels/panel_plot.py index 3f3a2804988c..7210836b2d7f 100644 --- a/weave/legacy/panels/panel_plot.py +++ b/weave/legacy/panels/panel_plot.py @@ -5,7 +5,7 @@ import weave from weave import weave_internal -from weave import weave_types as types +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_ from weave.legacy.ops_primitives import dict as dict_ diff --git a/weave/legacy/panels/table_state.py b/weave/legacy/panels/table_state.py index 0dcef9bda457..9415c814d7db 100644 --- a/weave/legacy/panels/table_state.py +++ b/weave/legacy/panels/table_state.py @@ -7,8 +7,8 @@ import string import typing -from weave import weave_internal, weave_types -from weave.legacy import decorator_type, graph, ops, panel +from weave 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/generator_templates.py b/weave/legacy/panels_py/generator_templates.py index b7fc045cb225..2aa6e5244248 100644 --- a/weave/legacy/panels_py/generator_templates.py +++ b/weave/legacy/panels_py/generator_templates.py @@ -18,7 +18,7 @@ import dataclasses import typing -from weave import weave_types +from weave.legacy import weave_types from weave.legacy import decorator_op, graph, registry_mem diff --git a/weave/legacy/panels_py/panel_example_custom_board.py b/weave/legacy/panels_py/panel_example_custom_board.py index a514ddad03c7..21ba4b37fdbe 100644 --- a/weave/legacy/panels_py/panel_example_custom_board.py +++ b/weave/legacy/panels_py/panel_example_custom_board.py @@ -1,6 +1,6 @@ import weave from weave import weave_internal as internal -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy.panels_py.generator_templates import template_registry # IMPORTANT: To enable this (or any template), it must be imported in diff --git a/weave/legacy/panels_py/panel_llm_monitor.py b/weave/legacy/panels_py/panel_llm_monitor.py index 73cc9278e2bd..a14e0e804d5d 100644 --- a/weave/legacy/panels_py/panel_llm_monitor.py +++ b/weave/legacy/panels_py/panel_llm_monitor.py @@ -4,7 +4,7 @@ import weave from weave import weave_internal from weave import weave_internal as internal -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy import util, dispatch from weave.legacy.panels import panel_board, panel_group from weave.legacy.panels_py import panel_autoboard diff --git a/weave/legacy/panels_py/panel_observability.py b/weave/legacy/panels_py/panel_observability.py index 2dd3c574fd16..37a3d47d6bce 100644 --- a/weave/legacy/panels_py/panel_observability.py +++ b/weave/legacy/panels_py/panel_observability.py @@ -1,6 +1,6 @@ import weave from weave import weave_internal -from weave import weave_types as types +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_trace_monitor.py b/weave/legacy/panels_py/panel_trace_monitor.py index cb0a9a9e3340..7e228aeef012 100644 --- a/weave/legacy/panels_py/panel_trace_monitor.py +++ b/weave/legacy/panels_py/panel_trace_monitor.py @@ -3,7 +3,7 @@ import weave from weave import weave_internal from weave import weave_internal as internal -from weave import weave_types as types +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 from weave.legacy.panels.panel_trace_span import TraceSpanModelPanel, TraceSpanPanel diff --git a/weave/legacy/partial_object.py b/weave/legacy/partial_object.py index 8b504f882a52..306c12a2d73b 100644 --- a/weave/legacy/partial_object.py +++ b/weave/legacy/partial_object.py @@ -2,7 +2,7 @@ import typing from dataclasses import dataclass, field -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy import artifact_fs T = typing.TypeVar("T", bound="PartialObject") diff --git a/weave/legacy/propagate_gql_keys.py b/weave/legacy/propagate_gql_keys.py index 08aa87a1affd..b32fbd3ad324 100644 --- a/weave/legacy/propagate_gql_keys.py +++ b/weave/legacy/propagate_gql_keys.py @@ -1,7 +1,7 @@ import typing -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy import gql_op_plugin, graph, input_provider, op_def, partial_object, registry_mem diff --git a/weave/legacy/pyfunc_type_util.py b/weave/legacy/pyfunc_type_util.py index e327e18b4d54..c72318e515d0 100644 --- a/weave/legacy/pyfunc_type_util.py +++ b/weave/legacy/pyfunc_type_util.py @@ -4,7 +4,7 @@ from weave.legacy import infer_types, op_args from weave.legacy import errors -from .. import weave_types as types +from weave.legacy import weave_types as types InputTypeItemType = typing.Union[types.Type, typing.Callable[..., types.Type]] InputTypeType = typing.Union[op_args.OpArgs, typing.Mapping[str, InputTypeItemType]] diff --git a/weave/legacy/ref_base.py b/weave/legacy/ref_base.py index a085e0446527..234b9f4aedec 100644 --- a/weave/legacy/ref_base.py +++ b/weave/legacy/ref_base.py @@ -10,13 +10,13 @@ from weave.legacy.language_features.tagging import tag_store from weave.legacy import errors -from .. import weave_types as types +from weave.legacy import weave_types as types # We store Refs here if we can't attach them directly to the object REFS: weakref.WeakValueDictionary[int, "Ref"] = weakref.WeakValueDictionary() if typing.TYPE_CHECKING: - from .. import weave_types as types + from weave.legacy import weave_types as types from ..trace import weave_client diff --git a/weave/legacy/registry_mem.py b/weave/legacy/registry_mem.py index cbc863f6d315..625c18ca60e9 100644 --- a/weave/legacy/registry_mem.py +++ b/weave/legacy/registry_mem.py @@ -1,7 +1,7 @@ import datetime import typing -from weave import weave_types +from weave.legacy import weave_types from weave.legacy import storage, errors, context_state, op_aliases, op_args, uris from weave.legacy.op_args import OpNamedArgs diff --git a/weave/legacy/runfiles_wandb.py b/weave/legacy/runfiles_wandb.py index 819dc7696ea2..9353652927a7 100644 --- a/weave/legacy/runfiles_wandb.py +++ b/weave/legacy/runfiles_wandb.py @@ -8,7 +8,7 @@ from weave.legacy import environment as weave_env from weave.legacy import filesystem -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy import ( artifact_fs, errors, diff --git a/weave/legacy/runs.py b/weave/legacy/runs.py index ce26f5365a01..bb27e87b374e 100644 --- a/weave/legacy/runs.py +++ b/weave/legacy/runs.py @@ -1,7 +1,7 @@ import dataclasses import typing -from weave import weave_types as types +from weave.legacy import weave_types as types @dataclasses.dataclass diff --git a/weave/legacy/serialize.py b/weave/legacy/serialize.py index b0d750f2902f..ee83f9047cb1 100644 --- a/weave/legacy/serialize.py +++ b/weave/legacy/serialize.py @@ -8,7 +8,7 @@ import typing from weave import weave_internal -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy import storage, errors, graph, memo, value_or_error NodeOrOp = typing.Union[graph.Node, graph.Op] diff --git a/weave/legacy/server.py b/weave/legacy/server.py index de94e6b17bb6..51f5f6bd6e49 100644 --- a/weave/legacy/server.py +++ b/weave/legacy/server.py @@ -24,12 +24,12 @@ wandb_api, logs, util, + storage, + weave_types, ) from weave.legacy.language_features.tagging import tag_store from weave.legacy.language_features.tagging.tag_store import isolated_tagging_context -from .. import storage, weave_types - # A function to monkeypatch the request post method # def patch_request_post(): # r_post = requests.post diff --git a/weave/legacy/show.py b/weave/legacy/show.py index 0f03b3da9007..204e84d5b7f7 100644 --- a/weave/legacy/show.py +++ b/weave/legacy/show.py @@ -8,7 +8,7 @@ from weave.legacy import storage, artifact_fs, context, errors, graph, ops, node_ref, panel, ref_base from weave.legacy import util from . import usage_analytics -from .. import weave_types as types +from weave.legacy import weave_types as types from . import weavejs_fixes diff --git a/weave/legacy/stitch.py b/weave/legacy/stitch.py index 878448292d54..9ba0145040bb 100644 --- a/weave/legacy/stitch.py +++ b/weave/legacy/stitch.py @@ -26,7 +26,7 @@ from weave.legacy.language_features.tagging import opdef_util from weave.legacy import errors -from .. import weave_types as types +from weave.legacy import weave_types as types from . import _dict_utils diff --git a/weave/legacy/storage.py b/weave/legacy/storage.py index dce6b4d82f58..e13f102bb1b5 100644 --- a/weave/legacy/storage.py +++ b/weave/legacy/storage.py @@ -22,7 +22,7 @@ timestamp, ) -from weave import weave_types as types +from weave.legacy import weave_types as types Ref = ref_base.Ref diff --git a/weave/legacy/trace_local.py b/weave/legacy/trace_local.py index b210d313b094..05c6075b0032 100644 --- a/weave/legacy/trace_local.py +++ b/weave/legacy/trace_local.py @@ -12,7 +12,7 @@ storage, weave_internal, ) -from .. import weave_types as types +from weave.legacy import weave_types as types @dataclasses.dataclass diff --git a/weave/legacy/types_numpy.py b/weave/legacy/types_numpy.py index 2577e1119a76..c7d661e87805 100644 --- a/weave/legacy/types_numpy.py +++ b/weave/legacy/types_numpy.py @@ -1,6 +1,6 @@ import numpy as np -from .. import weave_types as types +from weave.legacy import weave_types as types # TODO: this doesn't match how extra works for list types... diff --git a/weave/legacy/val_const.py b/weave/legacy/val_const.py index 212d5692d2bf..c48e34e50cda 100644 --- a/weave/legacy/val_const.py +++ b/weave/legacy/val_const.py @@ -7,7 +7,7 @@ import typing -from weave import weave_types as types +from weave.legacy import weave_types as types class Const: diff --git a/weave/legacy/wandb_interface/wandb_stream_table.py b/weave/legacy/wandb_interface/wandb_stream_table.py index 7d3e307cd7a9..63a05b9fb8bc 100644 --- a/weave/legacy/wandb_interface/wandb_stream_table.py +++ b/weave/legacy/wandb_interface/wandb_stream_table.py @@ -15,7 +15,7 @@ from wandb.sdk.lib.paths import LogicalPath from wandb.sdk.lib.printer import get_printer -from weave import weave_types +from weave.legacy import weave_types from weave.legacy import ( storage, errors, diff --git a/weave/legacy/wandb_util.py b/weave/legacy/wandb_util.py index f160a46e2a09..be4161ff0380 100644 --- a/weave/legacy/wandb_util.py +++ b/weave/legacy/wandb_util.py @@ -1,7 +1,7 @@ import typing from weave.legacy import errors -from weave import weave_types as types +from weave.legacy import weave_types as types from weave.legacy import ops, ops_domain diff --git a/weave/legacy/weave_inspector.py b/weave/legacy/weave_inspector.py index 15814ada84ef..d878e4f8d4de 100644 --- a/weave/legacy/weave_inspector.py +++ b/weave/legacy/weave_inspector.py @@ -107,7 +107,7 @@ from weave.legacy import graph -from .. import weave_types as types +from weave.legacy import weave_types as types from .partial_object import PartialObjectType diff --git a/weave/legacy/weave_pydantic.py b/weave/legacy/weave_pydantic.py index 086feb8d2fa4..870b2a83d618 100644 --- a/weave/legacy/weave_pydantic.py +++ b/weave/legacy/weave_pydantic.py @@ -1,6 +1,6 @@ from pydantic import BaseModel, create_model -from .. import weave_types as types +from weave.legacy import weave_types as types from . import infer_types diff --git a/weave/weave_types.py b/weave/legacy/weave_types.py similarity index 89% rename from weave/weave_types.py rename to weave/legacy/weave_types.py index 3621eaa0de40..2b1c45c38915 100644 --- a/weave/weave_types.py +++ b/weave/legacy/weave_types.py @@ -24,7 +24,7 @@ from weave.legacy import artifact_base from weave.legacy.artifact_fs import FilesystemArtifact - from .legacy import weave_inspector + from weave.legacy import weave_inspector def to_weavejs_typekey(k: str) -> str: @@ -46,7 +46,7 @@ def js_to_py_typename(typename: str) -> str: return typename -def all_subclasses(cls): +def all_subclasses(cls): # type: ignore # Note using a list here... this doesn't dedupe star pattern! # But it does preserve tree order. return list(cls.__subclasses__()) + [ @@ -54,11 +54,11 @@ def all_subclasses(cls): ] -def get_type_classes(): +def get_type_classes(): # type: ignore return all_subclasses(Type) -def instance_class_to_potential_type_map(): +def instance_class_to_potential_type_map(): # type: ignore res = {} type_classes = get_type_classes() for type_class in type_classes: @@ -74,7 +74,7 @@ def instance_class_to_potential_type_map(): @functools.cache -def instance_class_to_potential_type(cls): +def instance_class_to_potential_type(cls): # type: ignore mapping = instance_class_to_potential_type_map() exact_type_classes = mapping.get(cls) if exact_type_classes is not None: @@ -90,7 +90,7 @@ def instance_class_to_potential_type(cls): @functools.cache -def type_name_to_type_map(): +def type_name_to_type_map(): # type: ignore res = {} type_classes = get_type_classes() for type_class in type_classes: @@ -101,7 +101,7 @@ def type_name_to_type_map(): @functools.cache -def type_name_to_type(type_name): +def type_name_to_type(type_name): # type: ignore mapping = type_name_to_type_map() return mapping.get(js_to_py_typename(type_name)) @@ -113,11 +113,11 @@ def type_name_to_type(type_name): class TypeRegistry: @staticmethod - def has_type(obj): + def has_type(obj): # type: ignore return bool(instance_class_to_potential_type(type(obj))) @staticmethod - def type_class_of(obj): + def type_class_of(obj): # type: ignore type_classes = instance_class_to_potential_type(type(obj)) if not type_classes: # return UnknownType() @@ -125,7 +125,7 @@ def type_class_of(obj): return type_classes[-1] @staticmethod - def type_of(obj: typing.Any) -> "Type": + def type_of(obj: typing.Any) -> "Type": # type: ignore from weave.legacy import ref_base if ( @@ -169,7 +169,7 @@ def type_of(obj: typing.Any) -> "Type": return UnknownType() @staticmethod - def type_from_dict(d: typing.Union[str, dict]) -> "Type": + def type_from_dict(d: typing.Union[str, dict]) -> "Type": # type: ignore if is_relocatable_object_type(d): d = typing.cast(dict, d) return deserialize_relocatable_object_type(d) @@ -187,13 +187,13 @@ def type_from_dict(d: typing.Union[str, dict]) -> "Type": return type_.from_dict(d) -def _clear_global_type_class_cache(): +def _clear_global_type_class_cache(): # type: ignore instance_class_to_potential_type.cache_clear() type_name_to_type_map.cache_clear() type_name_to_type.cache_clear() -def _cached_hash(self): +def _cached_hash(self): # type: ignore try: return self.__dict__["_hash"] except KeyError: @@ -203,16 +203,16 @@ def _cached_hash(self): class classproperty(object): - def __init__(self, f): + def __init__(self, f): # type: ignore self.f = f - def __get__(self, obj, owner): + def __get__(self, obj, owner): # type: ignore return self.f(owner) # Addapted from https://stackoverflow.com/questions/18126552/how-to-run-code-when-a-class-is-subclassed class _TypeSubclassWatcher(type): - def __init__(cls, name, bases, clsdict): + def __init__(cls, name, bases, clsdict): # type: ignore # This code will run whenever `Type` is subclassed! # Bust the cache! _clear_global_type_class_cache() @@ -241,23 +241,23 @@ class Type(metaclass=_TypeSubclassWatcher): _type_attrs = None _hash = None - def _hashable(self): + def _hashable(self): # type: ignore return tuple((k, hash(t)) for k, t in self.type_vars_tuple) - def __lt__(self, other): + def __lt__(self, other): # type: ignore return hash(self) < hash(other) - def __repr__(self) -> str: + def __repr__(self) -> str: # type: ignore return f"{self.__class__.__name__}()" - def __name__(self) -> str: + def __name__(self) -> str: # type: ignore return self.__repr__() - def simple_str(self) -> str: + def simple_str(self) -> str: # type: ignore return str(self) @classmethod - def _instance_classes(cls) -> typing.Sequence[type]: + def _instance_classes(cls) -> typing.Sequence[type]: # type: ignore """Helper to get instance_classes as iterable.""" if cls.instance_classes is None: return () @@ -266,7 +266,7 @@ def _instance_classes(cls) -> typing.Sequence[type]: return (cls.instance_classes,) @classmethod - def type_attrs(cls): + def type_attrs(cls): # type: ignore type_attrs = [] for field in dataclasses.fields(cls): if (inspect.isclass(field.type) and issubclass(field.type, Type)) or ( @@ -277,18 +277,18 @@ def type_attrs(cls): return type_attrs @property - def type_vars_tuple(self): + def type_vars_tuple(self): # type: ignore type_vars = [] for field in self.type_attrs(): type_vars.append((field, getattr(self, field))) return tuple(type_vars) @property - def type_vars(self) -> dict[str, "Type"]: + def type_vars(self) -> dict[str, "Type"]: # type: ignore return dict(self.type_vars_tuple) @classmethod - def root_type_class(cls) -> type["Type"]: + def root_type_class(cls) -> type["Type"]: # type: ignore if cls._base_type is None: return cls base_type_class = cls._base_type.root_type_class() @@ -297,38 +297,38 @@ def root_type_class(cls) -> type["Type"]: return base_type_class @classmethod - def is_instance(cls, obj): + def is_instance(cls, obj): # type: ignore for ic in cls._instance_classes(): if isinstance(obj, ic): return ic return None @classmethod - def typeclass_of_class(cls, check_class): + def typeclass_of_class(cls, check_class): # type: ignore return cls @classmethod - def type_of(cls, obj) -> typing.Optional["Type"]: - if not cls.is_instance(obj): + def type_of(cls, obj) -> typing.Optional["Type"]: # type: ignore + if not cls.is_instance(obj): # type: ignore[no-untyped-call] return None - return cls.type_of_instance(obj) + return cls.type_of_instance(obj) # type: ignore[no-untyped-call] @classmethod - def type_of_instance(cls, obj): + def type_of_instance(cls, obj): # type: ignore # Default implementation for Types that take no arguments. return cls() @classproperty - def name(cls): + def name(cls): # type: ignore if cls == Type: return "type" return cls.__name__.removesuffix("Type") - @property # type: ignore - def instance_class(self): + @property # type: ignore[no-redef] + def instance_class(self): # type: ignore return self._instance_classes()[-1] - def assign_type(self, next_type: "Type") -> bool: + def assign_type(self, next_type: "Type") -> bool: # type: ignore # assign_type needs to be as fast as possible, so there are optimizations # throughout this code path, like checking for class equality instead of using isinstance @@ -348,10 +348,10 @@ def assign_type(self, next_type: "Type") -> bool: return self._assign_type_inner(next_type) - def _is_assignable_to(self, other_type) -> typing.Optional[bool]: + def _is_assignable_to(self, other_type) -> typing.Optional[bool]: # type: ignore return None - def _assign_type_inner(self, next_type: "Type") -> bool: + def _assign_type_inner(self, next_type: "Type") -> bool: # type: ignore # First check that we match next_type class or one of # its bases. next_type_class = next_type.__class__ @@ -377,18 +377,18 @@ def _assign_type_inner(self, next_type: "Type") -> bool: return True @classmethod - def class_to_dict(cls) -> dict[str, typing.Any]: + def class_to_dict(cls) -> dict[str, typing.Any]: # type: ignore d = {"type": cls.name} if cls._base_type is not None: d["_base_type"] = cls._base_type.class_to_dict() return d - def to_dict(self) -> typing.Union[dict, str]: + def to_dict(self) -> typing.Union[dict, str]: # type: ignore d = {"type": self.name} d.update(self._to_dict()) return d - def _to_dict(self) -> dict: + def _to_dict(self) -> dict: # type: ignore fields = dataclasses.fields(self.__class__) type_props = {} if self._base_type is not None: @@ -407,7 +407,7 @@ def _to_dict(self) -> dict: return type_props @classmethod - def from_dict(cls, d): + def from_dict(cls, d): # type: ignore fields = dataclasses.fields(cls) type_attrs = {} for field in fields: @@ -416,12 +416,12 @@ def from_dict(cls, d): type_attrs[field.name] = TypeRegistry.type_from_dict(d[field_name]) return cls(**type_attrs) - def save_instance( + def save_instance( # type: ignore self, obj, artifact, name ) -> typing.Optional[typing.Union[list[str], "artifact_base.ArtifactRef"]]: d = None try: - d = self.instance_to_dict(obj) + d = self.instance_to_dict(obj) # type: ignore[no-untyped-call] except NotImplementedError: pass if d is None: @@ -433,7 +433,7 @@ def save_instance( json.dump(d, f) return None - def load_instance( + def load_instance( # type: ignore self, artifact: "FilesystemArtifact", name: str, @@ -441,26 +441,26 @@ def load_instance( ) -> typing.Any: with artifact.open(f"{name}.object.json") as f: d = json.load(f) - return self.instance_from_dict(d) + return self.instance_from_dict(d) # type: ignore[no-untyped-call] - def instance_to_dict(self, obj): + def instance_to_dict(self, obj): # type: ignore raise NotImplementedError - def instance_from_dict(self, d): + def instance_from_dict(self, d): # type: ignore raise NotImplementedError @classmethod - def make(cls, kwargs={}): + def make(cls, kwargs={}): # type: ignore return cls._make(cls, kwargs) @staticmethod - def _make(cls, kwargs={}): + def _make(cls, kwargs={}): # type: ignore raise Exception("Please import `weave` to use `Type.make`.") - def _inspect(self) -> "weave_inspector.TypeInspector": + def _inspect(self) -> "weave_inspector.TypeInspector": # type: ignore """Only intended to be used by developers to help debug the graph.""" # Circular import, so we do it here. - from .legacy import weave_inspector + from weave.legacy import weave_inspector return weave_inspector.TypeInspector(self) @@ -468,13 +468,13 @@ def _inspect(self) -> "weave_inspector.TypeInspector": # _PlainStringNamedType should only be used for backward compatibility with # legacy WeaveJS code. class _PlainStringNamedType(Type): - def to_dict(self): + def to_dict(self): # type: ignore # A basic type is serialized as just its string name. return self.name class BasicType(_PlainStringNamedType): - def save_instance(self, obj, artifact, name): + def save_instance(self, obj, artifact, name): # type: ignore if artifact is None: raise errors.WeaveSerializeError( "save_instance invalid when artifact is None for type: %s" % self @@ -482,7 +482,7 @@ def save_instance(self, obj, artifact, name): with artifact.new_file(f"{name}.object.json") as f: json.dump(obj, f) - def load_instance(self, artifact, name, extra=None): + def load_instance(self, artifact, name, extra=None): # type: ignore with artifact.open(f"{name}.object.json") as f: return json.load(f) @@ -511,7 +511,7 @@ class UnknownType(BasicType): # # This change would need to be implemented in the core `Type.assign_type` # method - def _assign_type_inner(self, next_type): + def _assign_type_inner(self, next_type): # type: ignore return True @@ -525,10 +525,10 @@ class NoneType(BasicType): # If we're using NoneType in a place where we expect a list, the object_type # of that list is also NoneType, due to nullability. @property - def object_type(self): + def object_type(self): # type: ignore return NoneType() - def save_instance(self, obj, artifact, name): + def save_instance(self, obj, artifact, name): # type: ignore # BoxedNone is actually a box, not a subclass of bool, since # we can't subclass bool in Python. So we unbox it here. if isinstance(obj, box.BoxedNone): @@ -547,7 +547,7 @@ def save_instance(self, obj, artifact, name): class Any(BasicType): name = "any" - def _assign_type_inner(self, next_type): + def _assign_type_inner(self, next_type): # type: ignore return True @@ -557,14 +557,14 @@ class Const(Type): val_type: Type val: typing.Any - def __post_init__(self): + def __post_init__(self): # type: ignore if isinstance(self.val_type, UnionType): # Const Unions are invalid. If something is Const, that means we know what its value # is, which means it is definitely not a Union. Replace val_type with the actual type # here. self.__dict__["val_type"] = TypeRegistry.type_of(self.val) - def _hashable(self): + def _hashable(self): # type: ignore val_id = id(self.val) try: val_id = hash(self.val) @@ -572,19 +572,19 @@ def _hashable(self): pass return (hash(self.val_type), val_id) - def __getattr__(self, attr): + def __getattr__(self, attr): # type: ignore return getattr(self.val_type, attr) @classmethod - def type_of_instance(cls, obj): + def type_of_instance(cls, obj): # type: ignore return cls(TypeRegistry.type_of(obj.val), obj.val) - def _is_assignable_to(self, other_type) -> typing.Optional[bool]: + def _is_assignable_to(self, other_type) -> typing.Optional[bool]: # type: ignore if other_type.__class__ != Const: return other_type.assign_type(self.val_type) return None - def _assign_type_inner(self, next_type): + def _assign_type_inner(self, next_type): # type: ignore if isinstance(next_type, Const): # This does a check on class equality, so won't work for # fancier types. We can fix later if we need to. @@ -601,7 +601,7 @@ def _assign_type_inner(self, next_type): return self.val_type.assign_type(next_type) @classmethod - def from_dict(cls, d): + def from_dict(cls, d): # type: ignore w_type = TypeRegistry.type_from_dict(d["valType"]) val = d["val"] # try: @@ -610,7 +610,7 @@ def from_dict(cls, d): # pass return cls(w_type, val) - def _to_dict(self): + def _to_dict(self): # type: ignore val = self.val # try: # val = self.val_type.instance_to_dict(val) @@ -618,7 +618,7 @@ def _to_dict(self): # pass return {"valType": self.val_type.to_dict(), "val": val} - def __repr__(self): + def __repr__(self): # type: ignore return "Const(%s, %s)" % (self.val_type, self.val) @@ -648,7 +648,7 @@ class Float(Number): instance_classes = float name = "float" - def _assign_type_inner(self, other_type: Type): + def _assign_type_inner(self, other_type: Type): # type: ignore # Float if either side is a number return isinstance(other_type, Number) @@ -658,13 +658,13 @@ class Int(Number): instance_classes = int @classmethod - def is_instance(cls, obj): + def is_instance(cls, obj): # type: ignore # Special case, in Python bool isinstance of obj! if type(obj) == bool: return False return super().is_instance(obj) - def _assign_type_inner(self, other_type: Type): + def _assign_type_inner(self, other_type: Type): # type: ignore # Become Float if rhs is Float return isinstance(other_type, Number) and not isinstance(other_type, Float) @@ -673,7 +673,7 @@ class Boolean(BasicType): instance_classes = [bool, box.BoxedBool] name = "boolean" - def save_instance(self, obj, artifact, name): + def save_instance(self, obj, artifact, name): # type: ignore # BoxedBool is actually a box, not a subclass of bool, since # we can't subclass bool in Python. So we unbox it here. if isinstance(obj, box.BoxedBool): @@ -687,7 +687,7 @@ class LegacyDate(Type): # use "timestamp" but we need to keep this around for backwards compatibility. name = "date" - def save_instance(self, obj, artifact, name): + def save_instance(self, obj, artifact, name): # type: ignore if artifact is None: raise errors.WeaveSerializeError( "save_instance invalid when artifact is None for type: %s" % self @@ -696,7 +696,7 @@ def save_instance(self, obj, artifact, name): v = weave_timestamp.python_datetime_to_ms(obj) json.dump(v, f) - def load_instance(self, artifact, name, extra=None): + def load_instance(self, artifact, name, extra=None): # type: ignore with artifact.open(f"{name}.object.json") as f: v = json.load(f) return weave_timestamp.ms_to_python_datetime(v) @@ -706,7 +706,7 @@ class TimeDelta(Type): name = "timedelta" instance_classes = datetime.timedelta - def save_instance(self, obj: datetime.timedelta, artifact, name): + def save_instance(self, obj: datetime.timedelta, artifact, name): # type: ignore if artifact is None: raise errors.WeaveSerializeError( "save_instance invalid when artifact is None for type: %s" % self @@ -716,7 +716,7 @@ def save_instance(self, obj: datetime.timedelta, artifact, name): v = [obj.days, obj.seconds, obj.microseconds] json.dump(v, f) - def load_instance(self, artifact, name, extra=None): + def load_instance(self, artifact, name, extra=None): # type: ignore with artifact.open(f"{name}.object.json") as f: [days, seconds, microseconds] = json.load(f) return datetime.timedelta(days, seconds, microseconds) @@ -726,11 +726,11 @@ class Timestamp(Type): name = "timestamp" instance_classes = datetime.datetime - def from_isostring(self, iso: str) -> datetime.datetime: + def from_isostring(self, iso: str) -> datetime.datetime: # type: ignore tz_naive = isoparse(iso) return tz_naive.replace(tzinfo=datetime.timezone.utc) - def save_instance(self, obj, artifact, name): + def save_instance(self, obj, artifact, name): # type: ignore if artifact is None: raise errors.WeaveSerializeError( "save_instance invalid when artifact is None for type: %s" % self @@ -739,7 +739,7 @@ def save_instance(self, obj, artifact, name): v = weave_timestamp.python_datetime_to_ms(obj) json.dump(v, f) - def load_instance(self, artifact, name, extra=None): + def load_instance(self, artifact, name, extra=None): # type: ignore with artifact.open(f"{name}.object.json") as f: v = json.load(f) return weave_timestamp.ms_to_python_datetime(v) @@ -751,7 +751,7 @@ class UnionType(Type): members: list[Type] - def __init__(self, *members: Type) -> None: + def __init__(self, *members: Type) -> None: # type: ignore all_members = [] for mem in members: if isinstance(mem, UnionType): @@ -778,17 +778,17 @@ def __init__(self, *members: Type) -> None: # def __repr__(self): # return "UnionType(%s)" % ", ".join(repr(mem) for mem in self.members) - def __eq__(self, other): + def __eq__(self, other): # type: ignore if not isinstance(other, UnionType): return False # Order matters, it affects layout. # return self.members == other.members return set(self.members) == set(other.members) - def _hashable(self): + def _hashable(self): # type: ignore return tuple(hash(mem) for mem in sorted(self.members)) - def is_simple_nullable(self): + def is_simple_nullable(self): # type: ignore return len(set(self.members)) == 2 and none_type in set(self.members) # def instance_to_py(self, obj): @@ -799,15 +799,15 @@ def is_simple_nullable(self): # return member_type.instance_to_py(obj) # raise Exception('invalid') @classmethod - def from_dict(cls, d): + def from_dict(cls, d): # type: ignore return merge_many_types( [TypeRegistry.type_from_dict(mem) for mem in d["members"]] ) - def _to_dict(self): + def _to_dict(self): # type: ignore return {"members": [mem.to_dict() for mem in self.members]} - def __getattr__(self, attr): + def __getattr__(self, attr): # type: ignore has_none = False results = [] for mem in self.members: @@ -852,7 +852,7 @@ class List(Type): object_type: Type = dataclasses.field(default_factory=Any) @classmethod - def type_of_instance(cls, obj): + def type_of_instance(cls, obj): # type: ignore if not obj: return cls(UnknownType()) list_obj_type = TypeRegistry.type_of(obj[0]) @@ -863,18 +863,18 @@ def type_of_instance(cls, obj): list_obj_type = merge_types(list_obj_type, obj_type) return cls(list_obj_type) - def _assign_type_inner(self, next_type): + def _assign_type_inner(self, next_type): # type: ignore if isinstance(next_type, List) and next_type.object_type == UnknownType(): return True return super()._assign_type_inner(next_type) - def save_instance(self, obj, artifact, name): + def save_instance(self, obj, artifact, name): # type: ignore serializer = mappers_python.map_to_python(self, artifact) result = serializer.apply(obj) with artifact.new_file(f"{name}.list.json") as f: json.dump(result, f, allow_nan=False) - def load_instance(self, artifact, name, extra=None): + def load_instance(self, artifact, name, extra=None): # type: ignore with artifact.open(f"{name}.list.json") as f: result = json.load(f) mapper = mappers_python.map_from_python(self, artifact) @@ -898,16 +898,16 @@ class TypedDict(Type): # in Typescript this is like key?: value not_required_keys: set[str] = dataclasses.field(default_factory=set) - def _hashable(self): + def _hashable(self): # type: ignore return tuple( (k, hash(v), k in self.not_required_keys) for k, v in self.property_types.items() ) - def __getitem__(self, key: str) -> Type: + def __getitem__(self, key: str) -> Type: # type: ignore return self.property_types[key] - def _assign_type_inner(self, other_type): + def _assign_type_inner(self, other_type): # type: ignore if isinstance(other_type, Dict): for ptype in self.property_types.values(): if not ptype.assign_type(other_type.object_type): @@ -926,7 +926,7 @@ def _assign_type_inner(self, other_type): return False return True - def _to_dict(self): + def _to_dict(self): # type: ignore property_types = {} for key, type_ in self.property_types.items(): property_types[key] = type_.to_dict() @@ -936,7 +936,7 @@ def _to_dict(self): return result @classmethod - def from_dict(cls, d): + def from_dict(cls, d): # type: ignore property_types = {} for key, type_ in d["propertyTypes"].items(): property_types[key] = TypeRegistry.type_from_dict(type_) @@ -946,19 +946,19 @@ def from_dict(cls, d): return cls(property_types, not_required_keys) @classmethod - def type_of_instance(cls, obj): + def type_of_instance(cls, obj): # type: ignore property_types = {} for k, v in obj.items(): property_types[k] = TypeRegistry.type_of(v) return cls(property_types) - def save_instance(self, obj, artifact, name): + def save_instance(self, obj, artifact, name): # type: ignore serializer = mappers_python.map_to_python(self, artifact) result = serializer.apply(obj) with artifact.new_file(f"{name}.typedDict.json") as f: json.dump(result, f, allow_nan=False) - def load_instance(self, artifact, name, extra=None): + def load_instance(self, artifact, name, extra=None): # type: ignore # with artifact.open(f'{name}.type.json') as f: # obj_type = TypeRegistry.type_from_dict(json.load(f)) with artifact.open(f"{name}.typedDict.json") as f: @@ -976,27 +976,27 @@ class Dict(Type): object_type: Type = Any() @property - def property_types(self): + def property_types(self): # type: ignore class DictPropertyTypes: - def values(_self): + def values(_self): # type: ignore return [self.object_type] - def get(_self, _): + def get(_self, _): # type: ignore return self.object_type - def __getitem__(_self, _): + def __getitem__(_self, _): # type: ignore return self.object_type return DictPropertyTypes() - def __post_init__(self): + def __post_init__(self): # type: ignore # Note this differs from Python's Dict in that keys are always strings! # TODO: consider if we can / should accept key_type. Would make JS side # harder since js objects can only have string keys. if not String().assign_type(self.key_type): raise Exception("Dict only supports string keys!") - def _assign_type_inner(self, other_type): + def _assign_type_inner(self, other_type): # type: ignore if isinstance(other_type, TypedDict): return all( self.object_type.assign_type(t) @@ -1005,7 +1005,7 @@ def _assign_type_inner(self, other_type): return super()._assign_type_inner(other_type) @classmethod - def type_of_instance(cls, obj): + def type_of_instance(cls, obj): # type: ignore value_type = UnknownType() for k, v in obj.items(): if not isinstance(k, str): @@ -1032,7 +1032,7 @@ class ObjectType(Type): # base. All interactions with types go through methods here, so # fixups can be contained. - def __init__(self, **attr_types: Type): + def __init__(self, **attr_types: Type): # type: ignore fixed_attr_types = {} for k, v in attr_types.items(): if k == "name": @@ -1044,7 +1044,7 @@ def __init__(self, **attr_types: Type): self.__dict__[k] = v @property - def type_vars(self): + def type_vars(self): # type: ignore if hasattr(self, "attr_types"): tv = self.attr_types else: @@ -1056,12 +1056,12 @@ def type_vars(self): result[k] = v return result - def property_types(self) -> dict[str, Type]: + def property_types(self) -> dict[str, Type]: # type: ignore return self.type_vars @classmethod - def typeclass_of_class(cls, check_class): - from .legacy import weave_pydantic + def typeclass_of_class(cls, check_class): # type: ignore + from weave.legacy import weave_pydantic if not issubclass(check_class, pydantic.BaseModel): return cls @@ -1097,7 +1097,7 @@ def typeclass_of_class(cls, check_class): return dataclasses.dataclass(frozen=True)(new_cls) @classmethod - def type_of_instance(cls, obj): + def type_of_instance(cls, obj): # type: ignore if isinstance(obj, pydantic.BaseModel): type_class = cls.typeclass_of_class(obj.__class__) attr_types = {} @@ -1118,7 +1118,7 @@ def type_of_instance(cls, obj): variable_prop_types[prop_name] = prop_type return cls(**variable_prop_types) - def _to_dict(self) -> dict: + def _to_dict(self) -> dict: # type: ignore d = self.class_to_dict() if self._relocatable: @@ -1131,7 +1131,7 @@ def _to_dict(self) -> dict: d[to_weavejs_typekey(k)] = prop_type.to_dict() return d - def save_instance(self, obj, artifact, name): + def save_instance(self, obj, artifact, name): # type: ignore serializer = mappers_python.map_to_python(self, artifact) result = serializer.apply(obj) @@ -1140,20 +1140,20 @@ def save_instance(self, obj, artifact, name): with artifact.new_file(f"{name}.object.json") as f: json.dump(result, f, allow_nan=False) - def load_instance(self, artifact, name, extra=None): + def load_instance(self, artifact, name, extra=None): # type: ignore with artifact.open(f"{name}.object.json") as f: result = json.load(f) mapper = mappers_python.map_from_python(self, artifact) return mapper.apply(result) - def __eq__(self, other) -> bool: + def __eq__(self, other) -> bool: # type: ignore return ( type(self) == type(other) and self.property_types() == other.property_types() ) -def is_serialized_object_type(t: dict) -> bool: +def is_serialized_object_type(t: dict) -> bool: # type: ignore if "_base_type" not in t: return False if t["_base_type"]["type"] == "Object": @@ -1161,7 +1161,7 @@ def is_serialized_object_type(t: dict) -> bool: return is_serialized_object_type(t["_base_type"]) -def is_relocatable_object_type(t: typing.Union[str, dict]) -> bool: +def is_relocatable_object_type(t: typing.Union[str, dict]) -> bool: # type: ignore if not isinstance(t, dict): return False if not t.get("_relocatable"): @@ -1178,7 +1178,7 @@ def is_relocatable_object_type(t: typing.Union[str, dict]) -> bool: DESERIALIZED_OBJECT_TYPE_CLASSES: dict[str, type[ObjectType]] = {} -def validate_kwarg_name(name: str) -> bool: +def validate_kwarg_name(name: str) -> bool: # type: ignore """Return True if name is a valid python kwarg name""" if name in keyword.kwlist: raise ValueError( @@ -1191,7 +1191,7 @@ def validate_kwarg_name(name: str) -> bool: return True -def deserialize_relocatable_object_type(t: dict) -> ObjectType: +def deserialize_relocatable_object_type(t: dict) -> ObjectType: # type: ignore key = json.dumps(t) if key in DESERIALIZED_OBJECT_TYPE_CLASSES: return DESERIALIZED_OBJECT_TYPE_CLASSES[key]() @@ -1270,22 +1270,22 @@ class TypeType(ObjectType): instance_classes = [Type] attr_types: dict[str, Type] = dataclasses.field(default_factory=dict) - def property_types(self) -> dict[str, Type]: + def property_types(self) -> dict[str, Type]: # type: ignore return self.attr_types - def _hashable(self): + def _hashable(self): # type: ignore return tuple((k, hash(v)) for k, v in self.property_types().items()) @classmethod - def type_of_instance(cls, obj): - from .legacy import infer_types + def type_of_instance(cls, obj): # type: ignore + from weave.legacy import infer_types attr_types = {} for field in dataclasses.fields(obj): attr_types[field.name] = infer_types.python_type_to_type(field.type) return cls(attr_types) - def _to_dict(self): + def _to_dict(self): # type: ignore # we ensure we match the layout of ObjectType, so WeaveJS # can handle it the same way. d = {"_is_object": True} @@ -1294,7 +1294,7 @@ def _to_dict(self): return d @classmethod - def from_dict(cls, d): + def from_dict(cls, d): # type: ignore # weavejs fix: weavejs uses the plain string 'type' for now. if d == "type": return cls() @@ -1314,18 +1314,18 @@ class Function(Type): input_types: dict[str, Type] = dataclasses.field(default_factory=dict) output_type: Type = dataclasses.field(default_factory=lambda: UnknownType()) - def _hashable(self): + def _hashable(self): # type: ignore return ( tuple((k, hash(v)) for k, v in self.input_types.items()), hash(self.output_type), ) - def _is_assignable_to(self, other_type) -> typing.Optional[bool]: + def _is_assignable_to(self, other_type) -> typing.Optional[bool]: # type: ignore if other_type.__class__ != Function: return other_type.assign_type(self.output_type) return None - def assign_type(self, next_type: Type) -> bool: + def assign_type(self, next_type: Type) -> bool: # type: ignore if not self.input_types and not isinstance(next_type, Function): # Allow assignment of T to () -> T. # Compile handles this in the compile_quote pass. @@ -1333,7 +1333,7 @@ def assign_type(self, next_type: Type) -> bool: return super().assign_type(next_type) @classmethod - def type_of_instance(cls, obj): + def type_of_instance(cls, obj): # type: ignore if isinstance(obj.type, Function): # Its already a Function type, so just return it. # TODO: I'm not sure if this is right, this makes FunctionType @@ -1343,22 +1343,22 @@ def type_of_instance(cls, obj): return cls({}, obj.type) @classmethod - def from_dict(cls, json): + def from_dict(cls, json): # type: ignore input_types = { pname: TypeRegistry.type_from_dict(ptype) for (pname, ptype) in json["inputTypes"].items() } return cls(input_types, TypeRegistry.type_from_dict(json["outputType"])) - def _to_dict(self): + def _to_dict(self): # type: ignore input_types = {k: v.to_dict() for (k, v) in self.input_types.items()} return {"inputTypes": input_types, "outputType": self.output_type.to_dict()} - def save_instance(self, obj, artifact, name): + def save_instance(self, obj, artifact, name): # type: ignore with artifact.new_file(f"{name}.object.json") as f: json.dump(obj.to_json(), f) - def load_instance(self, artifact, name, extra=None): + def load_instance(self, artifact, name, extra=None): # type: ignore with artifact.open(f"{name}.object.json") as f: # TODO: no circular imports! from weave.legacy import graph @@ -1371,10 +1371,10 @@ class RefType(Type): object_type: Type = Any() @classmethod - def type_of_instance(cls, obj): + def type_of_instance(cls, obj): # type: ignore return cls(obj.type) - def _is_assignable_to(self, other_type) -> typing.Optional[bool]: + def _is_assignable_to(self, other_type) -> typing.Optional[bool]: # type: ignore # Use issubclass, we have RunLocalType defined as a subclass of RunType if not issubclass(other_type.__class__, RefType): if self.object_type == NoneType(): @@ -1384,7 +1384,7 @@ def _is_assignable_to(self, other_type) -> typing.Optional[bool]: return other_type.assign_type(self.object_type) return None - def save_instance(self, obj, artifact, name): + def save_instance(self, obj, artifact, name): # type: ignore from weave.legacy import ref_base obj_ref = ref_base.get_ref(obj) @@ -1418,7 +1418,7 @@ class LocalArtifactRefType(FilesystemArtifactRefType): @dataclasses.dataclass(frozen=True) class WandbArtifactRefType(FilesystemArtifactRefType): - def load_instance(self, artifact, name, extra=None): + def load_instance(self, artifact, name, extra=None): # type: ignore from weave.legacy import artifact_wandb return artifact_wandb.WandbArtifactRef(artifact, name) @@ -1428,7 +1428,7 @@ class WBTable(Type): name = "wbtable" -def is_json_compatible(type_): +def is_json_compatible(type_): # type: ignore if isinstance(type_, List): return is_json_compatible(type_.object_type) elif isinstance(type_, Dict): @@ -1498,15 +1498,15 @@ def non_none(type_: Type) -> Type: return type_ -def string_enum_type(*vals): +def string_enum_type(*vals): # type: ignore return UnionType(*[Const(String(), v) for v in vals]) -def literal(val: typing.Any) -> Const: +def literal(val: typing.Any) -> Const: # type: ignore return Const(TypeRegistry.type_of(val), val) -RUN_STATE_TYPE = string_enum_type("pending", "running", "finished", "failed") +RUN_STATE_TYPE = string_enum_type("pending", "running", "finished", "failed") # type: ignore[no-untyped-call] # TODO: get rid of all the underscores. This is another @@ -1518,7 +1518,7 @@ class RunType(ObjectType): history: Type = List(TypedDict({})) output: Type = Any() - def property_types(self): + def property_types(self): # type: ignore return { "id": String(), "op_name": String(), @@ -1529,7 +1529,7 @@ def property_types(self): "output": self.output, } - def _is_assignable_to(self, other_type) -> typing.Optional[bool]: + def _is_assignable_to(self, other_type) -> typing.Optional[bool]: # type: ignore # Use issubclass, we have RunLocalType defined as a subclass of RunType if not issubclass(other_type.__class__, RunType): if self.output == NoneType(): @@ -1601,9 +1601,9 @@ def merge_types(a: Type, b: Type) -> Type: next_prop_types[key] = merge_types(self_prop_type, other_prop_type) return TypedDict(next_prop_types) if isinstance(a, ObjectType) and isinstance(b, ObjectType): - if a.name == b.name and not set(a.type_attrs()).difference(b.type_attrs()): + if a.name == b.name and not set(a.type_attrs()).difference(b.type_attrs()): # type: ignore[no-untyped-call] next_type_attrs = {} - for key in a.type_attrs(): + for key in a.type_attrs(): # type: ignore[no-untyped-call] next_type_attrs[key] = merge_types(getattr(a, key), getattr(b, key)) return type(a)(**next_type_attrs) @@ -1737,7 +1737,7 @@ def _unknown_coalesce_on_union(u_type: UnionType) -> Type: return union(*final_types) -def _merge_unknowns_of_type_with_types(of_type: Type, with_types: list[Type]): +def _merge_unknowns_of_type_with_types(of_type: Type, with_types: list[Type]): # type: ignore # At this stage, we have a starting type and a list of peer candidate types. # These types have already been coalesced individually. This step is similar to # the outer `unknown_coalesce` function, except that rather than operating on the diff --git a/weave/legacy/weavejs_fixes.py b/weave/legacy/weavejs_fixes.py index d7d94c399f04..23c97ee64c78 100644 --- a/weave/legacy/weavejs_fixes.py +++ b/weave/legacy/weavejs_fixes.py @@ -10,7 +10,7 @@ from weave.legacy import graph -from .. import weave_types +from weave.legacy import weave_types def _convert_specific_opname_to_generic_opname( diff --git a/weave/legacy/weavify.py b/weave/legacy/weavify.py index 651cdc52b9d6..6714d6676f89 100644 --- a/weave/legacy/weavify.py +++ b/weave/legacy/weavify.py @@ -3,7 +3,7 @@ from weave.legacy import errors, graph, op_args, val_const from .. import weave_internal -from .. import weave_types as types +from weave.legacy import weave_types as types if typing.TYPE_CHECKING: from weave.legacy import op_def diff --git a/weave/tests/legacy/test_arrow.py b/weave/tests/legacy/test_arrow.py index 87058e0e6aea..889835c95887 100644 --- a/weave/tests/legacy/test_arrow.py +++ b/weave/tests/legacy/test_arrow.py @@ -12,6 +12,7 @@ # If you're thinking of import vectorize here, don't! Put your # tests in test_arrow_vectorizer.py instead from weave.legacy import ops_arrow as arrow +from weave.legacy import weave_types as types from weave.legacy.arrow import constructors from weave.legacy.arrow.arrow_tags import ( recursively_encode_pyarrow_strings_as_dictionaries, @@ -28,7 +29,6 @@ from ... import api as weave from ... import storage, weave_internal -from ... import weave_types as types 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_awl.py b/weave/tests/legacy/test_arrow_awl.py index 974de06afc70..c1949a9cb976 100644 --- a/weave/tests/legacy/test_arrow_awl.py +++ b/weave/tests/legacy/test_arrow_awl.py @@ -3,7 +3,7 @@ import pytest import weave -import weave.weave_types as types +import weave.legacy.weave_types as types from weave.legacy import box, ops_arrow from weave.legacy.arrow.convert import to_arrow from weave.legacy.language_features.tagging import tag_store, tagged_value_type diff --git a/weave/tests/legacy/test_arrow_vectorizer.py b/weave/tests/legacy/test_arrow_vectorizer.py index b5e38bf82866..04e1b0f98626 100644 --- a/weave/tests/legacy/test_arrow_vectorizer.py +++ b/weave/tests/legacy/test_arrow_vectorizer.py @@ -7,6 +7,7 @@ from weave.legacy import box, dispatch, errors, ops from weave.legacy import ops_arrow as arrow +from weave.legacy import weave_types as types from weave.legacy.language_features.tagging import ( make_tag_getter_op, tag_store, @@ -19,7 +20,6 @@ from ... import api as weave from ... import weave_internal -from ... import weave_types as types string_ops_test_cases = [ ("eq-scalar", lambda x: x == "bc", [True, False, False]), diff --git a/weave/tests/legacy/test_compile.py b/weave/tests/legacy/test_compile.py index c2ab8544bf7a..ef0ec1014bdc 100644 --- a/weave/tests/legacy/test_compile.py +++ b/weave/tests/legacy/test_compile.py @@ -3,13 +3,13 @@ import weave from weave.legacy import async_demo, compile, graph +from weave.legacy import weave_types as types from weave.legacy.dispatch import RuntimeOutputNode 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 ... import weave_types as types from ...api import use diff --git a/weave/tests/legacy/test_decorators.py b/weave/tests/legacy/test_decorators.py index 1690899112b4..e47c79db7a93 100644 --- a/weave/tests/legacy/test_decorators.py +++ b/weave/tests/legacy/test_decorators.py @@ -1,8 +1,8 @@ +from weave.legacy import weave_types as types from weave.legacy.decorator_op import op from ... import api as weave from ... import storage -from ... import weave_types as types def test_function_op_name(): diff --git a/weave/tests/legacy/test_execute.py b/weave/tests/legacy/test_execute.py index fc8cd4133327..29a8a93191fb 100644 --- a/weave/tests/legacy/test_execute.py +++ b/weave/tests/legacy/test_execute.py @@ -5,9 +5,9 @@ import weave from weave.legacy import environment, execute, ops +from weave.legacy import weave_types as types from ... import api, weave_internal -from ... import weave_types as types 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 c196dac3a863..716651dd9435 100644 --- a/weave/tests/legacy/test_execute_fast.py +++ b/weave/tests/legacy/test_execute_fast.py @@ -1,8 +1,8 @@ import weave from weave.legacy import dispatch +from weave.legacy import weave_types as types from ... import weave_internal -from ... import weave_types as types from .. import weavejs_ops diff --git a/weave/tests/legacy/test_gql_to_weave.py b/weave/tests/legacy/test_gql_to_weave.py index 088cfda7a194..e3dc869d9bf0 100644 --- a/weave/tests/legacy/test_gql_to_weave.py +++ b/weave/tests/legacy/test_gql_to_weave.py @@ -1,5 +1,5 @@ -from weave import weave_types as types from weave.legacy import gql_to_weave +from weave.legacy import weave_types as types def test_simple_query(): diff --git a/weave/tests/legacy/test_graph.py b/weave/tests/legacy/test_graph.py index 0f09e1338a6c..70051c60a179 100644 --- a/weave/tests/legacy/test_graph.py +++ b/weave/tests/legacy/test_graph.py @@ -1,8 +1,8 @@ import weave from weave.legacy import graph +from weave.legacy import weave_types as types from ... import weave_internal -from ... import weave_types as types def test_map_dag_produces_same_len(): diff --git a/weave/tests/legacy/test_infer_types.py b/weave/tests/legacy/test_infer_types.py index 5ddaf587ed10..137af307186d 100644 --- a/weave/tests/legacy/test_infer_types.py +++ b/weave/tests/legacy/test_infer_types.py @@ -1,9 +1,6 @@ import typing -from weave.legacy import graph - -from ... import weave_types -from ...legacy import infer_types +from weave.legacy import graph, infer_types, weave_types def test_node_with_generic(): diff --git a/weave/tests/legacy/test_js_compat.py b/weave/tests/legacy/test_js_compat.py index 87a7adb648cc..ba37ee1f65e9 100644 --- a/weave/tests/legacy/test_js_compat.py +++ b/weave/tests/legacy/test_js_compat.py @@ -7,8 +7,8 @@ # Note: This file is not yet complete, there are existing fixups in the # weave Python code that I haven't documented here. -from weave import weave_types as types from weave.legacy import partial_object, weavejs_fixes +from weave.legacy import weave_types as types from weave.legacy.ops_domain import wb_domain_types diff --git a/weave/tests/legacy/test_list_arrow_compat.py b/weave/tests/legacy/test_list_arrow_compat.py index 46eb15f38fdf..a38a409ae234 100644 --- a/weave/tests/legacy/test_list_arrow_compat.py +++ b/weave/tests/legacy/test_list_arrow_compat.py @@ -4,9 +4,9 @@ import pytest from weave import weave_internal -from weave import weave_types as types from weave.legacy import box, ops from weave.legacy import ops_arrow as arrow +from weave.legacy import weave_types as types from weave.legacy.language_features.tagging import ( make_tag_getter_op, tag_store, diff --git a/weave/tests/legacy/test_mappability.py b/weave/tests/legacy/test_mappability.py index 18822a65478f..e7bbcfb79cad 100644 --- a/weave/tests/legacy/test_mappability.py +++ b/weave/tests/legacy/test_mappability.py @@ -1,8 +1,8 @@ import weave from weave.legacy import context_state as _context from weave.legacy import graph +from weave.legacy import weave_types as types -from ... import weave_types as types from ...legacy import registry_mem from ...weave_internal import make_const_node diff --git a/weave/tests/legacy/test_mappers_arrow.py b/weave/tests/legacy/test_mappers_arrow.py index cc2d9f9b2586..ff380abdf19c 100644 --- a/weave/tests/legacy/test_mappers_arrow.py +++ b/weave/tests/legacy/test_mappers_arrow.py @@ -2,8 +2,8 @@ import pyarrow as pa -from weave import weave_types as types from weave.legacy import mappers_arrow +from weave.legacy import weave_types as types def test_map_list(): diff --git a/weave/tests/legacy/test_mappers_python.py b/weave/tests/legacy/test_mappers_python.py index f614a1477165..192fdefb0410 100644 --- a/weave/tests/legacy/test_mappers_python.py +++ b/weave/tests/legacy/test_mappers_python.py @@ -1,8 +1,8 @@ import math from weave import weave_internal -from weave import weave_types as types from weave.legacy import api, context, mappers_python, val_const +from weave.legacy import weave_types as types def test_map_typed_dict(): diff --git a/weave/tests/legacy/test_media.py b/weave/tests/legacy/test_media.py index ef35626c307e..175f4ad38cfa 100644 --- a/weave/tests/legacy/test_media.py +++ b/weave/tests/legacy/test_media.py @@ -3,8 +3,9 @@ import numpy as np import pytest +from weave.legacy import weave_types as types + from ... import storage -from ... import weave_types as types def test_nparray(): diff --git a/weave/tests/legacy/test_numpy.py b/weave/tests/legacy/test_numpy.py index 3ac8858e42c4..99275de1e7d8 100644 --- a/weave/tests/legacy/test_numpy.py +++ b/weave/tests/legacy/test_numpy.py @@ -1,9 +1,9 @@ import numpy as np from weave.legacy import artifact_fs, artifact_wandb +from weave.legacy import weave_types as types from weave.legacy.ops_domain import table -from ... import weave_types as types from ...legacy import types_numpy as numpy_types diff --git a/weave/tests/legacy/test_partial_object.py b/weave/tests/legacy/test_partial_object.py index 20ed18e55b1c..8096e6061b5e 100644 --- a/weave/tests/legacy/test_partial_object.py +++ b/weave/tests/legacy/test_partial_object.py @@ -1,11 +1,11 @@ from weave.legacy import compile, ops +from weave.legacy import weave_types as types from weave.legacy.language_features.tagging.tagged_value_type import TaggedValueType from weave.legacy.ops_domain import wb_domain_types as wdt from weave.legacy.ops_domain.project_ops import root_all_projects from weave.legacy.ops_domain.report_ops import root_all_reports from ... import api as weave -from ... import weave_types as types from .test_wb import table_mock1_no_display_name diff --git a/weave/tests/legacy/test_plot.py b/weave/tests/legacy/test_plot.py index 768667e3bd2e..7f0658d25298 100644 --- a/weave/tests/legacy/test_plot.py +++ b/weave/tests/legacy/test_plot.py @@ -4,8 +4,8 @@ import pytest import weave -from weave import weave_types as types from weave.legacy import graph +from weave.legacy import weave_types as types from weave.legacy.panels.panel_plot import Plot, PlotConstants, Series from ... import storage diff --git a/weave/tests/legacy/test_pydantic.py b/weave/tests/legacy/test_pydantic.py index d29a016ff013..1a57eda18cb6 100644 --- a/weave/tests/legacy/test_pydantic.py +++ b/weave/tests/legacy/test_pydantic.py @@ -3,7 +3,7 @@ import pydantic import weave -from weave import weave_types as types +from weave.legacy import weave_types as types def test_pydantic_type_inference(): diff --git a/weave/tests/legacy/test_ref_tracking.py b/weave/tests/legacy/test_ref_tracking.py index efd5d5a48952..47d8ca60408d 100644 --- a/weave/tests/legacy/test_ref_tracking.py +++ b/weave/tests/legacy/test_ref_tracking.py @@ -1,6 +1,6 @@ import weave -from weave import weave_types as types from weave.legacy import storage +from weave.legacy import weave_types as types def test_reffed_type(ref_tracking): diff --git a/weave/tests/legacy/test_run_segment.py b/weave/tests/legacy/test_run_segment.py index 3e78e3614ffe..eb0f36f81c6d 100644 --- a/weave/tests/legacy/test_run_segment.py +++ b/weave/tests/legacy/test_run_segment.py @@ -7,11 +7,11 @@ import weave from weave.legacy import ops +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 weave_types as types 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 7d86ec3b176b..030ddb134656 100644 --- a/weave/tests/legacy/test_serialize.py +++ b/weave/tests/legacy/test_serialize.py @@ -2,9 +2,9 @@ import weave from weave import weave_internal -from weave import weave_types as types from weave.legacy import api as api from weave.legacy import graph, op_args, ops, registry_mem, serialize +from weave.legacy import weave_types as types from weave.legacy.ops_primitives import list_ from weave.weave_internal import make_const_node diff --git a/weave/tests/legacy/test_storage.py b/weave/tests/legacy/test_storage.py index 3821f662a26f..4c31c43f9b7d 100644 --- a/weave/tests/legacy/test_storage.py +++ b/weave/tests/legacy/test_storage.py @@ -8,11 +8,11 @@ import wandb from weave.legacy import artifact_mem, artifact_wandb, mappers_python, ops_arrow +from weave.legacy import weave_types as types from weave.legacy.arrow import list_ as arrow from ... import api as weave from ... import storage -from ... import weave_types as types 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 10af48c52891..9296cb2e2359 100644 --- a/weave/tests/legacy/test_table_ops.py +++ b/weave/tests/legacy/test_table_ops.py @@ -4,11 +4,11 @@ import pytest from weave.legacy import box, context, context_state, graph, ops +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 weave_types as types 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 96bf56ba747b..fa691cdd77a8 100644 --- a/weave/tests/legacy/test_tagging.py +++ b/weave/tests/legacy/test_tagging.py @@ -2,6 +2,7 @@ import weave from weave.legacy import box +from weave.legacy import weave_types as types from weave.legacy.artifact_fs import FilesystemArtifactFileType from weave.legacy.language_features.tagging import ( make_tag_getter_op, @@ -15,7 +16,6 @@ from weave.legacy.ops_primitives import list_ as list_ops from ... import weave_internal -from ... import weave_types as types def test_tagged_value(): diff --git a/weave/tests/legacy/test_typeddict_notrequired.py b/weave/tests/legacy/test_typeddict_notrequired.py index b58c53964f41..0625b430aad9 100644 --- a/weave/tests/legacy/test_typeddict_notrequired.py +++ b/weave/tests/legacy/test_typeddict_notrequired.py @@ -6,8 +6,8 @@ TypedDict, ) -from weave import weave_types as types from weave.legacy import infer_types +from weave.legacy import weave_types as types class _TestNotRequiredTypedDict(TypedDict): diff --git a/weave/tests/legacy/test_wb.py b/weave/tests/legacy/test_wb.py index 9ac6a28f801e..065e4b0dc099 100644 --- a/weave/tests/legacy/test_wb.py +++ b/weave/tests/legacy/test_wb.py @@ -6,10 +6,10 @@ import pytest import wandb -from weave import weave_types as types from weave.legacy import api as weave from weave.legacy import artifact_fs, artifact_wandb, compile, graph, ops, stitch, uris from weave.legacy import ops_arrow as arrow +from weave.legacy import weave_types as types from weave.legacy.language_features.tagging.tagged_value_type import TaggedValueType from weave.legacy.ops_arrow import ArrowWeaveListType from weave.legacy.ops_domain import artifact_membership_ops as amo diff --git a/weave/tests/legacy/test_wb_data_types.py b/weave/tests/legacy/test_wb_data_types.py index 5e3ac21c54cf..7f4c7fd66f12 100644 --- a/weave/tests/legacy/test_wb_data_types.py +++ b/weave/tests/legacy/test_wb_data_types.py @@ -12,8 +12,8 @@ from wandb.sdk.data_types._dtypes import TypeRegistry as SDKTypeRegistry import weave -from weave import weave_types as types from weave.legacy import artifact_fs +from weave.legacy import weave_types as types from weave.legacy.artifact_wandb import WandbArtifact, WeaveWBArtifactURI from weave.legacy.language_features.tagging.tagged_value_type import TaggedValueType from weave.legacy.ops_domain.wbmedia import ImageArtifactFileRefType diff --git a/weave/tests/legacy/test_wb_domain_types.py b/weave/tests/legacy/test_wb_domain_types.py index d41f3ea469a6..e2a131a57f20 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 weave_types as types from weave.legacy.ops_domain import wb_domain_types as wdt from ... import api as weave from ... import storage -from ... import weave_types as types def test_with_keys_assignability(): diff --git a/weave/tests/legacy/test_wb_stream_table.py b/weave/tests/legacy/test_wb_stream_table.py index 47cda086956f..68301ad4dded 100644 --- a/weave/tests/legacy/test_wb_stream_table.py +++ b/weave/tests/legacy/test_wb_stream_table.py @@ -5,8 +5,7 @@ from PIL import Image import weave -from weave import weave_types -from weave.legacy import context, execute, gql_json_cache, wandb_api +from weave.legacy import context, execute, gql_json_cache, wandb_api, weave_types from weave.legacy.wandb_interface.wandb_stream_table import StreamTable diff --git a/weave/tests/legacy/test_weave_types.py b/weave/tests/legacy/test_weave_types.py index f19c8097114a..1c88c49d14f9 100644 --- a/weave/tests/legacy/test_weave_types.py +++ b/weave/tests/legacy/test_weave_types.py @@ -4,13 +4,13 @@ import weave import weave.legacy -import weave.weave_types +import weave.legacy.weave_types from weave.legacy import _dict_utils, runs +from weave.legacy import weave_types as types from weave.legacy.language_features.tagging.tagged_value_type import TaggedValueType from weave.legacy.ops_domain import wbmedia from ... import errors -from ... import weave_types as types def test_typeof_string(): @@ -155,23 +155,23 @@ def test_typeof_list_dict_merge(): def test_typeof_nested_dict_merge(): """Tests that nested merging is disabled.""" - t1 = weave.weave_types.TypedDict( - {"a": weave.weave_types.TypedDict({"b": types.Int()})} + t1 = weave.legacy.weave_types.TypedDict( + {"a": weave.legacy.weave_types.TypedDict({"b": types.Int()})} ) - t2 = weave.weave_types.TypedDict( - {"a": weave.weave_types.TypedDict({"c": types.String()})} + t2 = weave.legacy.weave_types.TypedDict( + {"a": weave.legacy.weave_types.TypedDict({"c": types.String()})} ) merged_type = _dict_utils.typeddict_merge_output_type({"self": t1, "other": t2}) - assert merged_type == weave.weave_types.TypedDict( - {"a": weave.weave_types.TypedDict({"c": types.String()})} + assert merged_type == weave.legacy.weave_types.TypedDict( + {"a": weave.legacy.weave_types.TypedDict({"c": types.String()})} ) def test_dict_without_key_type(): - fully_typed = weave.weave_types.TypeRegistry.type_from_dict( + fully_typed = weave.legacy.weave_types.TypeRegistry.type_from_dict( {"type": "dict", "keyType": "string", "objectType": "number"} ) - partial_typed = weave.weave_types.TypeRegistry.type_from_dict( + partial_typed = weave.legacy.weave_types.TypeRegistry.type_from_dict( {"type": "dict", "objectType": "number"} ) assert fully_typed.assign_type(partial_typed) @@ -179,24 +179,24 @@ def test_dict_without_key_type(): # def test_union_unknown(): # assert ( -# weave.weave_types.union( -# weave.weave_types.String(), weave.weave_types.UnknownType() +# weave.legacy.weave_types.union( +# weave.legacy.weave_types.String(), weave.legacy.weave_types.UnknownType() # ) -# == weave.weave_types.String() +# == weave.legacy.weave_types.String() # ) # assert ( -# weave.weave_types.union( -# weave.weave_types.UnknownType(), weave.weave_types.UnknownType() +# weave.legacy.weave_types.union( +# weave.legacy.weave_types.UnknownType(), weave.legacy.weave_types.UnknownType() # ) -# == weave.weave_types.UnknownType() +# == weave.legacy.weave_types.UnknownType() # ) # assert ( -# weave.weave_types.union( -# weave.weave_types.UnknownType(), -# weave.weave_types.UnknownType(), +# weave.legacy.weave_types.union( +# weave.legacy.weave_types.UnknownType(), +# weave.legacy.weave_types.UnknownType(), # weave.types.String(), # ) -# == weave.weave_types.String() +# == weave.legacy.weave_types.String() # ) @@ -204,76 +204,78 @@ def test_union_access(): ### Type return # Not all members have props - unioned = weave.weave_types.union( - weave.weave_types.String(), weave.weave_types.List(weave.weave_types.String()) + unioned = weave.legacy.weave_types.union( + weave.legacy.weave_types.String(), + weave.legacy.weave_types.List(weave.legacy.weave_types.String()), ) with pytest.raises(AttributeError): unioned.object_type # Combined dicts - unioned = weave.weave_types.union( - weave.weave_types.List(weave.weave_types.String()), - weave.weave_types.List(weave.weave_types.Number()), + unioned = weave.legacy.weave_types.union( + weave.legacy.weave_types.List(weave.legacy.weave_types.String()), + weave.legacy.weave_types.List(weave.legacy.weave_types.Number()), ) - assert unioned.object_type == weave.weave_types.union( - weave.weave_types.String(), weave.weave_types.Number() + assert unioned.object_type == weave.legacy.weave_types.union( + weave.legacy.weave_types.String(), weave.legacy.weave_types.Number() ) # Nullable type - unioned = weave.weave_types.union( - weave.weave_types.NoneType(), weave.weave_types.List(weave.weave_types.String()) + unioned = weave.legacy.weave_types.union( + weave.legacy.weave_types.NoneType(), + weave.legacy.weave_types.List(weave.legacy.weave_types.String()), ) - assert unioned.object_type == weave.weave_types.union( - weave.weave_types.String(), weave.weave_types.NoneType() + assert unioned.object_type == weave.legacy.weave_types.union( + weave.legacy.weave_types.String(), weave.legacy.weave_types.NoneType() ) ### Dict Return # Not all members have props - unioned = weave.weave_types.union( - weave.weave_types.String(), - weave.weave_types.TypedDict({"a": weave.weave_types.String()}), + unioned = weave.legacy.weave_types.union( + weave.legacy.weave_types.String(), + weave.legacy.weave_types.TypedDict({"a": weave.legacy.weave_types.String()}), ) with pytest.raises(AttributeError): unioned.property_types # Combined dicts - unioned = weave.weave_types.union( - weave.weave_types.TypedDict( + unioned = weave.legacy.weave_types.union( + weave.legacy.weave_types.TypedDict( { - "same": weave.weave_types.Number(), - "solo_a": weave.weave_types.Number(), - "differ": weave.weave_types.Number(), + "same": weave.legacy.weave_types.Number(), + "solo_a": weave.legacy.weave_types.Number(), + "differ": weave.legacy.weave_types.Number(), } ), - weave.weave_types.TypedDict( + weave.legacy.weave_types.TypedDict( { - "same": weave.weave_types.Number(), - "solo_b": weave.weave_types.String(), - "differ": weave.weave_types.String(), + "same": weave.legacy.weave_types.Number(), + "solo_b": weave.legacy.weave_types.String(), + "differ": weave.legacy.weave_types.String(), } ), ) assert unioned.property_types == { - "same": weave.weave_types.Number(), - "solo_a": weave.weave_types.union( - weave.weave_types.Number(), weave.weave_types.NoneType() + "same": weave.legacy.weave_types.Number(), + "solo_a": weave.legacy.weave_types.union( + weave.legacy.weave_types.Number(), weave.legacy.weave_types.NoneType() ), - "solo_b": weave.weave_types.union( - weave.weave_types.String(), weave.weave_types.NoneType() + "solo_b": weave.legacy.weave_types.union( + weave.legacy.weave_types.String(), weave.legacy.weave_types.NoneType() ), - "differ": weave.weave_types.union( - weave.weave_types.Number(), weave.weave_types.String() + "differ": weave.legacy.weave_types.union( + weave.legacy.weave_types.Number(), weave.legacy.weave_types.String() ), } # Nullable type - unioned = weave.weave_types.union( - weave.weave_types.NoneType(), - weave.weave_types.TypedDict({"a": weave.weave_types.String()}), + unioned = weave.legacy.weave_types.union( + weave.legacy.weave_types.NoneType(), + weave.legacy.weave_types.TypedDict({"a": weave.legacy.weave_types.String()}), ) assert unioned.property_types == { - "a": weave.weave_types.union( - weave.weave_types.String(), weave.weave_types.NoneType() + "a": weave.legacy.weave_types.union( + weave.legacy.weave_types.String(), weave.legacy.weave_types.NoneType() ) } diff --git a/weave/tests/legacy/test_weavejs_fixes.py b/weave/tests/legacy/test_weavejs_fixes.py index e654405a6bd7..4488b4314ef9 100644 --- a/weave/tests/legacy/test_weavejs_fixes.py +++ b/weave/tests/legacy/test_weavejs_fixes.py @@ -3,9 +3,9 @@ import pytest from weave.legacy import context_state, mappers_python, ops, weavejs_fixes +from weave.legacy import weave_types as types from ... import api, weave_internal -from ... import weave_types as types @pytest.mark.skip( diff --git a/weave/tests/legacy/test_weavify.py b/weave/tests/legacy/test_weavify.py index d869848d98d5..f5971099b433 100644 --- a/weave/tests/legacy/test_weavify.py +++ b/weave/tests/legacy/test_weavify.py @@ -1,9 +1,9 @@ import pytest from weave.legacy import graph, ops +from weave.legacy import weave_types as types from ... import weave_internal -from ... import weave_types as types from ...legacy import weavify from .. import geom diff --git a/weave/tests/tag_test_util.py b/weave/tests/tag_test_util.py index 9c2a65406043..a444466c413c 100644 --- a/weave/tests/tag_test_util.py +++ b/weave/tests/tag_test_util.py @@ -1,11 +1,10 @@ import weave from weave.legacy import box, graph from weave.legacy import context_state as _context_state +from weave.legacy import weave_types as types from weave.legacy.language_features.tagging import tag_store from weave.legacy.language_features.tagging.tagged_value_type import TaggedValueType -from .. import weave_types as types - tag_adders = 0 diff --git a/weave/tests/trace/test_server.py b/weave/tests/trace/test_server.py index 0931eefda920..1be4acbb3ccf 100644 --- a/weave/tests/trace/test_server.py +++ b/weave/tests/trace/test_server.py @@ -7,10 +7,10 @@ import requests from weave import api as weave -from weave import weave_types as types from weave.legacy import client as _client from weave.legacy import context_state, ops 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 diff --git a/weave/tests/weavejs_ops.py b/weave/tests/weavejs_ops.py index e1b22cf4694e..2d4764e3f588 100644 --- a/weave/tests/weavejs_ops.py +++ b/weave/tests/weavejs_ops.py @@ -1,6 +1,7 @@ # WeaveJS ops used for testing. These are not used in production. from weave.legacy import graph +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 from weave.legacy.language_features.tagging.tagging_op_logic import ( @@ -9,7 +10,6 @@ ) from .. import weave_internal -from .. import weave_types as types def ensure_node(v): diff --git a/weave/trace_legacy.py b/weave/trace_legacy.py index 73c5eb39950c..d8a6ec55a13e 100644 --- a/weave/trace_legacy.py +++ b/weave/trace_legacy.py @@ -2,9 +2,9 @@ import typing from weave.legacy import artifact_local, graph, ref_base, runs +from weave.legacy import weave_types as types from . import errors -from . import weave_types as types def get_obj_creator(ref: ref_base.Ref) -> typing.Optional[runs.Run]: diff --git a/weave/weave_internal.py b/weave/weave_internal.py index 3e6e82a7eb3e..014ab621db61 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, errors, graph - -from . import weave_types as types +from weave.legacy import weave_types as types def dereference_variables(