Skip to content

Commit

Permalink
Move protos/ to subdir in optic/
Browse files Browse the repository at this point in the history
  • Loading branch information
wwwillchen committed Dec 7, 2023
1 parent 106baee commit e93bd14
Show file tree
Hide file tree
Showing 48 changed files with 48 additions and 45 deletions.
2 changes: 1 addition & 1 deletion build_defs/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion optic/cli/cli.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion optic/cli/dev_cli.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion optic/component_helpers/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ py_library(
name = "component_helpers",
srcs = glob(["*.py"]),
deps = [
"//optic/protos:ui_py_pb2",
"//optic/runtime",
"//protos:ui_py_pb2",
],
)
2 changes: 1 addition & 1 deletion optic/component_helpers/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion optic/components/box/box.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion optic/components/box/box.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
2 changes: 1 addition & 1 deletion optic/components/button/button.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion optic/components/button/button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
2 changes: 1 addition & 1 deletion optic/components/checkbox/checkbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion optic/components/checkbox/checkbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
4 changes: 2 additions & 2 deletions optic/components/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand All @@ -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,
)

Expand Down
2 changes: 1 addition & 1 deletion optic/components/text/text.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
5 changes: 4 additions & 1 deletion optic/components/text/text.ts
Original file line number Diff line number Diff line change
@@ -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({
Expand Down
2 changes: 1 addition & 1 deletion optic/components/text_input/text_input.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion optic/components/text_input/text_input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
2 changes: 1 addition & 1 deletion optic/event_handler/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ py_library(
deps = [
"//optic/component_helpers",
"//optic/events",
"//optic/protos:ui_py_pb2",
"//optic/runtime",
"//protos:ui_py_pb2",
],
)
2 changes: 1 addition & 1 deletion optic/event_handler/event_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]]
Expand Down
2 changes: 1 addition & 1 deletion optic/exceptions/format_traceback.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion optic/key/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ py_library(
name = "key",
srcs = glob(["*.py"]),
deps = [
"//protos:ui_py_pb2",
"//optic/protos:ui_py_pb2",
],
)
2 changes: 1 addition & 1 deletion optic/key/key.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from dataclasses import dataclass
import protos.ui_pb2 as pb
import optic.protos.ui_pb2 as pb


@dataclass
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion optic/runtime/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ py_library(
deps = [
"//optic/dataclass_utils",
"//optic/exceptions",
"//protos:ui_py_pb2",
"//optic/protos:ui_py_pb2",
],
)
2 changes: 1 addition & 1 deletion optic/runtime/context.py
Original file line number Diff line number Diff line change
@@ -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")
Expand Down
2 changes: 1 addition & 1 deletion optic/runtime/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion optic/server/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion optic/server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion scripts/component_template/component_name.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion scripts/component_template/component_name.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
2 changes: 1 addition & 1 deletion scripts/setup_proto_py_modules.sh
Original file line number Diff line number Diff line change
@@ -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 \;
2 changes: 1 addition & 1 deletion web/src/app/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion web/src/app/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
2 changes: 1 addition & 1 deletion web/src/component_renderer/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
2 changes: 1 addition & 1 deletion web/src/component_renderer/component_renderer.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
2 changes: 1 addition & 1 deletion web/src/dev_tools/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion web/src/dev_tools/component_tree/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion web/src/dev_tools/components_panel/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion web/src/dev_tools/logs_panel/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion web/src/dev_tools/object_tree/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion web/src/dev_tools/services/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
2 changes: 1 addition & 1 deletion web/src/dev_tools/services/logger.ts
Original file line number Diff line number Diff line change
@@ -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";

Expand Down
2 changes: 1 addition & 1 deletion web/src/error/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion web/src/error/error_box.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
2 changes: 1 addition & 1 deletion web/src/services/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
2 changes: 1 addition & 1 deletion web/src/services/channel.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down

0 comments on commit e93bd14

Please sign in to comment.