Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(weave): Legacy Refactor pt6 #2223

Merged
merged 4 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion weave/legacy/arrow/list_.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

from weave import (
errors,
node_ref,
ref_base,
ref_util,
weave_internal,
Expand All @@ -27,6 +26,7 @@
graph,
op_def,
op_def_type,
node_ref,
)
from weave.legacy.arrow.arrow import (
ArrowWeaveListType,
Expand Down
2 changes: 1 addition & 1 deletion weave/legacy/artifact_wandb.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
from wandb.sdk.lib.hashutil import b64_to_hex_id, hex_to_b64_id

from weave import (
eager,
engine_trace,
errors,
filesystem,
Expand All @@ -24,6 +23,7 @@
from weave import weave_types as types
from weave.legacy import (
artifact_fs,
eager,
file_base,
file_util,
memo,
Expand Down
2 changes: 1 addition & 1 deletion weave/legacy/compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
engine_trace,
errors,
registry_mem,
stitch,
weave_internal,
)
from weave import weave_types as types
Expand All @@ -28,6 +27,7 @@
partial_object,
propagate_gql_keys,
serialize,
stitch,
value_or_error,
)
from weave.legacy.language_features.tagging import tagged_value_type_helpers
Expand Down
4 changes: 2 additions & 2 deletions weave/legacy/compile_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import graphql

from weave import errors, registry_mem, stitch
from weave import errors, registry_mem
from weave import weave_types as types
from weave.legacy import gql_op_plugin, gql_to_weave, graph, op_args
from weave.legacy import gql_op_plugin, gql_to_weave, graph, op_args, stitch
from weave.legacy.input_provider import InputAndStitchProvider

if typing.TYPE_CHECKING:
Expand Down
3 changes: 2 additions & 1 deletion weave/legacy/compile_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

import typing

from weave import errors, stitch
from weave import errors
from weave.legacy import stitch

KeyTree = typing.Dict[str, "KeyTree"] # type:ignore

Expand Down
4 changes: 2 additions & 2 deletions weave/legacy/decorator_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

from typing_extensions import ParamSpec

from weave import pyfunc_type_util, registry_mem
from weave import registry_mem
from weave import weave_types as types
from weave.legacy import context_state, derive_op, op_args, op_def
from weave.legacy import context_state, derive_op, op_args, op_def, pyfunc_type_util

if typing.TYPE_CHECKING:
from weave.legacy.gql_op_plugin import GqlOpPlugin
Expand Down
4 changes: 2 additions & 2 deletions weave/legacy/dispatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
import typing
from dataclasses import dataclass

from weave import errors, pyfunc_type_util, registry_mem, util
from weave import errors, registry_mem, util
from weave import weave_types as types
from weave.legacy import graph, memo, op_args, op_def
from weave.legacy import graph, memo, op_args, op_def, pyfunc_type_util
from weave.legacy.language_features.tagging.is_tag_getter import is_tag_getter
from weave.legacy.language_features.tagging.tagged_value_type import TaggedValueType

Expand Down
4 changes: 2 additions & 2 deletions weave/eager.py → weave/legacy/eager.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

from weave.legacy import context_state, graph

from . import weave_internal
from . import weave_types as types
from .. import weave_internal
from .. import weave_types as types

WeaveIterObjectType = typing.TypeVar("WeaveIterObjectType")

Expand Down
2 changes: 1 addition & 1 deletion weave/legacy/execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from collections.abc import Mapping

from weave import (
eager,
engine_trace,
environment,
errors,
Expand All @@ -32,6 +31,7 @@
compile,
context,
context_state,
eager,
forward_graph,
graph,
graph_debug,
Expand Down
4 changes: 2 additions & 2 deletions weave/legacy/graph_mapper.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from weave import node_ref, ref_base
from weave import ref_base
from weave import weave_types as types
from weave.legacy import graph, mappers
from weave.legacy import graph, mappers, node_ref
from weave.legacy import mappers_python_def as mappers_python


Expand Down
2 changes: 1 addition & 1 deletion weave/legacy/input_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import typing
from dataclasses import dataclass, field

from .. import stitch
from . import stitch


@dataclass
Expand Down
3 changes: 2 additions & 1 deletion weave/legacy/mappers_arrow.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@

import pyarrow as pa

from weave import errors, node_ref, ref_base
from weave import errors, ref_base
from weave import weave_types as types
from weave.legacy import (
arrow_util,
artifact_base,
box,
mappers,
mappers_weave,
node_ref,
partial_object,
)
from weave.legacy import mappers_python_def as mappers_python
Expand Down
2 changes: 1 addition & 1 deletion weave/legacy/mappers_publisher.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from weave import errors, ref_base, storage, weave_internal
from weave import weave_types as types
from weave.node_ref import ref_to_node
from weave.legacy.node_ref import ref_to_node

# from weave.legacy.ops_primitives import weave_api
from weave.legacy import (
Expand Down
2 changes: 1 addition & 1 deletion weave/node_ref.py → weave/legacy/node_ref.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from weave.legacy import graph

from . import ref_base
from .. import ref_base

# Notes for the future:
# - I added list.lookup to lookup rows in a list by ID. I think we probably should
Expand Down
2 changes: 1 addition & 1 deletion weave/legacy/op_def.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from weave import (
engine_trace,
errors,
pyfunc_type_util,
weave_internal,
)
from weave import weave_types as types
Expand All @@ -22,6 +21,7 @@
op_args,
op_def_type,
op_execute,
pyfunc_type_util,
uris,
)
from weave.legacy.language_features.tagging import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

from weave.legacy import infer_types, op_args

from . import errors
from . import weave_types as types
from .. import errors
from .. import weave_types as types

InputTypeItemType = typing.Union[types.Type, typing.Callable[..., types.Type]]
InputTypeType = typing.Union[op_args.OpArgs, typing.Mapping[str, InputTypeItemType]]
Expand Down
2 changes: 1 addition & 1 deletion weave/legacy/run_streamtable_span.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from typing import Iterable

from weave.legacy import stream_data_interfaces
from weave.eager import WeaveIter
from weave.legacy.eager import WeaveIter
from weave.legacy import artifact_wandb, uris
from weave.legacy.run import Run

Expand Down
4 changes: 2 additions & 2 deletions weave/legacy/show.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

from IPython.display import IFrame, display

from weave.legacy import artifact_fs, context, graph, ops, panel
from weave import errors, node_ref, ref_base, storage, util
from weave.legacy import artifact_fs, context, graph, ops, node_ref, panel
from weave import errors, ref_base, storage, util
from . import usage_analytics
from .. import weave_types as types
from . import weavejs_fixes
Expand Down
6 changes: 3 additions & 3 deletions weave/stitch.py → weave/legacy/stitch.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
from weave.legacy import graph, op_def
from weave.legacy.language_features.tagging import opdef_util

from . import errors, registry_mem
from . import weave_types as types
from .legacy import _dict_utils
from .. import errors, registry_mem
from .. import weave_types as types
from . import _dict_utils


@dataclasses.dataclass
Expand Down
4 changes: 2 additions & 2 deletions weave/serve_fastapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
except ImportError:
from typing_extensions import Annotated # type: ignore

from weave.legacy import cache, op_args
from weave.legacy import cache, op_args, pyfunc_type_util
from weave.legacy.wandb_api import WandbApiAsync
from weave.trace.op import Op
from weave.trace.refs import ObjectRef

from . import errors, pyfunc_type_util, weave_pydantic
from . import errors, weave_pydantic

key_cache: cache.LruTimeWindowCache[str, typing.Optional[bool]] = (
cache.LruTimeWindowCache(datetime.timedelta(minutes=5))
Expand Down
2 changes: 1 addition & 1 deletion weave/tests/legacy/test_node_ref.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from weave.legacy import graph

from ... import api as weave
from ... import node_ref
from ...legacy import node_ref


def test_node_to_ref():
Expand Down
3 changes: 2 additions & 1 deletion weave/tests/legacy/test_stitch.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
from weave.legacy.language_features.tagging import make_tag_getter_op
from weave.legacy.ops_domain import run_ops

from ... import stitch, weave_internal
from ... import weave_internal
from ...legacy import stitch
from .. import fixture_fakewandb as fwb
from . import test_wb

Expand Down
3 changes: 1 addition & 2 deletions weave/tests/legacy/test_wb.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
import wandb

from weave import query_api as weave
from weave import stitch
from weave import weave_types as types
from weave.legacy import artifact_fs, artifact_wandb, compile, graph, ops, uris
from weave.legacy import artifact_fs, artifact_wandb, compile, graph, ops, stitch, uris
from weave.legacy import ops_arrow as arrow
from weave.legacy.language_features.tagging.tagged_value_type import TaggedValueType
from weave.legacy.ops_arrow import ArrowWeaveListType
Expand Down
Loading