From 02a6679e6251b43e5a75357c697becefb9d7e03d Mon Sep 17 00:00:00 2001 From: Aidan Jensen Date: Mon, 1 Dec 2025 08:57:24 -0800 Subject: [PATCH] use correct path casing for python Signed-off-by: Aidan Jensen --- .gitignore | 4 +- pyproject.toml | 2 +- run_test.sh | 6 +- .../google/protobuf/duration_pb2.pyi | 0 .../mypy_protobuf/extensions_pb2.pyi | 0 .../testproto/Capitalized/Capitalized_pb2.pyi | 0 .../testproto/comment_special_chars_pb2.pyi | 0 .../testproto/dot/com/test_pb2.pyi | 0 .../testproto/edition2024_pb2.pyi | 68 +++++++++++++++++++ .../testproto/grpc/dummy_pb2.pyi | 0 .../testproto/grpc/dummy_pb2_grpc.pyi | 0 .../testproto/grpc/import_pb2.pyi | 0 .../testproto/grpc/import_pb2_grpc.pyi | 0 .../testproto/inner/inner_pb2.pyi | 0 .../testproto/nested/nested_pb2.pyi | 0 .../testproto/nopackage_pb2.pyi | 0 .../testproto/readme_enum_pb2.pyi | 0 .../testproto/reexport_pb2.pyi | 0 .../testproto/test3_pb2.pyi | 0 .../testproto/test_extensions2_pb2.pyi | 0 .../testproto/test_extensions3_pb2.pyi | 0 .../test_no_generic_services_pb2.pyi | 0 .../testproto/test_pb2.pyi | 0 23 files changed, 74 insertions(+), 6 deletions(-) rename test/{generated-concrete => generated_concrete}/google/protobuf/duration_pb2.pyi (100%) rename test/{generated-concrete => generated_concrete}/mypy_protobuf/extensions_pb2.pyi (100%) rename test/{generated-concrete => generated_concrete}/testproto/Capitalized/Capitalized_pb2.pyi (100%) rename test/{generated-concrete => generated_concrete}/testproto/comment_special_chars_pb2.pyi (100%) rename test/{generated-concrete => generated_concrete}/testproto/dot/com/test_pb2.pyi (100%) create mode 100644 test/generated_concrete/testproto/edition2024_pb2.pyi rename test/{generated-concrete => generated_concrete}/testproto/grpc/dummy_pb2.pyi (100%) rename test/{generated-concrete => generated_concrete}/testproto/grpc/dummy_pb2_grpc.pyi (100%) rename test/{generated-concrete => generated_concrete}/testproto/grpc/import_pb2.pyi (100%) rename test/{generated-concrete => generated_concrete}/testproto/grpc/import_pb2_grpc.pyi (100%) rename test/{generated-concrete => generated_concrete}/testproto/inner/inner_pb2.pyi (100%) rename test/{generated-concrete => generated_concrete}/testproto/nested/nested_pb2.pyi (100%) rename test/{generated-concrete => generated_concrete}/testproto/nopackage_pb2.pyi (100%) rename test/{generated-concrete => generated_concrete}/testproto/readme_enum_pb2.pyi (100%) rename test/{generated-concrete => generated_concrete}/testproto/reexport_pb2.pyi (100%) rename test/{generated-concrete => generated_concrete}/testproto/test3_pb2.pyi (100%) rename test/{generated-concrete => generated_concrete}/testproto/test_extensions2_pb2.pyi (100%) rename test/{generated-concrete => generated_concrete}/testproto/test_extensions3_pb2.pyi (100%) rename test/{generated-concrete => generated_concrete}/testproto/test_no_generic_services_pb2.pyi (100%) rename test/{generated-concrete => generated_concrete}/testproto/test_pb2.pyi (100%) diff --git a/.gitignore b/.gitignore index 18a5a134..61d2a647 100644 --- a/.gitignore +++ b/.gitignore @@ -8,8 +8,8 @@ __pycache__/ *.pyc /test/generated/**/*.py !/test/generated/**/__init__.py -/test/generated-concrete/**/*.py -!/test/generated-concrete/**/__init__.py +/test/generated_concrete/**/*.py +!/test/generated_concrete/**/__init__.py .pytest_cache /build/ /dist/ diff --git a/pyproject.toml b/pyproject.toml index ff1a16d9..0c5c892d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,6 +39,6 @@ exclude = [ executionEnvironments = [ # Due to how upb is typed, we need to disable incompatible variable override checks { root = "test/generated", extraPaths = ["./"], reportIncompatibleVariableOverride = "none" }, - { root = "test/generated-concrete", extraPaths = ["./"], reportIncompatibleVariableOverride = "none" }, + { root = "test/generated_concrete", extraPaths = ["./"], reportIncompatibleVariableOverride = "none" }, { root = "mypy_protobuf/extensions_pb2.pyi", reportIncompatibleVariableOverride = "none" }, ] diff --git a/run_test.sh b/run_test.sh index f6426ac6..849f83d7 100755 --- a/run_test.sh +++ b/run_test.sh @@ -132,8 +132,8 @@ MYPY_PROTOBUF_VENV=venv_$PY_VER_MYPY_PROTOBUF find proto/testproto/grpc -name "*.proto" -print0 | xargs -0 "$PROTOC" "${PROTOC_ARGS[@]}" --mypy_grpc_out=test/generated # Generate with concrete service stubs for testing - find proto -name "*.proto" -print0 | xargs -0 "$PROTOC" "${PROTOC_ARGS[@]}" --mypy_out=generate_concrete_servicer_stubs:test/generated-concrete - find proto/testproto/grpc -name "*.proto" -print0 | xargs -0 "$PROTOC" "${PROTOC_ARGS[@]}" --mypy_grpc_out=generate_concrete_servicer_stubs:test/generated-concrete + find proto -name "*.proto" -print0 | xargs -0 "$PROTOC" "${PROTOC_ARGS[@]}" --mypy_out=generate_concrete_servicer_stubs:test/generated_concrete + find proto/testproto/grpc -name "*.proto" -print0 | xargs -0 "$PROTOC" "${PROTOC_ARGS[@]}" --mypy_grpc_out=generate_concrete_servicer_stubs:test/generated_concrete if [[ -n $VALIDATE ]] && ! diff <(echo "$SHA_BEFORE") <(find test/generated -name "*.pyi" -print0 | xargs -0 sha1sum); then @@ -159,7 +159,7 @@ for PY_VER in $PY_VER_UNIT_TESTS; do source "$MYPY_VENV"/bin/activate # Run concrete mypy CONCRETE_MODULES=( -m test.test_concrete ) - MYPYPATH=$MYPYPATH:test/generated-concrete mypy ${CUSTOM_TYPESHED_DIR_ARG:+"$CUSTOM_TYPESHED_DIR_ARG"} --python-executable="$UNIT_TESTS_VENV"/bin/python --python-version="$PY_VER_MYPY_TARGET" "${CONCRETE_MODULES[@]}" + MYPYPATH=$MYPYPATH:test/generated_concrete mypy ${CUSTOM_TYPESHED_DIR_ARG:+"$CUSTOM_TYPESHED_DIR_ARG"} --python-executable="$UNIT_TESTS_VENV"/bin/python --python-version="$PY_VER_MYPY_TARGET" "${CONCRETE_MODULES[@]}" export MYPYPATH=$MYPYPATH:test/generated diff --git a/test/generated-concrete/google/protobuf/duration_pb2.pyi b/test/generated_concrete/google/protobuf/duration_pb2.pyi similarity index 100% rename from test/generated-concrete/google/protobuf/duration_pb2.pyi rename to test/generated_concrete/google/protobuf/duration_pb2.pyi diff --git a/test/generated-concrete/mypy_protobuf/extensions_pb2.pyi b/test/generated_concrete/mypy_protobuf/extensions_pb2.pyi similarity index 100% rename from test/generated-concrete/mypy_protobuf/extensions_pb2.pyi rename to test/generated_concrete/mypy_protobuf/extensions_pb2.pyi diff --git a/test/generated-concrete/testproto/Capitalized/Capitalized_pb2.pyi b/test/generated_concrete/testproto/Capitalized/Capitalized_pb2.pyi similarity index 100% rename from test/generated-concrete/testproto/Capitalized/Capitalized_pb2.pyi rename to test/generated_concrete/testproto/Capitalized/Capitalized_pb2.pyi diff --git a/test/generated-concrete/testproto/comment_special_chars_pb2.pyi b/test/generated_concrete/testproto/comment_special_chars_pb2.pyi similarity index 100% rename from test/generated-concrete/testproto/comment_special_chars_pb2.pyi rename to test/generated_concrete/testproto/comment_special_chars_pb2.pyi diff --git a/test/generated-concrete/testproto/dot/com/test_pb2.pyi b/test/generated_concrete/testproto/dot/com/test_pb2.pyi similarity index 100% rename from test/generated-concrete/testproto/dot/com/test_pb2.pyi rename to test/generated_concrete/testproto/dot/com/test_pb2.pyi diff --git a/test/generated_concrete/testproto/edition2024_pb2.pyi b/test/generated_concrete/testproto/edition2024_pb2.pyi new file mode 100644 index 00000000..6de2ba64 --- /dev/null +++ b/test/generated_concrete/testproto/edition2024_pb2.pyi @@ -0,0 +1,68 @@ +""" +@generated by mypy-protobuf. Do not edit manually! +isort:skip_file +Edition version of proto2 file""" + +import builtins +import google.protobuf.descriptor +import google.protobuf.message +import sys +import typing + +if sys.version_info >= (3, 10): + import typing as typing_extensions +else: + import typing_extensions + +DESCRIPTOR: google.protobuf.descriptor.FileDescriptor + +@typing.final +class Editions2024SubMessage(google.protobuf.message.Message): + DESCRIPTOR: google.protobuf.descriptor.Descriptor + + THING_FIELD_NUMBER: builtins.int + thing: builtins.str + def __init__( + self, + *, + thing: builtins.str | None = ..., + ) -> None: ... + def HasField(self, field_name: typing.Literal["thing", b"thing"]) -> builtins.bool: ... + def ClearField(self, field_name: typing.Literal["thing", b"thing"]) -> None: ... + +Global___Editions2024SubMessage: typing_extensions.TypeAlias = Editions2024SubMessage + +@typing.final +class Editions2024Test(google.protobuf.message.Message): + DESCRIPTOR: google.protobuf.descriptor.Descriptor + + LEGACY_FIELD_NUMBER: builtins.int + EXPLICIT_SINGULAR_FIELD_NUMBER: builtins.int + MESSAGE_FIELD_FIELD_NUMBER: builtins.int + IMPLICIT_SINGULAR_FIELD_NUMBER: builtins.int + DEFAULT_SINGULAR_FIELD_NUMBER: builtins.int + legacy: builtins.str + """Expect to be always set""" + explicit_singular: builtins.str + """Expect HasField generated""" + implicit_singular: builtins.str + """Expect implicit field presence, no HasField generated""" + default_singular: builtins.str + """Not set, should default to EXPLICIT""" + @property + def message_field(self) -> Global___Editions2024SubMessage: + """Expect HasField generated?""" + + def __init__( + self, + *, + legacy: builtins.str | None = ..., + explicit_singular: builtins.str | None = ..., + message_field: Global___Editions2024SubMessage | None = ..., + implicit_singular: builtins.str = ..., + default_singular: builtins.str | None = ..., + ) -> None: ... + def HasField(self, field_name: typing.Literal["default_singular", b"default_singular", "explicit_singular", b"explicit_singular", "legacy", b"legacy", "message_field", b"message_field"]) -> builtins.bool: ... + def ClearField(self, field_name: typing.Literal["default_singular", b"default_singular", "explicit_singular", b"explicit_singular", "implicit_singular", b"implicit_singular", "legacy", b"legacy", "message_field", b"message_field"]) -> None: ... + +Global___Editions2024Test: typing_extensions.TypeAlias = Editions2024Test diff --git a/test/generated-concrete/testproto/grpc/dummy_pb2.pyi b/test/generated_concrete/testproto/grpc/dummy_pb2.pyi similarity index 100% rename from test/generated-concrete/testproto/grpc/dummy_pb2.pyi rename to test/generated_concrete/testproto/grpc/dummy_pb2.pyi diff --git a/test/generated-concrete/testproto/grpc/dummy_pb2_grpc.pyi b/test/generated_concrete/testproto/grpc/dummy_pb2_grpc.pyi similarity index 100% rename from test/generated-concrete/testproto/grpc/dummy_pb2_grpc.pyi rename to test/generated_concrete/testproto/grpc/dummy_pb2_grpc.pyi diff --git a/test/generated-concrete/testproto/grpc/import_pb2.pyi b/test/generated_concrete/testproto/grpc/import_pb2.pyi similarity index 100% rename from test/generated-concrete/testproto/grpc/import_pb2.pyi rename to test/generated_concrete/testproto/grpc/import_pb2.pyi diff --git a/test/generated-concrete/testproto/grpc/import_pb2_grpc.pyi b/test/generated_concrete/testproto/grpc/import_pb2_grpc.pyi similarity index 100% rename from test/generated-concrete/testproto/grpc/import_pb2_grpc.pyi rename to test/generated_concrete/testproto/grpc/import_pb2_grpc.pyi diff --git a/test/generated-concrete/testproto/inner/inner_pb2.pyi b/test/generated_concrete/testproto/inner/inner_pb2.pyi similarity index 100% rename from test/generated-concrete/testproto/inner/inner_pb2.pyi rename to test/generated_concrete/testproto/inner/inner_pb2.pyi diff --git a/test/generated-concrete/testproto/nested/nested_pb2.pyi b/test/generated_concrete/testproto/nested/nested_pb2.pyi similarity index 100% rename from test/generated-concrete/testproto/nested/nested_pb2.pyi rename to test/generated_concrete/testproto/nested/nested_pb2.pyi diff --git a/test/generated-concrete/testproto/nopackage_pb2.pyi b/test/generated_concrete/testproto/nopackage_pb2.pyi similarity index 100% rename from test/generated-concrete/testproto/nopackage_pb2.pyi rename to test/generated_concrete/testproto/nopackage_pb2.pyi diff --git a/test/generated-concrete/testproto/readme_enum_pb2.pyi b/test/generated_concrete/testproto/readme_enum_pb2.pyi similarity index 100% rename from test/generated-concrete/testproto/readme_enum_pb2.pyi rename to test/generated_concrete/testproto/readme_enum_pb2.pyi diff --git a/test/generated-concrete/testproto/reexport_pb2.pyi b/test/generated_concrete/testproto/reexport_pb2.pyi similarity index 100% rename from test/generated-concrete/testproto/reexport_pb2.pyi rename to test/generated_concrete/testproto/reexport_pb2.pyi diff --git a/test/generated-concrete/testproto/test3_pb2.pyi b/test/generated_concrete/testproto/test3_pb2.pyi similarity index 100% rename from test/generated-concrete/testproto/test3_pb2.pyi rename to test/generated_concrete/testproto/test3_pb2.pyi diff --git a/test/generated-concrete/testproto/test_extensions2_pb2.pyi b/test/generated_concrete/testproto/test_extensions2_pb2.pyi similarity index 100% rename from test/generated-concrete/testproto/test_extensions2_pb2.pyi rename to test/generated_concrete/testproto/test_extensions2_pb2.pyi diff --git a/test/generated-concrete/testproto/test_extensions3_pb2.pyi b/test/generated_concrete/testproto/test_extensions3_pb2.pyi similarity index 100% rename from test/generated-concrete/testproto/test_extensions3_pb2.pyi rename to test/generated_concrete/testproto/test_extensions3_pb2.pyi diff --git a/test/generated-concrete/testproto/test_no_generic_services_pb2.pyi b/test/generated_concrete/testproto/test_no_generic_services_pb2.pyi similarity index 100% rename from test/generated-concrete/testproto/test_no_generic_services_pb2.pyi rename to test/generated_concrete/testproto/test_no_generic_services_pb2.pyi diff --git a/test/generated-concrete/testproto/test_pb2.pyi b/test/generated_concrete/testproto/test_pb2.pyi similarity index 100% rename from test/generated-concrete/testproto/test_pb2.pyi rename to test/generated_concrete/testproto/test_pb2.pyi