diff --git a/py_proto/.bazelignore b/.bazelignore similarity index 82% rename from py_proto/.bazelignore rename to .bazelignore index 25d48ceb..1143aab1 100644 --- a/py_proto/.bazelignore +++ b/.bazelignore @@ -1,7 +1,7 @@ # Bazel bazel-bin bazel-out -bazel-py_proto +bazel-monorepo bazel-rules bazel-testlogs diff --git a/py_proto/.bazelrc b/.bazelrc similarity index 100% rename from py_proto/.bazelrc rename to .bazelrc diff --git a/py_proto/.bazelversion b/.bazelversion similarity index 100% rename from py_proto/.bazelversion rename to .bazelversion diff --git a/py_proto/.github/dependabot.yml b/.github/dependabot.yml similarity index 86% rename from py_proto/.github/dependabot.yml rename to .github/dependabot.yml index 4c0fa9f8..dc11ed78 100644 --- a/py_proto/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -5,6 +5,6 @@ updates: schedule: interval: "weekly" - package-ecosystem: "pip" - directory: "/src" + directory: "/src/python" schedule: interval: "weekly" diff --git a/py_proto/.github/workflows/ci.bazelrc b/.github/workflows/ci.bazelrc similarity index 100% rename from py_proto/.github/workflows/ci.bazelrc rename to .github/workflows/ci.bazelrc diff --git a/py_proto/.github/workflows/main.yml b/.github/workflows/main.yml similarity index 100% rename from py_proto/.github/workflows/main.yml rename to .github/workflows/main.yml diff --git a/.gitignore b/.gitignore index 68bc17f9..050ed12d 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,7 @@ parts/ sdist/ var/ wheels/ +pip-wheel-metadata/ share/python-wheels/ *.egg-info/ .installed.cfg @@ -49,7 +50,6 @@ coverage.xml *.py,cover .hypothesis/ .pytest_cache/ -cover/ # Translations *.mo @@ -72,7 +72,6 @@ instance/ docs/_build/ # PyBuilder -.pybuilder/ target/ # Jupyter Notebook @@ -83,9 +82,7 @@ profile_default/ ipython_config.py # pyenv -# For a library or package, you might want to ignore these files since the code is -# intended to run in multiple environments; otherwise, check them in: -# .python-version +.python-version # pipenv # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. @@ -94,22 +91,7 @@ ipython_config.py # install all needed dependencies. #Pipfile.lock -# poetry -# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. -# This is especially recommended for binary packages to ensure reproducibility, and is more -# commonly ignored for libraries. -# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control -#poetry.lock - -# pdm -# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. -#pdm.lock -# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it -# in version control. -# https://pdm.fming.dev/#use-with-ide -.pdm.toml - -# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm +# PEP 582; used by e.g. github.com/David-OConnor/pyflow __pypackages__/ # Celery stuff @@ -146,15 +128,9 @@ dmypy.json # Pyre type checker .pyre/ -# pytype static type analyzer -.pytype/ - -# Cython debug symbols -cython_debug/ - -# PyCharm -# JetBrains specific template is maintained in a separate JetBrains.gitignore that can -# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore -# and can be added to the global gitignore or merged into this file. For a more nuclear -# option (not recommended) you can uncomment the following to ignore the entire idea folder. -#.idea/ +# Bazel +bazel-bin +bazel-out +bazel-monorepo +bazel-rules +bazel-testlogs diff --git a/py_proto/.pre-commit-config.yaml b/.pre-commit-config.yaml similarity index 100% rename from py_proto/.pre-commit-config.yaml rename to .pre-commit-config.yaml diff --git a/py_proto/BUILD.bazel b/BUILD.bazel similarity index 100% rename from py_proto/BUILD.bazel rename to BUILD.bazel diff --git a/py_proto/MODULE.bazel b/MODULE.bazel similarity index 86% rename from py_proto/MODULE.bazel rename to MODULE.bazel index 83fd0caf..23589210 100644 --- a/py_proto/MODULE.bazel +++ b/MODULE.bazel @@ -8,7 +8,7 @@ python.toolchain( pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip") pip.parse( python_version = "3.10", - requirements_lock = "//src:requirements.txt", + requirements_lock = "//src/python:requirements.txt", ) use_repo(pip, "py_proto_deps") diff --git a/py_proto/MODULE.bazel.lock b/MODULE.bazel.lock similarity index 99% rename from py_proto/MODULE.bazel.lock rename to MODULE.bazel.lock index aeeacbe8..fc6ba0cc 100644 --- a/py_proto/MODULE.bazel.lock +++ b/MODULE.bazel.lock @@ -1,6 +1,6 @@ { "lockFileVersion": 3, - "moduleFileHash": "60ddefc0e85720d83b75b5ac5f314791a9cd92eee654d7ca947f3c9e3d587d0b", + "moduleFileHash": "ec462b82eb4ad120de737440098db4a351a0cf8845c81d6a778a4bdb0b2bb5dd", "flags": { "cmdRegistries": [ "https://bcr.bazel.build/" @@ -30,7 +30,7 @@ "usingModule": "", "location": { "file": "@@//:MODULE.bazel", - "line": 2, + "line": 3, "column": 23 }, "imports": {}, @@ -44,7 +44,7 @@ "devDependency": false, "location": { "file": "@@//:MODULE.bazel", - "line": 3, + "line": 4, "column": 17 } } @@ -58,7 +58,7 @@ "usingModule": "", "location": { "file": "@@//:MODULE.bazel", - "line": 7, + "line": 8, "column": 20 }, "imports": { @@ -70,12 +70,12 @@ "tagName": "parse", "attributeValues": { "python_version": "3.10", - "requirements_lock": "//src:requirements.txt" + "requirements_lock": "//src/python:requirements.txt" }, "devDependency": false, "location": { "file": "@@//:MODULE.bazel", - "line": 8, + "line": 9, "column": 10 } } diff --git a/py_proto/WORKSPACE b/WORKSPACE similarity index 93% rename from py_proto/WORKSPACE rename to WORKSPACE index 09769056..220045a3 100644 --- a/py_proto/WORKSPACE +++ b/WORKSPACE @@ -1,5 +1,5 @@ workspace( - name = "py_proto", + name = "com_github_shaldengeki_monorepo", ) load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") diff --git a/py_proto/.gitignore b/py_proto/.gitignore deleted file mode 100644 index 258215d1..00000000 --- a/py_proto/.gitignore +++ /dev/null @@ -1,136 +0,0 @@ -# Byte-compiled / optimized / DLL files -__pycache__/ -*.py[cod] -*$py.class - -# C extensions -*.so - -# Distribution / packaging -.Python -build/ -develop-eggs/ -dist/ -downloads/ -eggs/ -.eggs/ -lib/ -lib64/ -parts/ -sdist/ -var/ -wheels/ -pip-wheel-metadata/ -share/python-wheels/ -*.egg-info/ -.installed.cfg -*.egg -MANIFEST - -# PyInstaller -# Usually these files are written by a python script from a template -# before PyInstaller builds the exe, so as to inject date/other infos into it. -*.manifest -*.spec - -# Installer logs -pip-log.txt -pip-delete-this-directory.txt - -# Unit test / coverage reports -htmlcov/ -.tox/ -.nox/ -.coverage -.coverage.* -.cache -nosetests.xml -coverage.xml -*.cover -*.py,cover -.hypothesis/ -.pytest_cache/ - -# Translations -*.mo -*.pot - -# Django stuff: -*.log -local_settings.py -db.sqlite3 -db.sqlite3-journal - -# Flask stuff: -instance/ -.webassets-cache - -# Scrapy stuff: -.scrapy - -# Sphinx documentation -docs/_build/ - -# PyBuilder -target/ - -# Jupyter Notebook -.ipynb_checkpoints - -# IPython -profile_default/ -ipython_config.py - -# pyenv -.python-version - -# pipenv -# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. -# However, in case of collaboration, if having platform-specific dependencies or dependencies -# having no cross-platform support, pipenv may install dependencies that don't work, or not -# install all needed dependencies. -#Pipfile.lock - -# PEP 582; used by e.g. github.com/David-OConnor/pyflow -__pypackages__/ - -# Celery stuff -celerybeat-schedule -celerybeat.pid - -# SageMath parsed files -*.sage.py - -# Environments -.env -.venv -env/ -venv/ -ENV/ -env.bak/ -venv.bak/ - -# Spyder project settings -.spyderproject -.spyproject - -# Rope project settings -.ropeproject - -# mkdocs documentation -/site - -# mypy -.mypy_cache/ -.dmypy.json -dmypy.json - -# Pyre type checker -.pyre/ - -# Bazel -bazel-bin -bazel-out -bazel-py_proto -bazel-rules -bazel-testlogs diff --git a/py_proto/LICENSE b/py_proto/LICENSE deleted file mode 100644 index 4220c1dc..00000000 --- a/py_proto/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2022 Charles OuGuo - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/py_proto/test/BUILD.bazel b/py_proto/test/BUILD.bazel deleted file mode 100644 index 69fd8278..00000000 --- a/py_proto/test/BUILD.bazel +++ /dev/null @@ -1,239 +0,0 @@ -load("@rules_python//python:defs.bzl", "py_test") - -py_test( - name = "proto_string_literal_test", - srcs = ["proto_string_literal_test.py"], - deps = [ - "//src:proto_string_literal", - ], -) - -py_test( - name = "proto_identifier_test", - srcs = ["proto_identifier_test.py"], - deps = [ - "//src:proto_identifier", - ], -) - -py_test( - name = "proto_bool_test", - srcs = ["proto_bool_test.py"], - deps = [ - "//src:proto_bool", - ], -) - -py_test( - name = "proto_int_test", - srcs = ["proto_int_test.py"], - deps = [ - "//src:proto_int", - ], -) - -py_test( - name = "proto_float_test", - srcs = ["proto_float_test.py"], - deps = [ - "//src:proto_float", - ], -) - -py_test( - name = "proto_constant_test", - srcs = ["proto_constant_test.py"], - deps = [ - "//src:proto_bool", - "//src:proto_constant", - "//src:proto_identifier", - "//src:proto_int", - "//src:proto_string_literal", - ], -) - -py_test( - name = "proto_extensions_test", - srcs = ["proto_extensions_test.py"], - deps = [ - "//src:proto_extensions", - ], -) - -py_test( - name = "proto_option_test", - srcs = ["proto_option_test.py"], - deps = [ - "//src:proto_bool", - "//src:proto_constant", - "//src:proto_identifier", - "//src:proto_int", - "//src:proto_option", - "//src:proto_string_literal", - ], -) - -py_test( - name = "proto_range_test", - srcs = ["proto_range_test.py"], - deps = [ - "//src:proto_range", - ], -) - -py_test( - name = "proto_reserved_test", - srcs = ["proto_reserved_test.py"], - deps = [ - "//src:proto_reserved", - ], -) - -py_test( - name = "proto_syntax_test", - srcs = ["proto_syntax_test.py"], - deps = [ - "//src:proto_string_literal", - "//src:proto_syntax", - ], -) - -py_test( - name = "proto_import_test", - srcs = ["proto_import_test.py"], - deps = [ - "//src:proto_import", - "//src:proto_string_literal", - ], -) - -py_test( - name = "proto_package_test", - srcs = ["proto_package_test.py"], - deps = [ - "//src:proto_package", - ], -) - -py_test( - name = "proto_message_field_test", - srcs = ["proto_message_field_test.py"], - deps = [ - "//src:proto_identifier", - "//src:proto_int", - "//src:proto_message_field", - ], -) - -py_test( - name = "proto_map_test", - srcs = ["proto_map_test.py"], - deps = [ - "//src:proto_bool", - "//src:proto_comment", - "//src:proto_constant", - "//src:proto_enum", - "//src:proto_extend", - "//src:proto_extensions", - "//src:proto_identifier", - "//src:proto_int", - "//src:proto_map", - "//src:proto_message_field", - "//src:proto_option", - "//src:proto_reserved", - "//src:proto_string_literal", - ], -) - -py_test( - name = "proto_oneof_test", - srcs = ["proto_oneof_test.py"], - deps = [ - "//src:proto_comment", - "//src:proto_constant", - "//src:proto_identifier", - "//src:proto_int", - "//src:proto_message_field", - "//src:proto_oneof", - "//src:proto_option", - "//src:proto_string_literal", - ], -) - -py_test( - name = "proto_message_test", - srcs = ["proto_message_test.py"], - deps = [ - "//src:proto_bool", - "//src:proto_comment", - "//src:proto_constant", - "//src:proto_enum", - "//src:proto_extend", - "//src:proto_extensions", - "//src:proto_identifier", - "//src:proto_int", - "//src:proto_map", - "//src:proto_message", - "//src:proto_message_field", - "//src:proto_oneof", - "//src:proto_option", - "//src:proto_reserved", - "//src:proto_string_literal", - ], -) - -py_test( - name = "proto_extend_test", - srcs = ["proto_extend_test.py"], - deps = [ - "//src:proto_extend", - "//src:proto_identifier", - "//src:proto_int", - "//src:proto_message_field", - ], -) - -py_test( - name = "proto_enum_test", - srcs = ["proto_enum_test.py"], - deps = [ - "//src:proto_bool", - "//src:proto_comment", - "//src:proto_constant", - "//src:proto_enum", - "//src:proto_identifier", - "//src:proto_option", - "//src:proto_reserved", - "//src:proto_string_literal", - ], -) - -py_test( - name = "proto_service_test", - srcs = ["proto_service_test.py"], - deps = [ - "//src:proto_bool", - "//src:proto_comment", - "//src:proto_constant", - "//src:proto_identifier", - "//src:proto_option", - "//src:proto_service", - "//src:proto_string_literal", - ], -) - -py_test( - name = "proto_comment_test", - srcs = ["proto_comment_test.py"], - deps = [ - "//src:proto_comment", - ], -) - -py_test( - name = "proto_file_test", - srcs = ["proto_file_test.py"], - deps = [ - "//src:proto_file", - ], -) diff --git a/py_proto/test/util/BUILD.bazel b/py_proto/test/util/BUILD.bazel deleted file mode 100644 index 5e57fb24..00000000 --- a/py_proto/test/util/BUILD.bazel +++ /dev/null @@ -1,44 +0,0 @@ -load("@rules_python//python:defs.bzl", "py_test") - -py_test( - name = "parser_test", - srcs = ["parser_test.py"], - deps = [ - "//src:proto_comment", - "//src:proto_constant", - "//src:proto_enum", - "//src:proto_extend", - "//src:proto_extensions", - "//src:proto_float", - "//src:proto_identifier", - "//src:proto_import", - "//src:proto_int", - "//src:proto_map", - "//src:proto_message", - "//src:proto_message_field", - "//src:proto_option", - "//src:proto_service", - "//src:proto_string_literal", - "//src:proto_syntax", - "//src/util:parser", - ], -) - -sh_test( - name = "parser_binary_test", - srcs = ["parser_binary_test.sh"], - data = [ - "//src/util:parser_binary", - "//test/resources:all_protos", - "@com_google_protobuf//:all_proto", - ], -) - -sh_test( - name = "compatibility_checker_binary_test", - srcs = ["compatibility_checker_binary_test.sh"], - data = [ - "//src/util:compatibility_checker_binary", - "//test/resources:all_protos", - ], -) diff --git a/py_proto/test/util/compatibility_checker_binary_test.sh b/py_proto/test/util/compatibility_checker_binary_test.sh deleted file mode 100755 index 63cd61f5..00000000 --- a/py_proto/test/util/compatibility_checker_binary_test.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash -set -euxo pipefail - -./src/util/compatibility_checker_binary ./test/resources/empty.proto ./test/resources/single_message.proto diff --git a/py_proto/pyproject.toml b/pyproject.toml similarity index 100% rename from py_proto/pyproject.toml rename to pyproject.toml diff --git a/py_proto/src/__init__.py b/src/BUILD.bazel similarity index 100% rename from py_proto/src/__init__.py rename to src/BUILD.bazel diff --git a/py_proto/test/__init__.py b/src/python/BUILD.bazel similarity index 100% rename from py_proto/test/__init__.py rename to src/python/BUILD.bazel diff --git a/py_proto/src/BUILD.bazel b/src/python/py_proto/BUILD.bazel similarity index 100% rename from py_proto/src/BUILD.bazel rename to src/python/py_proto/BUILD.bazel diff --git a/py_proto/README.md b/src/python/py_proto/README.md similarity index 100% rename from py_proto/README.md rename to src/python/py_proto/README.md diff --git a/py_proto/TODO.md b/src/python/py_proto/TODO.md similarity index 100% rename from py_proto/TODO.md rename to src/python/py_proto/TODO.md diff --git a/src/python/py_proto/__init__.py b/src/python/py_proto/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/py_proto/src/proto_bool.py b/src/python/py_proto/proto_bool.py similarity index 91% rename from py_proto/src/proto_bool.py rename to src/python/py_proto/proto_bool.py index d61d5a07..cf978f88 100644 --- a/py_proto/src/proto_bool.py +++ b/src/python/py_proto/proto_bool.py @@ -1,7 +1,7 @@ from typing import Optional -from src.proto_identifier import ProtoFullIdentifier -from src.proto_node import ParsedProtoNode, ProtoNode +from src.python.py_proto.proto_identifier import ProtoFullIdentifier +from src.python.py_proto.proto_node import ParsedProtoNode, ProtoNode class ParsedProtoBoolNode(ParsedProtoNode): diff --git a/py_proto/src/proto_comment.py b/src/python/py_proto/proto_comment.py similarity index 97% rename from py_proto/src/proto_comment.py rename to src/python/py_proto/proto_comment.py index bf7b3d77..05baf01d 100644 --- a/py_proto/src/proto_comment.py +++ b/src/python/py_proto/proto_comment.py @@ -1,7 +1,7 @@ import abc from typing import Optional -from src.proto_node import ParsedProtoNode, ProtoNode +from src.python.py_proto.proto_node import ParsedProtoNode, ProtoNode class ParsedProtoCommentNode(ParsedProtoNode): diff --git a/py_proto/src/proto_constant.py b/src/python/py_proto/proto_constant.py similarity index 89% rename from py_proto/src/proto_constant.py rename to src/python/py_proto/proto_constant.py index 464d6aef..79b80cc5 100644 --- a/py_proto/src/proto_constant.py +++ b/src/python/py_proto/proto_constant.py @@ -1,11 +1,11 @@ from typing import Optional -from src.proto_bool import ProtoBool -from src.proto_float import ProtoFloat, ProtoFloatSign -from src.proto_identifier import ProtoFullIdentifier -from src.proto_int import ProtoInt, ProtoIntSign -from src.proto_node import ParsedProtoNode, ProtoNode -from src.proto_string_literal import ProtoStringLiteral +from src.python.py_proto.proto_bool import ProtoBool +from src.python.py_proto.proto_float import ProtoFloat, ProtoFloatSign +from src.python.py_proto.proto_identifier import ProtoFullIdentifier +from src.python.py_proto.proto_int import ProtoInt, ProtoIntSign +from src.python.py_proto.proto_node import ParsedProtoNode, ProtoNode +from src.python.py_proto.proto_string_literal import ProtoStringLiteral ProtoConstantTypes = ( ProtoFullIdentifier | ProtoStringLiteral | ProtoInt | ProtoFloat | ProtoBool diff --git a/py_proto/src/proto_enum.py b/src/python/py_proto/proto_enum.py similarity index 96% rename from py_proto/src/proto_enum.py rename to src/python/py_proto/proto_enum.py index 986769ad..44e8a565 100644 --- a/py_proto/src/proto_enum.py +++ b/src/python/py_proto/proto_enum.py @@ -1,15 +1,15 @@ from typing import Optional, Sequence -from src.proto_comment import ( +from src.python.py_proto.proto_comment import ( ProtoComment, ProtoMultiLineComment, ProtoSingleLineComment, ) -from src.proto_identifier import ParsedProtoIdentifierNode, ProtoIdentifier -from src.proto_int import ProtoInt, ProtoIntSign -from src.proto_node import ParsedProtoNode, ProtoContainerNode, ProtoNode, ProtoNodeDiff -from src.proto_option import ParsedProtoOptionNode, ProtoOption -from src.proto_reserved import ProtoReserved +from src.python.py_proto.proto_identifier import ParsedProtoIdentifierNode, ProtoIdentifier +from src.python.py_proto.proto_int import ProtoInt, ProtoIntSign +from src.python.py_proto.proto_node import ParsedProtoNode, ProtoContainerNode, ProtoNode, ProtoNodeDiff +from src.python.py_proto.proto_option import ParsedProtoOptionNode, ProtoOption +from src.python.py_proto.proto_reserved import ProtoReserved class ParsedProtoEnumValueOptionNode(ParsedProtoOptionNode): diff --git a/py_proto/src/proto_extend.py b/src/python/py_proto/proto_extend.py similarity index 91% rename from py_proto/src/proto_extend.py rename to src/python/py_proto/proto_extend.py index 007a9420..2f3af1fd 100644 --- a/py_proto/src/proto_extend.py +++ b/src/python/py_proto/proto_extend.py @@ -1,16 +1,16 @@ from typing import Optional -from src.proto_comment import ( +from src.python.py_proto.proto_comment import ( ProtoComment, ProtoMultiLineComment, ProtoSingleLineComment, ) -from src.proto_identifier import ( +from src.python.py_proto.proto_identifier import ( ParsedProtoEnumOrMessageIdentifierNode, ProtoEnumOrMessageIdentifier, ) -from src.proto_message_field import ProtoMessageField -from src.proto_node import ParsedProtoNode, ProtoContainerNode, ProtoNode +from src.python.py_proto.proto_message_field import ProtoMessageField +from src.python.py_proto.proto_node import ParsedProtoNode, ProtoContainerNode, ProtoNode class ProtoExtend(ProtoContainerNode): diff --git a/py_proto/src/proto_extensions.py b/src/python/py_proto/proto_extensions.py similarity index 91% rename from py_proto/src/proto_extensions.py rename to src/python/py_proto/proto_extensions.py index 39ad0126..2fd6826f 100644 --- a/py_proto/src/proto_extensions.py +++ b/src/python/py_proto/proto_extensions.py @@ -1,9 +1,9 @@ from enum import Enum from typing import Optional -from src.proto_identifier import ProtoIdentifier -from src.proto_node import ParsedProtoNode, ProtoNode -from src.proto_range import ProtoRange +from src.python.py_proto.proto_identifier import ProtoIdentifier +from src.python.py_proto.proto_node import ParsedProtoNode, ProtoNode +from src.python.py_proto.proto_range import ProtoRange class ProtoExtensions(ProtoNode): diff --git a/py_proto/src/proto_file.py b/src/python/py_proto/proto_file.py similarity index 90% rename from py_proto/src/proto_file.py rename to src/python/py_proto/proto_file.py index 94d793a4..0aa5d725 100644 --- a/py_proto/src/proto_file.py +++ b/src/python/py_proto/proto_file.py @@ -1,19 +1,19 @@ from typing import Optional, Sequence -from src.proto_comment import ( +from src.python.py_proto.proto_comment import ( ProtoComment, ProtoMultiLineComment, ProtoSingleLineComment, ) -from src.proto_enum import ProtoEnum -from src.proto_extend import ProtoExtend -from src.proto_import import ProtoImport -from src.proto_message import ProtoMessage -from src.proto_node import ParsedProtoNode, ProtoContainerNode, ProtoNode, ProtoNodeDiff -from src.proto_option import ProtoOption -from src.proto_package import ProtoPackage -from src.proto_service import ProtoService -from src.proto_syntax import ProtoSyntax +from src.python.py_proto.proto_enum import ProtoEnum +from src.python.py_proto.proto_extend import ProtoExtend +from src.python.py_proto.proto_import import ProtoImport +from src.python.py_proto.proto_message import ProtoMessage +from src.python.py_proto.proto_node import ParsedProtoNode, ProtoContainerNode, ProtoNode, ProtoNodeDiff +from src.python.py_proto.proto_option import ProtoOption +from src.python.py_proto.proto_package import ProtoPackage +from src.python.py_proto.proto_service import ProtoService +from src.python.py_proto.proto_syntax import ProtoSyntax class ParsedProtoFileNode(ParsedProtoNode): diff --git a/py_proto/src/proto_float.py b/src/python/py_proto/proto_float.py similarity index 95% rename from py_proto/src/proto_float.py rename to src/python/py_proto/proto_float.py index f1abca10..9bb4b8cb 100644 --- a/py_proto/src/proto_float.py +++ b/src/python/py_proto/proto_float.py @@ -1,9 +1,9 @@ from enum import Enum from typing import Optional -from src.proto_identifier import ProtoIdentifier -from src.proto_int import ProtoInt -from src.proto_node import ParsedProtoNode, ProtoNode +from src.python.py_proto.proto_identifier import ProtoIdentifier +from src.python.py_proto.proto_int import ProtoInt +from src.python.py_proto.proto_node import ParsedProtoNode, ProtoNode class ProtoFloatSign(Enum): diff --git a/py_proto/src/proto_identifier.py b/src/python/py_proto/proto_identifier.py similarity index 98% rename from py_proto/src/proto_identifier.py rename to src/python/py_proto/proto_identifier.py index dbc93b58..b4bf5469 100644 --- a/py_proto/src/proto_identifier.py +++ b/src/python/py_proto/proto_identifier.py @@ -1,6 +1,6 @@ from typing import Optional -from src.proto_node import ParsedProtoNode, ProtoNode +from src.python.py_proto.proto_node import ParsedProtoNode, ProtoNode class ParsedProtoIdentifierNode(ParsedProtoNode): diff --git a/py_proto/src/proto_import.py b/src/python/py_proto/proto_import.py similarity index 96% rename from py_proto/src/proto_import.py rename to src/python/py_proto/proto_import.py index 31a1fb6d..ea82f060 100644 --- a/py_proto/src/proto_import.py +++ b/src/python/py_proto/proto_import.py @@ -1,7 +1,7 @@ from typing import Optional -from src.proto_node import ParsedProtoNode, ProtoNode, ProtoNodeDiff -from src.proto_string_literal import ProtoStringLiteral +from src.python.py_proto.proto_node import ParsedProtoNode, ProtoNode, ProtoNodeDiff +from src.python.py_proto.proto_string_literal import ProtoStringLiteral class ProtoImport(ProtoNode): diff --git a/py_proto/src/proto_int.py b/src/python/py_proto/proto_int.py similarity index 96% rename from py_proto/src/proto_int.py rename to src/python/py_proto/proto_int.py index 8bae7912..1d87b142 100644 --- a/py_proto/src/proto_int.py +++ b/src/python/py_proto/proto_int.py @@ -1,8 +1,8 @@ from enum import Enum from typing import Optional -from src.proto_identifier import ProtoFullIdentifier -from src.proto_node import ParsedProtoNode, ProtoNode +from src.python.py_proto.proto_identifier import ProtoFullIdentifier +from src.python.py_proto.proto_node import ParsedProtoNode, ProtoNode class ProtoIntSign(Enum): diff --git a/py_proto/src/proto_map.py b/src/python/py_proto/proto_map.py similarity index 96% rename from py_proto/src/proto_map.py rename to src/python/py_proto/proto_map.py index 20070f9c..913e3452 100644 --- a/py_proto/src/proto_map.py +++ b/src/python/py_proto/proto_map.py @@ -1,10 +1,10 @@ from enum import Enum from typing import Optional, Sequence -from src.proto_identifier import ProtoEnumOrMessageIdentifier, ProtoIdentifier -from src.proto_int import ProtoInt -from src.proto_message_field import ProtoMessageFieldOption, ProtoMessageFieldTypesEnum -from src.proto_node import ParsedProtoNode, ProtoNode, ProtoNodeDiff +from src.python.py_proto.proto_identifier import ProtoEnumOrMessageIdentifier, ProtoIdentifier +from src.python.py_proto.proto_int import ProtoInt +from src.python.py_proto.proto_message_field import ProtoMessageFieldOption, ProtoMessageFieldTypesEnum +from src.python.py_proto.proto_node import ParsedProtoNode, ProtoNode, ProtoNodeDiff class ProtoMapKeyTypesEnum(Enum): diff --git a/py_proto/src/proto_message.py b/src/python/py_proto/proto_message.py similarity index 91% rename from py_proto/src/proto_message.py rename to src/python/py_proto/proto_message.py index 6e261c00..b1327405 100644 --- a/py_proto/src/proto_message.py +++ b/src/python/py_proto/proto_message.py @@ -1,20 +1,20 @@ from typing import Optional, Sequence -from src.proto_comment import ( +from src.python.py_proto.proto_comment import ( ProtoComment, ProtoMultiLineComment, ProtoSingleLineComment, ) -from src.proto_enum import ProtoEnum -from src.proto_extend import ProtoExtend -from src.proto_extensions import ProtoExtensions -from src.proto_identifier import ParsedProtoIdentifierNode, ProtoIdentifier -from src.proto_map import ProtoMap -from src.proto_message_field import ProtoMessageField -from src.proto_node import ParsedProtoNode, ProtoContainerNode, ProtoNode, ProtoNodeDiff -from src.proto_oneof import ProtoOneOf -from src.proto_option import ProtoOption -from src.proto_reserved import ProtoReserved +from src.python.py_proto.proto_enum import ProtoEnum +from src.python.py_proto.proto_extend import ProtoExtend +from src.python.py_proto.proto_extensions import ProtoExtensions +from src.python.py_proto.proto_identifier import ParsedProtoIdentifierNode, ProtoIdentifier +from src.python.py_proto.proto_map import ProtoMap +from src.python.py_proto.proto_message_field import ProtoMessageField +from src.python.py_proto.proto_node import ParsedProtoNode, ProtoContainerNode, ProtoNode, ProtoNodeDiff +from src.python.py_proto.proto_oneof import ProtoOneOf +from src.python.py_proto.proto_option import ProtoOption +from src.python.py_proto.proto_reserved import ProtoReserved class ProtoMessage(ProtoContainerNode): diff --git a/py_proto/src/proto_message_field.py b/src/python/py_proto/proto_message_field.py similarity index 97% rename from py_proto/src/proto_message_field.py rename to src/python/py_proto/proto_message_field.py index 10466462..a389db65 100644 --- a/py_proto/src/proto_message_field.py +++ b/src/python/py_proto/proto_message_field.py @@ -1,10 +1,10 @@ from enum import Enum from typing import Optional, Sequence -from src.proto_enum import ParsedProtoEnumValueOptionNode, ProtoEnumValueOption -from src.proto_identifier import ProtoEnumOrMessageIdentifier, ProtoIdentifier -from src.proto_int import ProtoInt -from src.proto_node import ParsedProtoNode, ProtoNode, ProtoNodeDiff +from src.python.py_proto.proto_enum import ParsedProtoEnumValueOptionNode, ProtoEnumValueOption +from src.python.py_proto.proto_identifier import ProtoEnumOrMessageIdentifier, ProtoIdentifier +from src.python.py_proto.proto_int import ProtoInt +from src.python.py_proto.proto_node import ParsedProtoNode, ProtoNode, ProtoNodeDiff class ParsedProtoMessageFieldOptionNode(ParsedProtoEnumValueOptionNode): diff --git a/py_proto/src/proto_node.py b/src/python/py_proto/proto_node.py similarity index 100% rename from py_proto/src/proto_node.py rename to src/python/py_proto/proto_node.py diff --git a/py_proto/src/proto_oneof.py b/src/python/py_proto/proto_oneof.py similarity index 93% rename from py_proto/src/proto_oneof.py rename to src/python/py_proto/proto_oneof.py index 50493d3c..a385c097 100644 --- a/py_proto/src/proto_oneof.py +++ b/src/python/py_proto/proto_oneof.py @@ -1,17 +1,17 @@ from typing import Optional, Sequence -from src.proto_comment import ( +from src.python.py_proto.proto_comment import ( ParsedProtoMultiLineCommentNode, ParsedProtoSingleLineCommentNode, ProtoComment, ProtoMultiLineComment, ProtoSingleLineComment, ) -from src.proto_identifier import ParsedProtoIdentifierNode, ProtoIdentifier -from src.proto_map import ProtoMap -from src.proto_message_field import ParsedProtoMessageFieldNode, ProtoMessageField -from src.proto_node import ParsedProtoNode, ProtoContainerNode, ProtoNode, ProtoNodeDiff -from src.proto_option import ParsedProtoOptionNode, ProtoOption +from src.python.py_proto.proto_identifier import ParsedProtoIdentifierNode, ProtoIdentifier +from src.python.py_proto.proto_map import ProtoMap +from src.python.py_proto.proto_message_field import ParsedProtoMessageFieldNode, ProtoMessageField +from src.python.py_proto.proto_node import ParsedProtoNode, ProtoContainerNode, ProtoNode, ProtoNodeDiff +from src.python.py_proto.proto_option import ParsedProtoOptionNode, ProtoOption ProtoOneOfNodeTypes = ( ProtoOption | ProtoMessageField | ProtoSingleLineComment | ProtoMultiLineComment diff --git a/py_proto/src/proto_option.py b/src/python/py_proto/proto_option.py similarity index 97% rename from py_proto/src/proto_option.py rename to src/python/py_proto/proto_option.py index 6ba48d28..4cbf05f2 100644 --- a/py_proto/src/proto_option.py +++ b/src/python/py_proto/proto_option.py @@ -1,12 +1,12 @@ from typing import Optional, Sequence -from src.proto_constant import ProtoConstant -from src.proto_identifier import ( +from src.python.py_proto.proto_constant import ProtoConstant +from src.python.py_proto.proto_identifier import ( ProtoEnumOrMessageIdentifier, ProtoFullIdentifier, ProtoIdentifier, ) -from src.proto_node import ParsedProtoNode, ProtoNode, ProtoNodeDiff +from src.python.py_proto.proto_node import ParsedProtoNode, ProtoNode, ProtoNodeDiff class ParsedProtoOptionNode(ParsedProtoNode): diff --git a/py_proto/src/proto_package.py b/src/python/py_proto/proto_package.py similarity index 97% rename from py_proto/src/proto_package.py rename to src/python/py_proto/proto_package.py index 64eb1206..950a8850 100644 --- a/py_proto/src/proto_package.py +++ b/src/python/py_proto/proto_package.py @@ -1,6 +1,6 @@ from typing import Optional -from src.proto_node import ParsedProtoNode, ProtoNode, ProtoNodeDiff +from src.python.py_proto.proto_node import ParsedProtoNode, ProtoNode, ProtoNodeDiff class ProtoPackage(ProtoNode): diff --git a/py_proto/src/proto_range.py b/src/python/py_proto/proto_range.py similarity index 96% rename from py_proto/src/proto_range.py rename to src/python/py_proto/proto_range.py index ce035f9b..40316e8a 100644 --- a/py_proto/src/proto_range.py +++ b/src/python/py_proto/proto_range.py @@ -1,8 +1,8 @@ from enum import Enum from typing import Optional -from src.proto_int import ProtoInt, ProtoIntSign -from src.proto_node import ParsedProtoNode, ProtoNode +from src.python.py_proto.proto_int import ProtoInt, ProtoIntSign +from src.python.py_proto.proto_node import ParsedProtoNode, ProtoNode class ParsedProtoRangeNode(ParsedProtoNode): diff --git a/py_proto/src/proto_reserved.py b/src/python/py_proto/proto_reserved.py similarity index 96% rename from py_proto/src/proto_reserved.py rename to src/python/py_proto/proto_reserved.py index 374123c0..6f81c71a 100644 --- a/py_proto/src/proto_reserved.py +++ b/src/python/py_proto/proto_reserved.py @@ -1,9 +1,9 @@ from enum import Enum from typing import Optional -from src.proto_identifier import ProtoIdentifier -from src.proto_node import ParsedProtoNode, ProtoNode -from src.proto_range import ProtoRange +from src.python.py_proto.proto_identifier import ProtoIdentifier +from src.python.py_proto.proto_node import ParsedProtoNode, ProtoNode +from src.python.py_proto.proto_range import ProtoRange class ProtoReservedFieldQuoteEnum(Enum): diff --git a/py_proto/src/proto_service.py b/src/python/py_proto/proto_service.py similarity index 97% rename from py_proto/src/proto_service.py rename to src/python/py_proto/proto_service.py index 26f7d177..d8ae8f3b 100644 --- a/py_proto/src/proto_service.py +++ b/src/python/py_proto/proto_service.py @@ -1,17 +1,17 @@ from typing import Optional -from src.proto_comment import ( +from src.python.py_proto.proto_comment import ( ProtoComment, ProtoMultiLineComment, ProtoSingleLineComment, ) -from src.proto_identifier import ( +from src.python.py_proto.proto_identifier import ( ParsedProtoIdentifierNode, ProtoEnumOrMessageIdentifier, ProtoIdentifier, ) -from src.proto_node import ParsedProtoNode, ProtoContainerNode, ProtoNode -from src.proto_option import ProtoOption +from src.python.py_proto.proto_node import ParsedProtoNode, ProtoContainerNode, ProtoNode +from src.python.py_proto.proto_option import ProtoOption class ProtoServiceRPC(ProtoNode): diff --git a/py_proto/src/proto_string_literal.py b/src/python/py_proto/proto_string_literal.py similarity index 95% rename from py_proto/src/proto_string_literal.py rename to src/python/py_proto/proto_string_literal.py index 1941cf41..ee65fb70 100644 --- a/py_proto/src/proto_string_literal.py +++ b/src/python/py_proto/proto_string_literal.py @@ -1,6 +1,6 @@ from typing import Optional -from src.proto_node import ParsedProtoNode, ProtoNode +from src.python.py_proto.proto_node import ParsedProtoNode, ProtoNode class ParsedProtoStringLiteralNode(ParsedProtoNode): diff --git a/py_proto/src/proto_syntax.py b/src/python/py_proto/proto_syntax.py similarity index 93% rename from py_proto/src/proto_syntax.py rename to src/python/py_proto/proto_syntax.py index fe301bfa..5085e07d 100644 --- a/py_proto/src/proto_syntax.py +++ b/src/python/py_proto/proto_syntax.py @@ -1,8 +1,8 @@ from enum import Enum from typing import Optional -from src.proto_node import ParsedProtoNode, ProtoNode, ProtoNodeDiff -from src.proto_string_literal import ProtoStringLiteral +from src.python.py_proto.proto_node import ParsedProtoNode, ProtoNode, ProtoNodeDiff +from src.python.py_proto.proto_string_literal import ProtoStringLiteral class ParsedProtoSyntaxNode(ParsedProtoNode): diff --git a/src/python/py_proto/test/BUILD.bazel b/src/python/py_proto/test/BUILD.bazel new file mode 100644 index 00000000..3219bd75 --- /dev/null +++ b/src/python/py_proto/test/BUILD.bazel @@ -0,0 +1,239 @@ +load("@rules_python//python:defs.bzl", "py_test") + +py_test( + name = "proto_string_literal_test", + srcs = ["proto_string_literal_test.py"], + deps = [ + "//src/python/py_proto:proto_string_literal", + ], +) + +py_test( + name = "proto_identifier_test", + srcs = ["proto_identifier_test.py"], + deps = [ + "//src/python/py_proto:proto_identifier", + ], +) + +py_test( + name = "proto_bool_test", + srcs = ["proto_bool_test.py"], + deps = [ + "//src/python/py_proto:proto_bool", + ], +) + +py_test( + name = "proto_int_test", + srcs = ["proto_int_test.py"], + deps = [ + "//src/python/py_proto:proto_int", + ], +) + +py_test( + name = "proto_float_test", + srcs = ["proto_float_test.py"], + deps = [ + "//src/python/py_proto:proto_float", + ], +) + +py_test( + name = "proto_constant_test", + srcs = ["proto_constant_test.py"], + deps = [ + "//src/python/py_proto:proto_bool", + "//src/python/py_proto:proto_constant", + "//src/python/py_proto:proto_identifier", + "//src/python/py_proto:proto_int", + "//src/python/py_proto:proto_string_literal", + ], +) + +py_test( + name = "proto_extensions_test", + srcs = ["proto_extensions_test.py"], + deps = [ + "//src/python/py_proto:proto_extensions", + ], +) + +py_test( + name = "proto_option_test", + srcs = ["proto_option_test.py"], + deps = [ + "//src/python/py_proto:proto_bool", + "//src/python/py_proto:proto_constant", + "//src/python/py_proto:proto_identifier", + "//src/python/py_proto:proto_int", + "//src/python/py_proto:proto_option", + "//src/python/py_proto:proto_string_literal", + ], +) + +py_test( + name = "proto_range_test", + srcs = ["proto_range_test.py"], + deps = [ + "//src/python/py_proto:proto_range", + ], +) + +py_test( + name = "proto_reserved_test", + srcs = ["proto_reserved_test.py"], + deps = [ + "//src/python/py_proto:proto_reserved", + ], +) + +py_test( + name = "proto_syntax_test", + srcs = ["proto_syntax_test.py"], + deps = [ + "//src/python/py_proto:proto_string_literal", + "//src/python/py_proto:proto_syntax", + ], +) + +py_test( + name = "proto_import_test", + srcs = ["proto_import_test.py"], + deps = [ + "//src/python/py_proto:proto_import", + "//src/python/py_proto:proto_string_literal", + ], +) + +py_test( + name = "proto_package_test", + srcs = ["proto_package_test.py"], + deps = [ + "//src/python/py_proto:proto_package", + ], +) + +py_test( + name = "proto_message_field_test", + srcs = ["proto_message_field_test.py"], + deps = [ + "//src/python/py_proto:proto_identifier", + "//src/python/py_proto:proto_int", + "//src/python/py_proto:proto_message_field", + ], +) + +py_test( + name = "proto_map_test", + srcs = ["proto_map_test.py"], + deps = [ + "//src/python/py_proto:proto_bool", + "//src/python/py_proto:proto_comment", + "//src/python/py_proto:proto_constant", + "//src/python/py_proto:proto_enum", + "//src/python/py_proto:proto_extend", + "//src/python/py_proto:proto_extensions", + "//src/python/py_proto:proto_identifier", + "//src/python/py_proto:proto_int", + "//src/python/py_proto:proto_map", + "//src/python/py_proto:proto_message_field", + "//src/python/py_proto:proto_option", + "//src/python/py_proto:proto_reserved", + "//src/python/py_proto:proto_string_literal", + ], +) + +py_test( + name = "proto_oneof_test", + srcs = ["proto_oneof_test.py"], + deps = [ + "//src/python/py_proto:proto_comment", + "//src/python/py_proto:proto_constant", + "//src/python/py_proto:proto_identifier", + "//src/python/py_proto:proto_int", + "//src/python/py_proto:proto_message_field", + "//src/python/py_proto:proto_oneof", + "//src/python/py_proto:proto_option", + "//src/python/py_proto:proto_string_literal", + ], +) + +py_test( + name = "proto_message_test", + srcs = ["proto_message_test.py"], + deps = [ + "//src/python/py_proto:proto_bool", + "//src/python/py_proto:proto_comment", + "//src/python/py_proto:proto_constant", + "//src/python/py_proto:proto_enum", + "//src/python/py_proto:proto_extend", + "//src/python/py_proto:proto_extensions", + "//src/python/py_proto:proto_identifier", + "//src/python/py_proto:proto_int", + "//src/python/py_proto:proto_map", + "//src/python/py_proto:proto_message", + "//src/python/py_proto:proto_message_field", + "//src/python/py_proto:proto_oneof", + "//src/python/py_proto:proto_option", + "//src/python/py_proto:proto_reserved", + "//src/python/py_proto:proto_string_literal", + ], +) + +py_test( + name = "proto_extend_test", + srcs = ["proto_extend_test.py"], + deps = [ + "//src/python/py_proto:proto_extend", + "//src/python/py_proto:proto_identifier", + "//src/python/py_proto:proto_int", + "//src/python/py_proto:proto_message_field", + ], +) + +py_test( + name = "proto_enum_test", + srcs = ["proto_enum_test.py"], + deps = [ + "//src/python/py_proto:proto_bool", + "//src/python/py_proto:proto_comment", + "//src/python/py_proto:proto_constant", + "//src/python/py_proto:proto_enum", + "//src/python/py_proto:proto_identifier", + "//src/python/py_proto:proto_option", + "//src/python/py_proto:proto_reserved", + "//src/python/py_proto:proto_string_literal", + ], +) + +py_test( + name = "proto_service_test", + srcs = ["proto_service_test.py"], + deps = [ + "//src/python/py_proto:proto_bool", + "//src/python/py_proto:proto_comment", + "//src/python/py_proto:proto_constant", + "//src/python/py_proto:proto_identifier", + "//src/python/py_proto:proto_option", + "//src/python/py_proto:proto_service", + "//src/python/py_proto:proto_string_literal", + ], +) + +py_test( + name = "proto_comment_test", + srcs = ["proto_comment_test.py"], + deps = [ + "//src/python/py_proto:proto_comment", + ], +) + +py_test( + name = "proto_file_test", + srcs = ["proto_file_test.py"], + deps = [ + "//src/python/py_proto:proto_file", + ], +) diff --git a/src/python/py_proto/test/__init__.py b/src/python/py_proto/test/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/py_proto/test/proto_bool_test.py b/src/python/py_proto/test/proto_bool_test.py similarity index 93% rename from py_proto/test/proto_bool_test.py rename to src/python/py_proto/test/proto_bool_test.py index cc3a0358..c16634d9 100644 --- a/py_proto/test/proto_bool_test.py +++ b/src/python/py_proto/test/proto_bool_test.py @@ -1,6 +1,6 @@ import unittest -from src.proto_bool import ProtoBool +from src.python.py_proto.proto_bool import ProtoBool class BoolTest(unittest.TestCase): diff --git a/py_proto/test/proto_comment_test.py b/src/python/py_proto/test/proto_comment_test.py similarity index 97% rename from py_proto/test/proto_comment_test.py rename to src/python/py_proto/test/proto_comment_test.py index 95a37e90..1643b455 100644 --- a/py_proto/test/proto_comment_test.py +++ b/src/python/py_proto/test/proto_comment_test.py @@ -1,6 +1,6 @@ import unittest -from src.proto_comment import ProtoMultiLineComment, ProtoSingleLineComment +from src.python.py_proto.proto_comment import ProtoMultiLineComment, ProtoSingleLineComment class ProtoSingleLineCommentTest(unittest.TestCase): diff --git a/py_proto/test/proto_constant_test.py b/src/python/py_proto/test/proto_constant_test.py similarity index 93% rename from py_proto/test/proto_constant_test.py rename to src/python/py_proto/test/proto_constant_test.py index fc3fd497..a6bbde08 100644 --- a/py_proto/test/proto_constant_test.py +++ b/src/python/py_proto/test/proto_constant_test.py @@ -1,12 +1,12 @@ import unittest from textwrap import dedent -from src.proto_bool import ProtoBool -from src.proto_constant import ProtoConstant -from src.proto_float import ProtoFloat, ProtoFloatSign -from src.proto_identifier import ProtoIdentifier -from src.proto_int import ProtoInt, ProtoIntSign -from src.proto_string_literal import ProtoStringLiteral +from src.python.py_proto.proto_bool import ProtoBool +from src.python.py_proto.proto_constant import ProtoConstant +from src.python.py_proto.proto_float import ProtoFloat, ProtoFloatSign +from src.python.py_proto.proto_identifier import ProtoIdentifier +from src.python.py_proto.proto_int import ProtoInt, ProtoIntSign +from src.python.py_proto.proto_string_literal import ProtoStringLiteral class ConstantTest(unittest.TestCase): diff --git a/py_proto/test/proto_enum_test.py b/src/python/py_proto/test/proto_enum_test.py similarity index 97% rename from py_proto/test/proto_enum_test.py rename to src/python/py_proto/test/proto_enum_test.py index 3463a6b7..e56ea6ab 100644 --- a/py_proto/test/proto_enum_test.py +++ b/src/python/py_proto/test/proto_enum_test.py @@ -1,10 +1,10 @@ import unittest from textwrap import dedent -from src.proto_bool import ProtoBool -from src.proto_comment import ProtoMultiLineComment, ProtoSingleLineComment -from src.proto_constant import ProtoConstant -from src.proto_enum import ( +from src.python.py_proto.proto_bool import ProtoBool +from src.python.py_proto.proto_comment import ProtoMultiLineComment, ProtoSingleLineComment +from src.python.py_proto.proto_constant import ProtoConstant +from src.python.py_proto.proto_enum import ( ProtoEnum, ProtoEnumAdded, ProtoEnumRemoved, @@ -14,12 +14,12 @@ ProtoEnumValueOption, ProtoEnumValueRemoved, ) -from src.proto_identifier import ProtoIdentifier -from src.proto_int import ProtoInt, ProtoIntSign -from src.proto_option import ProtoOption -from src.proto_range import ProtoRange, ProtoRangeEnum -from src.proto_reserved import ProtoReserved -from src.proto_string_literal import ProtoStringLiteral +from src.python.py_proto.proto_identifier import ProtoIdentifier +from src.python.py_proto.proto_int import ProtoInt, ProtoIntSign +from src.python.py_proto.proto_option import ProtoOption +from src.python.py_proto.proto_range import ProtoRange, ProtoRangeEnum +from src.python.py_proto.proto_reserved import ProtoReserved +from src.python.py_proto.proto_string_literal import ProtoStringLiteral class EnumTest(unittest.TestCase): diff --git a/py_proto/test/proto_extend_test.py b/src/python/py_proto/test/proto_extend_test.py similarity index 90% rename from py_proto/test/proto_extend_test.py rename to src/python/py_proto/test/proto_extend_test.py index 176281a2..9e9872a2 100644 --- a/py_proto/test/proto_extend_test.py +++ b/src/python/py_proto/test/proto_extend_test.py @@ -1,10 +1,10 @@ import unittest from textwrap import dedent -from src.proto_extend import ProtoExtend -from src.proto_identifier import ProtoEnumOrMessageIdentifier, ProtoIdentifier -from src.proto_int import ProtoInt, ProtoIntSign -from src.proto_message_field import ProtoMessageField, ProtoMessageFieldTypesEnum +from src.python.py_proto.proto_extend import ProtoExtend +from src.python.py_proto.proto_identifier import ProtoEnumOrMessageIdentifier, ProtoIdentifier +from src.python.py_proto.proto_int import ProtoInt, ProtoIntSign +from src.python.py_proto.proto_message_field import ProtoMessageField, ProtoMessageFieldTypesEnum class ExtendTest(unittest.TestCase): diff --git a/py_proto/test/proto_extensions_test.py b/src/python/py_proto/test/proto_extensions_test.py similarity index 93% rename from py_proto/test/proto_extensions_test.py rename to src/python/py_proto/test/proto_extensions_test.py index 50f07237..267e6cf9 100644 --- a/py_proto/test/proto_extensions_test.py +++ b/src/python/py_proto/test/proto_extensions_test.py @@ -1,6 +1,6 @@ import unittest -from src.proto_extensions import ProtoExtensions +from src.python.py_proto.proto_extensions import ProtoExtensions class ExtensionsTest(unittest.TestCase): diff --git a/py_proto/test/proto_file_test.py b/src/python/py_proto/test/proto_file_test.py similarity index 68% rename from py_proto/test/proto_file_test.py rename to src/python/py_proto/test/proto_file_test.py index 1bbf1cd7..8de5e444 100644 --- a/py_proto/test/proto_file_test.py +++ b/src/python/py_proto/test/proto_file_test.py @@ -1,6 +1,6 @@ import unittest -from src.proto_file import ProtoFile +from src.python.py_proto.proto_file import ProtoFile class ProtoFileTest(unittest.TestCase): diff --git a/py_proto/test/proto_float_test.py b/src/python/py_proto/test/proto_float_test.py similarity index 97% rename from py_proto/test/proto_float_test.py rename to src/python/py_proto/test/proto_float_test.py index ecdbe22c..24ed138e 100644 --- a/py_proto/test/proto_float_test.py +++ b/src/python/py_proto/test/proto_float_test.py @@ -1,6 +1,6 @@ import unittest -from src.proto_float import ProtoFloat, ProtoFloatSign +from src.python.py_proto.proto_float import ProtoFloat, ProtoFloatSign class FloatTest(unittest.TestCase): diff --git a/py_proto/test/proto_identifier_test.py b/src/python/py_proto/test/proto_identifier_test.py similarity index 98% rename from py_proto/test/proto_identifier_test.py rename to src/python/py_proto/test/proto_identifier_test.py index dd5435f6..e4c3f600 100644 --- a/py_proto/test/proto_identifier_test.py +++ b/src/python/py_proto/test/proto_identifier_test.py @@ -1,7 +1,7 @@ import unittest from textwrap import dedent -from src.proto_identifier import ( +from src.python.py_proto.proto_identifier import ( ProtoEnumOrMessageIdentifier, ProtoFullIdentifier, ProtoIdentifier, diff --git a/py_proto/test/proto_import_test.py b/src/python/py_proto/test/proto_import_test.py similarity index 98% rename from py_proto/test/proto_import_test.py rename to src/python/py_proto/test/proto_import_test.py index 8806d8fc..4d71f079 100644 --- a/py_proto/test/proto_import_test.py +++ b/src/python/py_proto/test/proto_import_test.py @@ -1,14 +1,14 @@ import unittest from textwrap import dedent -from src.proto_import import ( +from src.python.py_proto.proto_import import ( ProtoImport, ProtoImportAdded, ProtoImportMadeNonWeak, ProtoImportMadePublic, ProtoImportRemoved, ) -from src.proto_string_literal import ProtoStringLiteral +from src.python.py_proto.proto_string_literal import ProtoStringLiteral class ImportTest(unittest.TestCase): diff --git a/py_proto/test/proto_int_test.py b/src/python/py_proto/test/proto_int_test.py similarity index 93% rename from py_proto/test/proto_int_test.py rename to src/python/py_proto/test/proto_int_test.py index 3293d5e2..bb224cea 100644 --- a/py_proto/test/proto_int_test.py +++ b/src/python/py_proto/test/proto_int_test.py @@ -1,6 +1,6 @@ import unittest -from src.proto_int import ProtoInt, ProtoIntSign +from src.python.py_proto.proto_int import ProtoInt, ProtoIntSign class IntTest(unittest.TestCase): diff --git a/py_proto/test/proto_map_test.py b/src/python/py_proto/test/proto_map_test.py similarity index 87% rename from py_proto/test/proto_map_test.py rename to src/python/py_proto/test/proto_map_test.py index 59e7ba1c..6b9ed569 100644 --- a/py_proto/test/proto_map_test.py +++ b/src/python/py_proto/test/proto_map_test.py @@ -1,15 +1,15 @@ import unittest -from src.proto_constant import ProtoConstant -from src.proto_identifier import ( +from src.python.py_proto.proto_constant import ProtoConstant +from src.python.py_proto.proto_identifier import ( ProtoEnumOrMessageIdentifier, ProtoFullIdentifier, ProtoIdentifier, ) -from src.proto_int import ProtoInt, ProtoIntSign -from src.proto_map import ProtoMap, ProtoMapKeyTypesEnum, ProtoMapValueTypesEnum -from src.proto_message_field import ProtoMessageFieldOption -from src.proto_string_literal import ProtoStringLiteral +from src.python.py_proto.proto_int import ProtoInt, ProtoIntSign +from src.python.py_proto.proto_map import ProtoMap, ProtoMapKeyTypesEnum, ProtoMapValueTypesEnum +from src.python.py_proto.proto_message_field import ProtoMessageFieldOption +from src.python.py_proto.proto_string_literal import ProtoStringLiteral class MapTest(unittest.TestCase): diff --git a/py_proto/test/proto_message_field_test.py b/src/python/py_proto/test/proto_message_field_test.py similarity index 98% rename from py_proto/test/proto_message_field_test.py rename to src/python/py_proto/test/proto_message_field_test.py index fa6a882d..df5dba03 100644 --- a/py_proto/test/proto_message_field_test.py +++ b/src/python/py_proto/test/proto_message_field_test.py @@ -1,12 +1,12 @@ import unittest -from src.proto_identifier import ( +from src.python.py_proto.proto_identifier import ( ProtoEnumOrMessageIdentifier, ProtoFullIdentifier, ProtoIdentifier, ) -from src.proto_int import ProtoInt, ProtoIntSign -from src.proto_message_field import ( +from src.python.py_proto.proto_int import ProtoInt, ProtoIntSign +from src.python.py_proto.proto_message_field import ( ProtoMessageField, ProtoMessageFieldAdded, ProtoMessageFieldNameChanged, diff --git a/py_proto/test/proto_message_test.py b/src/python/py_proto/test/proto_message_test.py similarity index 95% rename from py_proto/test/proto_message_test.py rename to src/python/py_proto/test/proto_message_test.py index 963adfc3..ea008393 100644 --- a/py_proto/test/proto_message_test.py +++ b/src/python/py_proto/test/proto_message_test.py @@ -1,30 +1,30 @@ import unittest from textwrap import dedent -from src.proto_bool import ProtoBool -from src.proto_comment import ProtoMultiLineComment, ProtoSingleLineComment -from src.proto_constant import ProtoConstant -from src.proto_enum import ProtoEnum, ProtoEnumValue -from src.proto_extend import ProtoExtend -from src.proto_extensions import ProtoExtensions -from src.proto_identifier import ( +from src.python.py_proto.proto_bool import ProtoBool +from src.python.py_proto.proto_comment import ProtoMultiLineComment, ProtoSingleLineComment +from src.python.py_proto.proto_constant import ProtoConstant +from src.python.py_proto.proto_enum import ProtoEnum, ProtoEnumValue +from src.python.py_proto.proto_extend import ProtoExtend +from src.python.py_proto.proto_extensions import ProtoExtensions +from src.python.py_proto.proto_identifier import ( ProtoEnumOrMessageIdentifier, ProtoFullIdentifier, ProtoIdentifier, ) -from src.proto_int import ProtoInt, ProtoIntSign -from src.proto_map import ProtoMap, ProtoMapKeyTypesEnum, ProtoMapValueTypesEnum -from src.proto_message import ProtoMessage, ProtoMessageAdded, ProtoMessageRemoved -from src.proto_message_field import ( +from src.python.py_proto.proto_int import ProtoInt, ProtoIntSign +from src.python.py_proto.proto_map import ProtoMap, ProtoMapKeyTypesEnum, ProtoMapValueTypesEnum +from src.python.py_proto.proto_message import ProtoMessage, ProtoMessageAdded, ProtoMessageRemoved +from src.python.py_proto.proto_message_field import ( ProtoMessageField, ProtoMessageFieldOption, ProtoMessageFieldTypesEnum, ) -from src.proto_oneof import ProtoOneOf -from src.proto_option import ProtoOption -from src.proto_range import ProtoRange, ProtoRangeEnum -from src.proto_reserved import ProtoReserved -from src.proto_string_literal import ProtoStringLiteral +from src.python.py_proto.proto_oneof import ProtoOneOf +from src.python.py_proto.proto_option import ProtoOption +from src.python.py_proto.proto_range import ProtoRange, ProtoRangeEnum +from src.python.py_proto.proto_reserved import ProtoReserved +from src.python.py_proto.proto_string_literal import ProtoStringLiteral class MessageTest(unittest.TestCase): diff --git a/py_proto/test/proto_oneof_test.py b/src/python/py_proto/test/proto_oneof_test.py similarity index 96% rename from py_proto/test/proto_oneof_test.py rename to src/python/py_proto/test/proto_oneof_test.py index fbcb3505..33b63b2b 100644 --- a/py_proto/test/proto_oneof_test.py +++ b/src/python/py_proto/test/proto_oneof_test.py @@ -1,11 +1,11 @@ import unittest from textwrap import dedent -from src.proto_comment import ProtoSingleLineComment -from src.proto_constant import ProtoConstant -from src.proto_identifier import ProtoFullIdentifier, ProtoIdentifier -from src.proto_int import ProtoInt, ProtoIntSign -from src.proto_message_field import ( +from src.python.py_proto.proto_comment import ProtoSingleLineComment +from src.python.py_proto.proto_constant import ProtoConstant +from src.python.py_proto.proto_identifier import ProtoFullIdentifier, ProtoIdentifier +from src.python.py_proto.proto_int import ProtoInt, ProtoIntSign +from src.python.py_proto.proto_message_field import ( ProtoMessageField, ProtoMessageFieldAdded, ProtoMessageFieldNameChanged, @@ -13,9 +13,9 @@ ProtoMessageFieldRemoved, ProtoMessageFieldTypesEnum, ) -from src.proto_oneof import ProtoOneOf, ProtoOneOfAdded, ProtoOneOfRemoved -from src.proto_option import ProtoOption -from src.proto_string_literal import ProtoStringLiteral +from src.python.py_proto.proto_oneof import ProtoOneOf, ProtoOneOfAdded, ProtoOneOfRemoved +from src.python.py_proto.proto_option import ProtoOption +from src.python.py_proto.proto_string_literal import ProtoStringLiteral class OneOfTest(unittest.TestCase): diff --git a/py_proto/test/proto_option_test.py b/src/python/py_proto/test/proto_option_test.py similarity index 98% rename from py_proto/test/proto_option_test.py rename to src/python/py_proto/test/proto_option_test.py index f7a6a005..63ce9e82 100644 --- a/py_proto/test/proto_option_test.py +++ b/src/python/py_proto/test/proto_option_test.py @@ -1,17 +1,17 @@ import unittest from textwrap import dedent -from src.proto_constant import ProtoConstant -from src.proto_float import ProtoFloat, ProtoFloatSign -from src.proto_identifier import ProtoFullIdentifier, ProtoIdentifier -from src.proto_int import ProtoInt, ProtoIntSign -from src.proto_option import ( +from src.python.py_proto.proto_constant import ProtoConstant +from src.python.py_proto.proto_float import ProtoFloat, ProtoFloatSign +from src.python.py_proto.proto_identifier import ProtoFullIdentifier, ProtoIdentifier +from src.python.py_proto.proto_int import ProtoInt, ProtoIntSign +from src.python.py_proto.proto_option import ( ProtoOption, ProtoOptionAdded, ProtoOptionRemoved, ProtoOptionValueChanged, ) -from src.proto_string_literal import ProtoStringLiteral +from src.python.py_proto.proto_string_literal import ProtoStringLiteral class OptionTest(unittest.TestCase): diff --git a/py_proto/test/proto_package_test.py b/src/python/py_proto/test/proto_package_test.py similarity index 98% rename from py_proto/test/proto_package_test.py rename to src/python/py_proto/test/proto_package_test.py index bf6bd7d6..e4b47b85 100644 --- a/py_proto/test/proto_package_test.py +++ b/src/python/py_proto/test/proto_package_test.py @@ -1,7 +1,7 @@ import unittest from textwrap import dedent -from src.proto_package import ( +from src.python.py_proto.proto_package import ( ProtoPackage, ProtoPackageAdded, ProtoPackageChanged, diff --git a/py_proto/test/proto_range_test.py b/src/python/py_proto/test/proto_range_test.py similarity index 96% rename from py_proto/test/proto_range_test.py rename to src/python/py_proto/test/proto_range_test.py index ce784336..da230319 100644 --- a/py_proto/test/proto_range_test.py +++ b/src/python/py_proto/test/proto_range_test.py @@ -1,6 +1,6 @@ import unittest -from src.proto_range import ProtoRange +from src.python.py_proto.proto_range import ProtoRange class RangeTest(unittest.TestCase): diff --git a/py_proto/test/proto_reserved_test.py b/src/python/py_proto/test/proto_reserved_test.py similarity index 96% rename from py_proto/test/proto_reserved_test.py rename to src/python/py_proto/test/proto_reserved_test.py index e83aca8f..09473e90 100644 --- a/py_proto/test/proto_reserved_test.py +++ b/src/python/py_proto/test/proto_reserved_test.py @@ -1,7 +1,7 @@ import unittest from textwrap import dedent -from src.proto_reserved import ProtoReserved +from src.python.py_proto.proto_reserved import ProtoReserved class ReservedTest(unittest.TestCase): diff --git a/py_proto/test/proto_service_test.py b/src/python/py_proto/test/proto_service_test.py similarity index 96% rename from py_proto/test/proto_service_test.py rename to src/python/py_proto/test/proto_service_test.py index 0b5a4fb6..1f9a63a8 100644 --- a/py_proto/test/proto_service_test.py +++ b/src/python/py_proto/test/proto_service_test.py @@ -1,17 +1,17 @@ import unittest from textwrap import dedent -from src.proto_bool import ProtoBool -from src.proto_comment import ProtoMultiLineComment, ProtoSingleLineComment -from src.proto_constant import ProtoConstant -from src.proto_identifier import ( +from src.python.py_proto.proto_bool import ProtoBool +from src.python.py_proto.proto_comment import ProtoMultiLineComment, ProtoSingleLineComment +from src.python.py_proto.proto_constant import ProtoConstant +from src.python.py_proto.proto_identifier import ( ProtoEnumOrMessageIdentifier, ProtoFullIdentifier, ProtoIdentifier, ) -from src.proto_option import ProtoOption -from src.proto_service import ProtoService, ProtoServiceRPC -from src.proto_string_literal import ProtoStringLiteral +from src.python.py_proto.proto_option import ProtoOption +from src.python.py_proto.proto_service import ProtoService, ProtoServiceRPC +from src.python.py_proto.proto_string_literal import ProtoStringLiteral class ServiceTest(unittest.TestCase): diff --git a/py_proto/test/proto_string_literal_test.py b/src/python/py_proto/test/proto_string_literal_test.py similarity index 96% rename from py_proto/test/proto_string_literal_test.py rename to src/python/py_proto/test/proto_string_literal_test.py index 73ad4dc1..86228b6e 100644 --- a/py_proto/test/proto_string_literal_test.py +++ b/src/python/py_proto/test/proto_string_literal_test.py @@ -1,6 +1,6 @@ import unittest -from src.proto_string_literal import ProtoStringLiteral +from src.python.py_proto.proto_string_literal import ProtoStringLiteral class StringLiteralTest(unittest.TestCase): diff --git a/py_proto/test/proto_syntax_test.py b/src/python/py_proto/test/proto_syntax_test.py similarity index 96% rename from py_proto/test/proto_syntax_test.py rename to src/python/py_proto/test/proto_syntax_test.py index 6abfda1d..97e96fef 100644 --- a/py_proto/test/proto_syntax_test.py +++ b/src/python/py_proto/test/proto_syntax_test.py @@ -1,7 +1,7 @@ import unittest -from src.proto_string_literal import ProtoStringLiteral -from src.proto_syntax import ProtoSyntax, ProtoSyntaxChanged +from src.python.py_proto.proto_string_literal import ProtoStringLiteral +from src.python.py_proto.proto_syntax import ProtoSyntax, ProtoSyntaxChanged class SyntaxTest(unittest.TestCase): diff --git a/py_proto/test/resources/BUILD.bazel b/src/python/py_proto/test/resources/BUILD.bazel similarity index 100% rename from py_proto/test/resources/BUILD.bazel rename to src/python/py_proto/test/resources/BUILD.bazel diff --git a/py_proto/test/resources/empty.proto b/src/python/py_proto/test/resources/empty.proto similarity index 100% rename from py_proto/test/resources/empty.proto rename to src/python/py_proto/test/resources/empty.proto diff --git a/py_proto/test/resources/single_message.proto b/src/python/py_proto/test/resources/single_message.proto similarity index 100% rename from py_proto/test/resources/single_message.proto rename to src/python/py_proto/test/resources/single_message.proto diff --git a/src/python/py_proto/test/util/BUILD.bazel b/src/python/py_proto/test/util/BUILD.bazel new file mode 100644 index 00000000..43c69b02 --- /dev/null +++ b/src/python/py_proto/test/util/BUILD.bazel @@ -0,0 +1,44 @@ +load("@rules_python//python:defs.bzl", "py_test") + +py_test( + name = "parser_test", + srcs = ["parser_test.py"], + deps = [ + "//src/python/py_proto:proto_comment", + "//src/python/py_proto:proto_constant", + "//src/python/py_proto:proto_enum", + "//src/python/py_proto:proto_extend", + "//src/python/py_proto:proto_extensions", + "//src/python/py_proto:proto_float", + "//src/python/py_proto:proto_identifier", + "//src/python/py_proto:proto_import", + "//src/python/py_proto:proto_int", + "//src/python/py_proto:proto_map", + "//src/python/py_proto:proto_message", + "//src/python/py_proto:proto_message_field", + "//src/python/py_proto:proto_option", + "//src/python/py_proto:proto_service", + "//src/python/py_proto:proto_string_literal", + "//src/python/py_proto:proto_syntax", + "//src/python/py_proto/util:parser", + ], +) + +sh_test( + name = "parser_binary_test", + srcs = ["parser_binary_test.sh"], + data = [ + "//src/python/py_proto/util:parser_binary", + "//src/python/py_proto/test/resources:all_protos", + "@com_google_protobuf//:all_proto", + ], +) + +sh_test( + name = "compatibility_checker_binary_test", + srcs = ["compatibility_checker_binary_test.sh"], + data = [ + "//src/python/py_proto/util:compatibility_checker_binary", + "//src/python/py_proto/test/resources:all_protos", + ], +) diff --git a/src/python/py_proto/test/util/compatibility_checker_binary_test.sh b/src/python/py_proto/test/util/compatibility_checker_binary_test.sh new file mode 100755 index 00000000..79c27c01 --- /dev/null +++ b/src/python/py_proto/test/util/compatibility_checker_binary_test.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +set -euxo pipefail + +./src/python/py_proto/util/compatibility_checker_binary ./src/python/py_proto/test/resources/empty.proto ./src/python/py_proto/test/resources/single_message.proto diff --git a/py_proto/test/util/parser_binary_test.sh b/src/python/py_proto/test/util/parser_binary_test.sh similarity index 60% rename from py_proto/test/util/parser_binary_test.sh rename to src/python/py_proto/test/util/parser_binary_test.sh index b0a817d2..e58b26e8 100755 --- a/py_proto/test/util/parser_binary_test.sh +++ b/src/python/py_proto/test/util/parser_binary_test.sh @@ -2,15 +2,15 @@ set -euo pipefail echo "Local protos:" -LOCAL_PROTOS=$(find ./test/resources -name "*.proto" | sort) +LOCAL_PROTOS=$(find ./src/python/py_proto/test/resources -name "*.proto" | sort) for f in $LOCAL_PROTOS; do echo $f - ./src/util/parser_binary $f > /dev/null + ./src/python/py_proto/util/parser_binary $f > /dev/null done echo "Google protos:" GOOGLE_PROTOS=$(find ./external/com_google_protobuf/src/google/protobuf -name "*.proto" | xargs grep --files-without-match "proto2" | sort) for f in $GOOGLE_PROTOS; do echo $f - ./src/util/parser_binary $f > /dev/null + ./src/python/py_proto/util/parser_binary $f > /dev/null done diff --git a/py_proto/test/util/parser_test.py b/src/python/py_proto/test/util/parser_test.py similarity index 92% rename from py_proto/test/util/parser_test.py rename to src/python/py_proto/test/util/parser_test.py index a6106514..d8397cad 100644 --- a/py_proto/test/util/parser_test.py +++ b/src/python/py_proto/test/util/parser_test.py @@ -1,34 +1,34 @@ import unittest from textwrap import dedent -from src.proto_bool import ProtoBool -from src.proto_comment import ProtoSingleLineComment -from src.proto_constant import ProtoConstant -from src.proto_enum import ProtoEnum, ProtoEnumValue -from src.proto_extend import ProtoExtend -from src.proto_extensions import ProtoExtensions -from src.proto_float import ProtoFloat, ProtoFloatSign -from src.proto_identifier import ( +from src.python.py_proto.proto_bool import ProtoBool +from src.python.py_proto.proto_comment import ProtoSingleLineComment +from src.python.py_proto.proto_constant import ProtoConstant +from src.python.py_proto.proto_enum import ProtoEnum, ProtoEnumValue +from src.python.py_proto.proto_extend import ProtoExtend +from src.python.py_proto.proto_extensions import ProtoExtensions +from src.python.py_proto.proto_float import ProtoFloat, ProtoFloatSign +from src.python.py_proto.proto_identifier import ( ProtoEnumOrMessageIdentifier, ProtoFullIdentifier, ProtoIdentifier, ) -from src.proto_import import ProtoImport -from src.proto_int import ProtoInt, ProtoIntSign -from src.proto_map import ProtoMap, ProtoMapKeyTypesEnum, ProtoMapValueTypesEnum -from src.proto_message import ProtoMessage, ProtoOneOf -from src.proto_message_field import ( +from src.python.py_proto.proto_import import ProtoImport +from src.python.py_proto.proto_int import ProtoInt, ProtoIntSign +from src.python.py_proto.proto_map import ProtoMap, ProtoMapKeyTypesEnum, ProtoMapValueTypesEnum +from src.python.py_proto.proto_message import ProtoMessage, ProtoOneOf +from src.python.py_proto.proto_message_field import ( ProtoMessageField, ProtoMessageFieldOption, ProtoMessageFieldTypesEnum, ) -from src.proto_option import ProtoOption -from src.proto_range import ProtoRange, ProtoRangeEnum -from src.proto_reserved import ProtoReserved -from src.proto_service import ProtoService, ProtoServiceRPC -from src.proto_string_literal import ProtoStringLiteral -from src.proto_syntax import ProtoSyntaxType -from src.util.parser import ParseError, Parser +from src.python.py_proto.proto_option import ProtoOption +from src.python.py_proto.proto_range import ProtoRange, ProtoRangeEnum +from src.python.py_proto.proto_reserved import ProtoReserved +from src.python.py_proto.proto_service import ProtoService, ProtoServiceRPC +from src.python.py_proto.proto_string_literal import ProtoStringLiteral +from src.python.py_proto.proto_syntax import ProtoSyntaxType +from src.python.py_proto.util.parser import ParseError, Parser class IntTest(unittest.TestCase): diff --git a/py_proto/src/util/BUILD.bazel b/src/python/py_proto/util/BUILD.bazel similarity index 84% rename from py_proto/src/util/BUILD.bazel rename to src/python/py_proto/util/BUILD.bazel index 03f34236..80d69077 100644 --- a/py_proto/src/util/BUILD.bazel +++ b/src/python/py_proto/util/BUILD.bazel @@ -5,7 +5,7 @@ py_library( srcs = ["parser.py"], visibility = ["//visibility:public"], deps = [ - "//src:proto_file", + "//src/python/py_proto:proto_file", ], ) @@ -23,8 +23,8 @@ py_library( visibility = ["//visibility:public"], deps = [ ":parser", - "//src:proto_file", - "//src:proto_node", + "//src/python/py_proto:proto_file", + "//src/python/py_proto:proto_node", ], ) diff --git a/py_proto/src/util/compatibility_checker.py b/src/python/py_proto/util/compatibility_checker.py similarity index 79% rename from py_proto/src/util/compatibility_checker.py rename to src/python/py_proto/util/compatibility_checker.py index 45b16f5a..99da283a 100644 --- a/py_proto/src/util/compatibility_checker.py +++ b/src/python/py_proto/util/compatibility_checker.py @@ -2,10 +2,10 @@ from dataclasses import dataclass from typing import Type -from src.proto_file import ProtoFile -from src.proto_message import ProtoMessageAdded -from src.proto_node import ProtoNodeDiff -from src.util.parser import Parser +from src.python.py_proto.proto_file import ProtoFile +from src.python.py_proto.proto_message import ProtoMessageAdded +from src.python.py_proto.proto_node import ProtoNodeDiff +from src.python.py_proto.util.parser import Parser @dataclass diff --git a/py_proto/src/util/parser.py b/src/python/py_proto/util/parser.py similarity index 92% rename from py_proto/src/util/parser.py rename to src/python/py_proto/util/parser.py index 1bd067f2..49a588ab 100644 --- a/py_proto/src/util/parser.py +++ b/src/python/py_proto/util/parser.py @@ -1,6 +1,6 @@ import sys -from src.proto_file import ProtoFile +from src.python.py_proto.proto_file import ProtoFile class ParseError(ValueError): diff --git a/py_proto/src/requirements.txt b/src/python/requirements.txt similarity index 100% rename from py_proto/src/requirements.txt rename to src/python/requirements.txt