diff --git a/build_defs/BUILD b/build_defs/BUILD index 87f0ccdb3..fd4579c71 100644 --- a/build_defs/BUILD +++ b/build_defs/BUILD @@ -14,7 +14,7 @@ package(default_visibility = ["//visibility:private"]) proto_lang_toolchain( name = "python_toolchain", command_line = "--python_out=%s", - plugin = "//protos/bin:protoc_gen_mypy", + plugin = "//optic/protos/bin:protoc_gen_mypy", plugin_format_flag = "--plugin=protoc-gen-mypy=%s", progress_message = "Generating Python proto_library %{label}", runtime = "@com_google_protobuf//:protobuf_python", diff --git a/optic/cli/cli.py b/optic/cli/cli.py index 09d4d8c12..0ce0ebe6b 100644 --- a/optic/cli/cli.py +++ b/optic/cli/cli.py @@ -1,7 +1,7 @@ from absl import app from absl import flags -import protos.ui_pb2 as pb +import optic.protos.ui_pb2 as pb from optic.cli.execute_module import execute_module from optic.exceptions import format_traceback diff --git a/optic/cli/dev_cli.py b/optic/cli/dev_cli.py index 13cacb984..1bd1eeb93 100644 --- a/optic/cli/dev_cli.py +++ b/optic/cli/dev_cli.py @@ -1,7 +1,7 @@ from absl import app from absl import flags -import protos.ui_pb2 as pb +import optic.protos.ui_pb2 as pb from optic.cli.execute_module import execute_module from optic.exceptions import format_traceback diff --git a/optic/component_helpers/BUILD b/optic/component_helpers/BUILD index 0f20248c4..d5abc9b23 100644 --- a/optic/component_helpers/BUILD +++ b/optic/component_helpers/BUILD @@ -8,7 +8,7 @@ py_library( name = "component_helpers", srcs = glob(["*.py"]), deps = [ + "//optic/protos:ui_py_pb2", "//optic/runtime", - "//protos:ui_py_pb2", ], ) diff --git a/optic/component_helpers/helper.py b/optic/component_helpers/helper.py index 1c9243fd1..80a014fbc 100644 --- a/optic/component_helpers/helper.py +++ b/optic/component_helpers/helper.py @@ -2,7 +2,7 @@ from optic.runtime import runtime from optic.events import OpticEvent from optic.key import Key -import protos.ui_pb2 as pb +import optic.protos.ui_pb2 as pb class ComponentWithChildren: diff --git a/optic/components/box/box.py b/optic/components/box/box.py index 8744faedb..2e1a4a723 100644 --- a/optic/components/box/box.py +++ b/optic/components/box/box.py @@ -1,6 +1,6 @@ from pydantic import validate_arguments -import protos.ui_pb2 as pb +import optic.protos.ui_pb2 as pb import optic.components.box.box_pb2 as box_pb from optic.component_helpers import ComponentWithChildren diff --git a/optic/components/box/box.ts b/optic/components/box/box.ts index 395f1bafa..fb28c1394 100644 --- a/optic/components/box/box.ts +++ b/optic/components/box/box.ts @@ -8,7 +8,7 @@ import { Key, Type, UserEvent, -} from "optic/protos/ui_jspb_proto_pb/protos/ui_pb"; +} from "optic/optic/protos/ui_jspb_proto_pb/optic/protos/ui_pb"; import { BoxType } from "optic/optic/components/box/box_jspb_proto_pb/optic/components/box/box_pb"; import { Channel } from "../../../web/src/services/channel"; diff --git a/optic/components/button/button.py b/optic/components/button/button.py index 254c66e61..eca4d0b41 100644 --- a/optic/components/button/button.py +++ b/optic/components/button/button.py @@ -1,7 +1,7 @@ from pydantic import validate_arguments from typing import Any, Callable -import protos.ui_pb2 as pb +import optic.protos.ui_pb2 as pb import optic.components.button.button_pb2 as button_pb from optic.component_helpers import insert_component, handler_type from optic.events import ClickEvent diff --git a/optic/components/button/button.ts b/optic/components/button/button.ts index 2606bca28..e0466e566 100644 --- a/optic/components/button/button.ts +++ b/optic/components/button/button.ts @@ -3,7 +3,7 @@ import { Key, Type, UserEvent, -} from "optic/protos/ui_jspb_proto_pb/protos/ui_pb"; +} from "optic/optic/protos/ui_jspb_proto_pb/optic/protos/ui_pb"; import { ButtonType } from "optic/optic/components/button/button_jspb_proto_pb/optic/components/button/button_pb"; import { Channel } from "../../../web/src/services/channel"; import { MatButtonModule } from "@angular/material/button"; diff --git a/optic/components/checkbox/checkbox.py b/optic/components/checkbox/checkbox.py index 42d943224..b8a18d663 100644 --- a/optic/components/checkbox/checkbox.py +++ b/optic/components/checkbox/checkbox.py @@ -2,7 +2,7 @@ from pydantic import validate_arguments from typing import Any, Callable -import protos.ui_pb2 as pb +import optic.protos.ui_pb2 as pb import optic.components.checkbox.checkbox_pb2 as checkbox_pb from optic.component_helpers import ( insert_component, diff --git a/optic/components/checkbox/checkbox.ts b/optic/components/checkbox/checkbox.ts index 77c06c5e4..cc82f0678 100644 --- a/optic/components/checkbox/checkbox.ts +++ b/optic/components/checkbox/checkbox.ts @@ -3,7 +3,7 @@ import { Key, Type, UserEvent, -} from "optic/protos/ui_jspb_proto_pb/protos/ui_pb"; +} from "optic/optic/protos/ui_jspb_proto_pb/optic/protos/ui_pb"; import { CheckboxType } from "optic/optic/components/checkbox/checkbox_jspb_proto_pb/optic/components/checkbox/checkbox_pb"; import { Channel } from "../../../web/src/services/channel"; diff --git a/optic/components/defs.bzl b/optic/components/defs.bzl index 8203a3c3c..15ff35963 100644 --- a/optic/components/defs.bzl +++ b/optic/components/defs.bzl @@ -25,7 +25,7 @@ def optic_component(name, ng_deps = [], py_deps = []): ]), deps = [ ":" + jspb_proto_target, - "//protos:ui_jspb_proto", + "//optic/protos:ui_jspb_proto", "//web/src/services", ] + ANGULAR_CORE_DEPS + ANGULAR_MATERIAL_TS_DEPS + ng_deps, ) @@ -37,7 +37,7 @@ def optic_component(name, ng_deps = [], py_deps = []): ":" + py_proto_target, "//optic/component_helpers", "//optic/events", - "//protos:ui_py_pb2", + "//optic/protos:ui_py_pb2", ] + THIRD_PARTY_PY_PYDANTIC + py_deps, ) diff --git a/optic/components/text/text.py b/optic/components/text/text.py index 0abcc16e2..954bfb331 100644 --- a/optic/components/text/text.py +++ b/optic/components/text/text.py @@ -1,6 +1,6 @@ from pydantic import validate_arguments -import protos.ui_pb2 as pb +import optic.protos.ui_pb2 as pb import optic.components.text.text_pb2 as text_pb2 from optic.component_helpers import insert_component diff --git a/optic/components/text/text.ts b/optic/components/text/text.ts index a408762f7..748250495 100644 --- a/optic/components/text/text.ts +++ b/optic/components/text/text.ts @@ -1,5 +1,8 @@ import { ChangeDetectionStrategy, Component, Input } from "@angular/core"; -import { Key, Type } from "optic/protos/ui_jspb_proto_pb/protos/ui_pb"; +import { + Key, + Type, +} from "optic/optic/protos/ui_jspb_proto_pb/optic/protos/ui_pb"; import { TextType } from "optic/optic/components/text/text_jspb_proto_pb/optic/components/text/text_pb"; @Component({ diff --git a/optic/components/text_input/text_input.py b/optic/components/text_input/text_input.py index 8993dbfb1..84a6fd3d0 100644 --- a/optic/components/text_input/text_input.py +++ b/optic/components/text_input/text_input.py @@ -1,7 +1,7 @@ from pydantic import validate_arguments from typing import Any, Callable -import protos.ui_pb2 as pb +import optic.protos.ui_pb2 as pb import optic.components.text_input.text_input_pb2 as text_input_pb from optic.component_helpers import insert_component, handler_type from optic.events import ChangeEvent diff --git a/optic/components/text_input/text_input.ts b/optic/components/text_input/text_input.ts index 8582b9f12..a1d61ff44 100644 --- a/optic/components/text_input/text_input.ts +++ b/optic/components/text_input/text_input.ts @@ -3,7 +3,7 @@ import { Key, Type, UserEvent, -} from "optic/protos/ui_jspb_proto_pb/protos/ui_pb"; +} from "optic/optic/protos/ui_jspb_proto_pb/optic/protos/ui_pb"; import { TextInputType } from "optic/optic/components/text_input/text_input_jspb_proto_pb/optic/components/text_input/text_input_pb"; import { Channel } from "../../../web/src/services/channel"; import { MatFormFieldModule } from "@angular/material/form-field"; diff --git a/optic/event_handler/BUILD b/optic/event_handler/BUILD index fdca55593..000d7bc1f 100644 --- a/optic/event_handler/BUILD +++ b/optic/event_handler/BUILD @@ -10,7 +10,7 @@ py_library( deps = [ "//optic/component_helpers", "//optic/events", + "//optic/protos:ui_py_pb2", "//optic/runtime", - "//protos:ui_py_pb2", ], ) diff --git a/optic/event_handler/event_handler.py b/optic/event_handler/event_handler.py index 3e7c1ab29..4b2e0dbc4 100644 --- a/optic/event_handler/event_handler.py +++ b/optic/event_handler/event_handler.py @@ -5,7 +5,7 @@ import optic.events as events from ..component_helpers.helper import get_qualified_fn_name from optic.runtime import runtime -import protos.ui_pb2 as pb +import optic.protos.ui_pb2 as pb E = TypeVar("E", bound=events.OpticEvent) Handler = Callable[[E], None | Generator[None, None, None]] diff --git a/optic/exceptions/format_traceback.py b/optic/exceptions/format_traceback.py index ddd328dbd..e6d092fa2 100644 --- a/optic/exceptions/format_traceback.py +++ b/optic/exceptions/format_traceback.py @@ -2,7 +2,7 @@ import sys import linecache -import protos.ui_pb2 as pb +import optic.protos.ui_pb2 as pb def format_traceback(lines_before: int = 2, lines_after: int = 4) -> pb.Traceback: diff --git a/optic/key/BUILD b/optic/key/BUILD index 474d3365b..cbb4d18ea 100644 --- a/optic/key/BUILD +++ b/optic/key/BUILD @@ -8,6 +8,6 @@ py_library( name = "key", srcs = glob(["*.py"]), deps = [ - "//protos:ui_py_pb2", + "//optic/protos:ui_py_pb2", ], ) diff --git a/optic/key/key.py b/optic/key/key.py index 3e679ff7f..e021a29a0 100644 --- a/optic/key/key.py +++ b/optic/key/key.py @@ -1,5 +1,5 @@ from dataclasses import dataclass -import protos.ui_pb2 as pb +import optic.protos.ui_pb2 as pb @dataclass diff --git a/protos/BUILD b/optic/protos/BUILD similarity index 100% rename from protos/BUILD rename to optic/protos/BUILD diff --git a/protos/bin/BUILD b/optic/protos/bin/BUILD similarity index 100% rename from protos/bin/BUILD rename to optic/protos/bin/BUILD diff --git a/protos/bin/protoc_gen_mypy_wrapper.py b/optic/protos/bin/protoc_gen_mypy_wrapper.py similarity index 100% rename from protos/bin/protoc_gen_mypy_wrapper.py rename to optic/protos/bin/protoc_gen_mypy_wrapper.py diff --git a/protos/ui.proto b/optic/protos/ui.proto similarity index 100% rename from protos/ui.proto rename to optic/protos/ui.proto diff --git a/optic/runtime/BUILD b/optic/runtime/BUILD index 2d307c854..9da1b1094 100644 --- a/optic/runtime/BUILD +++ b/optic/runtime/BUILD @@ -10,6 +10,6 @@ py_library( deps = [ "//optic/dataclass_utils", "//optic/exceptions", - "//protos:ui_py_pb2", + "//optic/protos:ui_py_pb2", ], ) diff --git a/optic/runtime/context.py b/optic/runtime/context.py index fcdb86f51..bfe69687f 100644 --- a/optic/runtime/context.py +++ b/optic/runtime/context.py @@ -1,7 +1,7 @@ from dataclasses import asdict, is_dataclass import json from typing import Any, Callable, Generator, TypeVar, cast -import protos.ui_pb2 as pb +import optic.protos.ui_pb2 as pb from optic.dataclass_utils import update_dataclass_from_json T = TypeVar("T") diff --git a/optic/runtime/runtime.py b/optic/runtime/runtime.py index a36f1d414..60ce32570 100644 --- a/optic/runtime/runtime.py +++ b/optic/runtime/runtime.py @@ -3,7 +3,7 @@ from optic.key import Key from optic.events import OpticEvent -import protos.ui_pb2 as pb +import optic.protos.ui_pb2 as pb from .context import Context from optic.exceptions import OpticUserException diff --git a/optic/server/BUILD b/optic/server/BUILD index ba8817e5f..c404cdf9e 100644 --- a/optic/server/BUILD +++ b/optic/server/BUILD @@ -8,7 +8,7 @@ py_library( name = "server", srcs = glob(["*.py"]), deps = [ - "//protos:ui_py_pb2", + "//optic/protos:ui_py_pb2", ] + PYTHON_RUNFILES_DEP + THIRD_PARTY_PY_FLASK, # Note: prod_server.py has a runtime dependency on # //web/src/app/prod:web_package, so you must include it diff --git a/optic/server/server.py b/optic/server/server.py index 406c636d1..04b3ee903 100644 --- a/optic/server/server.py +++ b/optic/server/server.py @@ -3,7 +3,7 @@ from flask import Flask, Response, request -import protos.ui_pb2 as pb +import optic.protos.ui_pb2 as pb from optic.runtime import runtime from optic.exceptions import format_traceback diff --git a/scripts/component_template/component_name.py b/scripts/component_template/component_name.py index 1f5a07e5b..037fd4380 100644 --- a/scripts/component_template/component_name.py +++ b/scripts/component_template/component_name.py @@ -1,7 +1,7 @@ from pydantic import validate_arguments from typing import Any, Callable -import protos.ui_pb2 as pb +import optic.protos.ui_pb2 as pb import optic.components.component_name.component_name_pb2 as component_name_pb from optic.component_helpers import insert_component, handler_type from optic.events import ClickEvent diff --git a/scripts/component_template/component_name.ts b/scripts/component_template/component_name.ts index 5b622873f..ece5d8e19 100644 --- a/scripts/component_template/component_name.ts +++ b/scripts/component_template/component_name.ts @@ -4,7 +4,7 @@ import { Key, Type, UserEvent, -} from "optic/protos/ui_jspb_proto_pb/protos/ui_pb"; +} from "optic/optic/protos/ui_jspb_proto_pb/optic/protos/ui_pb"; import { ComponentNameType } from "optic/optic/components/component_name/component_name_jspb_proto_pb/optic/components/component_name/component_name_pb"; import { Channel } from "../../../web/src/services/channel"; diff --git a/scripts/setup_proto_py_modules.sh b/scripts/setup_proto_py_modules.sh index 531b81a6f..a9ae41a4c 100755 --- a/scripts/setup_proto_py_modules.sh +++ b/scripts/setup_proto_py_modules.sh @@ -1,7 +1,7 @@ # Needed for VS Code to provide Python type-checking against generated proto stubs. bazel_bin_path=$(bazel info bazel-bin) -touch "${bazel_bin_path}/protos/__init__.py" && \ touch "${bazel_bin_path}/optic/__init__.py" && \ +touch "${bazel_bin_path}/optic/protos/__init__.py" && \ touch "${bazel_bin_path}/optic/components/__init__.py" && find "${bazel_bin_path}/optic/components/" -type d -exec touch {}/__init__.py \; diff --git a/web/src/app/BUILD b/web/src/app/BUILD index d106b0b92..7b15c81db 100644 --- a/web/src/app/BUILD +++ b/web/src/app/BUILD @@ -13,7 +13,7 @@ ng_module( "app.ng.html", ], deps = [ - "//protos:ui_jspb_proto", + "//optic/protos:ui_jspb_proto", "//web/src/component_renderer", "//web/src/dev_tools", "//web/src/error", diff --git a/web/src/app/app.ts b/web/src/app/app.ts index 235dbf5b9..7e41265ba 100644 --- a/web/src/app/app.ts +++ b/web/src/app/app.ts @@ -6,7 +6,7 @@ import { ViewChild, } from "@angular/core"; import { MatProgressBarModule } from "@angular/material/progress-bar"; -import * as pb from "optic/protos/ui_jspb_proto_pb/protos/ui_pb"; +import * as pb from "optic/optic/protos/ui_jspb_proto_pb/optic/protos/ui_pb"; import { CommonModule } from "@angular/common"; import { ComponentRenderer } from "../component_renderer/component_renderer"; import { Channel, ChannelStatus } from "../services/channel"; diff --git a/web/src/component_renderer/BUILD b/web/src/component_renderer/BUILD index e5805b4c4..f2244bd9f 100644 --- a/web/src/component_renderer/BUILD +++ b/web/src/component_renderer/BUILD @@ -19,6 +19,6 @@ ng_module( "//optic/components/button:ng", "//optic/components/checkbox:ng", "//optic/components/text:ng", - "//protos:ui_jspb_proto", + "//optic/protos:ui_jspb_proto", ] + ANGULAR_CORE_DEPS, ) diff --git a/web/src/component_renderer/component_renderer.ts b/web/src/component_renderer/component_renderer.ts index 47c0d8004..34e1990d8 100644 --- a/web/src/component_renderer/component_renderer.ts +++ b/web/src/component_renderer/component_renderer.ts @@ -1,6 +1,6 @@ import { Component, Input } from "@angular/core"; import { CommonModule } from "@angular/common"; -import * as pb from "optic/protos/ui_jspb_proto_pb/protos/ui_pb"; +import * as pb from "optic/optic/protos/ui_jspb_proto_pb/optic/protos/ui_pb"; import { CheckboxComponent } from "../../../optic/components/checkbox/checkbox"; import { ButtonComponent } from "../../../optic/components/button/button"; import { TextComponent } from "../../../optic/components/text/text"; diff --git a/web/src/dev_tools/BUILD b/web/src/dev_tools/BUILD index 0539c29b1..582a24d3a 100644 --- a/web/src/dev_tools/BUILD +++ b/web/src/dev_tools/BUILD @@ -13,7 +13,7 @@ ng_module( "*.ng.html", ]) + [":dev_tools.css"], deps = [ - "//protos:ui_jspb_proto", + "//optic/protos:ui_jspb_proto", "//web/src/dev_tools/components_panel", "//web/src/dev_tools/logs_panel", ] + ANGULAR_CORE_DEPS, diff --git a/web/src/dev_tools/component_tree/BUILD b/web/src/dev_tools/component_tree/BUILD index b7a73b973..2e0796584 100644 --- a/web/src/dev_tools/component_tree/BUILD +++ b/web/src/dev_tools/component_tree/BUILD @@ -13,7 +13,7 @@ ng_module( "*.ng.html", ]) + [":component_tree.css"], deps = [ - "//protos:ui_jspb_proto", + "//optic/protos:ui_jspb_proto", "//web/src/component_renderer", "//web/src/services", ] + ANGULAR_CORE_DEPS, diff --git a/web/src/dev_tools/components_panel/BUILD b/web/src/dev_tools/components_panel/BUILD index 3c303a863..c1b16eb37 100644 --- a/web/src/dev_tools/components_panel/BUILD +++ b/web/src/dev_tools/components_panel/BUILD @@ -13,7 +13,7 @@ ng_module( "*.ng.html", ]) + [":components_panel.css"], deps = [ - "//protos:ui_jspb_proto", + "//optic/protos:ui_jspb_proto", "//web/src/dev_tools/component_tree", "//web/src/dev_tools/object_tree", "//web/src/services", diff --git a/web/src/dev_tools/logs_panel/BUILD b/web/src/dev_tools/logs_panel/BUILD index 0dc176ad7..b9ebc6486 100644 --- a/web/src/dev_tools/logs_panel/BUILD +++ b/web/src/dev_tools/logs_panel/BUILD @@ -13,7 +13,7 @@ ng_module( "*.ng.html", ]) + [":logs_panel.css"], deps = [ - "//protos:ui_jspb_proto", + "//optic/protos:ui_jspb_proto", "//web/src/component_renderer", "//web/src/dev_tools/object_tree", "//web/src/services", diff --git a/web/src/dev_tools/object_tree/BUILD b/web/src/dev_tools/object_tree/BUILD index 554fb95be..06cb52cda 100644 --- a/web/src/dev_tools/object_tree/BUILD +++ b/web/src/dev_tools/object_tree/BUILD @@ -13,7 +13,7 @@ ng_module( "*.ng.html", ]) + [":object_tree.css"], deps = [ - "//protos:ui_jspb_proto", + "//optic/protos:ui_jspb_proto", "//web/src/component_renderer", "//web/src/services", ] + ANGULAR_CORE_DEPS, diff --git a/web/src/dev_tools/services/BUILD b/web/src/dev_tools/services/BUILD index c21f97e58..e65f403d2 100644 --- a/web/src/dev_tools/services/BUILD +++ b/web/src/dev_tools/services/BUILD @@ -16,6 +16,6 @@ ng_module( "//optic/components/checkbox:checkbox_jspb_proto", "//optic/components/text:text_jspb_proto", "//optic/components/text_input:text_input_jspb_proto", - "//protos:ui_jspb_proto", + "//optic/protos:ui_jspb_proto", ] + ANGULAR_CORE_DEPS, ) diff --git a/web/src/dev_tools/services/logger.ts b/web/src/dev_tools/services/logger.ts index d11ad297b..21f7c0338 100644 --- a/web/src/dev_tools/services/logger.ts +++ b/web/src/dev_tools/services/logger.ts @@ -1,5 +1,5 @@ import { Injectable } from "@angular/core"; -import * as pb from "optic/protos/ui_jspb_proto_pb/protos/ui_pb"; +import * as pb from "optic/optic/protos/ui_jspb_proto_pb/optic/protos/ui_pb"; import { TypeDeserializer } from "./type_deserializer"; import { Observable, Subject } from "rxjs"; diff --git a/web/src/error/BUILD b/web/src/error/BUILD index 05f639a7b..f48022c4e 100644 --- a/web/src/error/BUILD +++ b/web/src/error/BUILD @@ -13,7 +13,7 @@ ng_module( "*.ng.html", ]) + [":error_box.css"], deps = [ - "//protos:ui_jspb_proto", + "//optic/protos:ui_jspb_proto", "//web/src/component_renderer", "//web/src/services", ] + ANGULAR_CORE_DEPS, diff --git a/web/src/error/error_box.ts b/web/src/error/error_box.ts index 191ced750..fef3c4e25 100644 --- a/web/src/error/error_box.ts +++ b/web/src/error/error_box.ts @@ -1,6 +1,6 @@ import { Component, Input } from "@angular/core"; import { MatProgressBarModule } from "@angular/material/progress-bar"; -import * as pb from "optic/protos/ui_jspb_proto_pb/protos/ui_pb"; +import * as pb from "optic/optic/protos/ui_jspb_proto_pb/optic/protos/ui_pb"; import { CommonModule } from "@angular/common"; import { ComponentRenderer } from "../component_renderer/component_renderer"; import { Channel } from "../services/channel"; diff --git a/web/src/services/BUILD b/web/src/services/BUILD index 9d98ac757..ff3f08a44 100644 --- a/web/src/services/BUILD +++ b/web/src/services/BUILD @@ -10,7 +10,7 @@ ng_module( "*.ts", ]), deps = [ - "//protos:ui_jspb_proto", + "//optic/protos:ui_jspb_proto", "//web/src/dev_tools/services", ] + ANGULAR_CORE_DEPS, ) diff --git a/web/src/services/channel.ts b/web/src/services/channel.ts index 297eee2d7..5a10da622 100644 --- a/web/src/services/channel.ts +++ b/web/src/services/channel.ts @@ -1,5 +1,5 @@ import { Injectable, NgZone } from "@angular/core"; -import * as pb from "optic/protos/ui_jspb_proto_pb/protos/ui_pb"; +import * as pb from "optic/optic/protos/ui_jspb_proto_pb/optic/protos/ui_pb"; import { Logger } from "../dev_tools/services/logger"; const anyWindow = window as any;