From a33c4bf0b780c136a60b75d6b6c587e1827ef916 Mon Sep 17 00:00:00 2001 From: "Philip K. Warren" Date: Tue, 4 Apr 2023 11:55:16 -0500 Subject: [PATCH] Add mypy plugins to community (#470) Add the mypy and mypy-grpc plugins. Fixes #219, #360, #452. --- .../community/nipunn1313-mypy-grpc/source.yaml | 4 ++++ .../nipunn1313-mypy-grpc/v3.4.0/.dockerignore | 3 +++ .../nipunn1313-mypy-grpc/v3.4.0/Dockerfile | 15 +++++++++++++++ .../nipunn1313-mypy-grpc/v3.4.0/buf.plugin.yaml | 9 +++++++++ .../nipunn1313-mypy-grpc/v3.4.0/requirements.txt | 3 +++ plugins/community/nipunn1313-mypy/source.yaml | 4 ++++ .../nipunn1313-mypy/v3.4.0/.dockerignore | 3 +++ .../community/nipunn1313-mypy/v3.4.0/Dockerfile | 15 +++++++++++++++ .../nipunn1313-mypy/v3.4.0/buf.plugin.yaml | 9 +++++++++ .../nipunn1313-mypy/v3.4.0/requirements.txt | 3 +++ .../nipunn1313-mypy-grpc/v3.4.0/eliza/plugin.sum | 1 + .../v3.4.0/petapis/plugin.sum | 1 + .../nipunn1313-mypy/v3.4.0/eliza/plugin.sum | 1 + .../nipunn1313-mypy/v3.4.0/petapis/plugin.sum | 1 + 14 files changed, 72 insertions(+) create mode 100644 plugins/community/nipunn1313-mypy-grpc/source.yaml create mode 100644 plugins/community/nipunn1313-mypy-grpc/v3.4.0/.dockerignore create mode 100644 plugins/community/nipunn1313-mypy-grpc/v3.4.0/Dockerfile create mode 100644 plugins/community/nipunn1313-mypy-grpc/v3.4.0/buf.plugin.yaml create mode 100644 plugins/community/nipunn1313-mypy-grpc/v3.4.0/requirements.txt create mode 100644 plugins/community/nipunn1313-mypy/source.yaml create mode 100644 plugins/community/nipunn1313-mypy/v3.4.0/.dockerignore create mode 100644 plugins/community/nipunn1313-mypy/v3.4.0/Dockerfile create mode 100644 plugins/community/nipunn1313-mypy/v3.4.0/buf.plugin.yaml create mode 100644 plugins/community/nipunn1313-mypy/v3.4.0/requirements.txt create mode 100644 tests/testdata/buf.build/community/nipunn1313-mypy-grpc/v3.4.0/eliza/plugin.sum create mode 100644 tests/testdata/buf.build/community/nipunn1313-mypy-grpc/v3.4.0/petapis/plugin.sum create mode 100644 tests/testdata/buf.build/community/nipunn1313-mypy/v3.4.0/eliza/plugin.sum create mode 100644 tests/testdata/buf.build/community/nipunn1313-mypy/v3.4.0/petapis/plugin.sum diff --git a/plugins/community/nipunn1313-mypy-grpc/source.yaml b/plugins/community/nipunn1313-mypy-grpc/source.yaml new file mode 100644 index 000000000..4b678c641 --- /dev/null +++ b/plugins/community/nipunn1313-mypy-grpc/source.yaml @@ -0,0 +1,4 @@ +source: + github: + owner: nipunn1313 + repository: mypy-protobuf diff --git a/plugins/community/nipunn1313-mypy-grpc/v3.4.0/.dockerignore b/plugins/community/nipunn1313-mypy-grpc/v3.4.0/.dockerignore new file mode 100644 index 000000000..c8a679bc6 --- /dev/null +++ b/plugins/community/nipunn1313-mypy-grpc/v3.4.0/.dockerignore @@ -0,0 +1,3 @@ +* +!Dockerfile +!requirements.txt diff --git a/plugins/community/nipunn1313-mypy-grpc/v3.4.0/Dockerfile b/plugins/community/nipunn1313-mypy-grpc/v3.4.0/Dockerfile new file mode 100644 index 000000000..f63d03534 --- /dev/null +++ b/plugins/community/nipunn1313-mypy-grpc/v3.4.0/Dockerfile @@ -0,0 +1,15 @@ +# syntax=docker/dockerfile:1.4 +FROM python:3.11.2-alpine3.17 AS build +WORKDIR /app +RUN python -mvenv /app +ADD /requirements.txt requirements.txt +RUN source ./bin/activate \ + && pip install --no-cache-dir -r requirements.txt \ + && pip uninstall --yes pip setuptools \ + && rm -f requirements.txt bin/activate.fish bin/activate.csh bin/Activate.ps1 \ + && rm -f bin/protoc-gen-mypy + +FROM python:3.11.2-alpine3.17 +COPY --from=build --link /app /app +USER nobody +ENTRYPOINT [ "/app/bin/protoc-gen-mypy_grpc" ] diff --git a/plugins/community/nipunn1313-mypy-grpc/v3.4.0/buf.plugin.yaml b/plugins/community/nipunn1313-mypy-grpc/v3.4.0/buf.plugin.yaml new file mode 100644 index 000000000..4c4941a73 --- /dev/null +++ b/plugins/community/nipunn1313-mypy-grpc/v3.4.0/buf.plugin.yaml @@ -0,0 +1,9 @@ +version: v1 +name: buf.build/community/nipunn1313-mypy-grpc +plugin_version: v3.4.0 +source_url: https://github.com/nipunn1313/mypy-protobuf +description: Generate mypy stub files for grpcio generated code. +spdx_license_id: Apache-2.0 +license_url: https://github.com/nipunn1313/mypy-protobuf/blob/v3.4.0/LICENSE +output_languages: + - python diff --git a/plugins/community/nipunn1313-mypy-grpc/v3.4.0/requirements.txt b/plugins/community/nipunn1313-mypy-grpc/v3.4.0/requirements.txt new file mode 100644 index 000000000..410c83042 --- /dev/null +++ b/plugins/community/nipunn1313-mypy-grpc/v3.4.0/requirements.txt @@ -0,0 +1,3 @@ +mypy-protobuf==3.4.0 +protobuf==4.22.1 +types-protobuf==4.22.0.2 diff --git a/plugins/community/nipunn1313-mypy/source.yaml b/plugins/community/nipunn1313-mypy/source.yaml new file mode 100644 index 000000000..4b678c641 --- /dev/null +++ b/plugins/community/nipunn1313-mypy/source.yaml @@ -0,0 +1,4 @@ +source: + github: + owner: nipunn1313 + repository: mypy-protobuf diff --git a/plugins/community/nipunn1313-mypy/v3.4.0/.dockerignore b/plugins/community/nipunn1313-mypy/v3.4.0/.dockerignore new file mode 100644 index 000000000..c8a679bc6 --- /dev/null +++ b/plugins/community/nipunn1313-mypy/v3.4.0/.dockerignore @@ -0,0 +1,3 @@ +* +!Dockerfile +!requirements.txt diff --git a/plugins/community/nipunn1313-mypy/v3.4.0/Dockerfile b/plugins/community/nipunn1313-mypy/v3.4.0/Dockerfile new file mode 100644 index 000000000..e2b4bb122 --- /dev/null +++ b/plugins/community/nipunn1313-mypy/v3.4.0/Dockerfile @@ -0,0 +1,15 @@ +# syntax=docker/dockerfile:1.4 +FROM python:3.11.2-alpine3.17 AS build +WORKDIR /app +RUN python -mvenv /app +ADD /requirements.txt requirements.txt +RUN source ./bin/activate \ + && pip install --no-cache-dir -r requirements.txt \ + && pip uninstall --yes pip setuptools \ + && rm -f requirements.txt bin/activate.fish bin/activate.csh bin/Activate.ps1 \ + && rm -f bin/protoc-gen-mypy_grpc + +FROM python:3.11.2-alpine3.17 +COPY --from=build --link /app /app +USER nobody +ENTRYPOINT [ "/app/bin/protoc-gen-mypy" ] diff --git a/plugins/community/nipunn1313-mypy/v3.4.0/buf.plugin.yaml b/plugins/community/nipunn1313-mypy/v3.4.0/buf.plugin.yaml new file mode 100644 index 000000000..1d71bc6f2 --- /dev/null +++ b/plugins/community/nipunn1313-mypy/v3.4.0/buf.plugin.yaml @@ -0,0 +1,9 @@ +version: v1 +name: buf.build/community/nipunn1313-mypy +plugin_version: v3.4.0 +source_url: https://github.com/nipunn1313/mypy-protobuf +description: Generate mypy stub files from Protobuf definitions. +spdx_license_id: Apache-2.0 +license_url: https://github.com/nipunn1313/mypy-protobuf/blob/v3.4.0/LICENSE +output_languages: + - python diff --git a/plugins/community/nipunn1313-mypy/v3.4.0/requirements.txt b/plugins/community/nipunn1313-mypy/v3.4.0/requirements.txt new file mode 100644 index 000000000..410c83042 --- /dev/null +++ b/plugins/community/nipunn1313-mypy/v3.4.0/requirements.txt @@ -0,0 +1,3 @@ +mypy-protobuf==3.4.0 +protobuf==4.22.1 +types-protobuf==4.22.0.2 diff --git a/tests/testdata/buf.build/community/nipunn1313-mypy-grpc/v3.4.0/eliza/plugin.sum b/tests/testdata/buf.build/community/nipunn1313-mypy-grpc/v3.4.0/eliza/plugin.sum new file mode 100644 index 000000000..8bf1d55f8 --- /dev/null +++ b/tests/testdata/buf.build/community/nipunn1313-mypy-grpc/v3.4.0/eliza/plugin.sum @@ -0,0 +1 @@ +h1:A9N7pBCImjZXsRR9ABT9dmXFavxnOQRDMKxaM/RtxfQ= diff --git a/tests/testdata/buf.build/community/nipunn1313-mypy-grpc/v3.4.0/petapis/plugin.sum b/tests/testdata/buf.build/community/nipunn1313-mypy-grpc/v3.4.0/petapis/plugin.sum new file mode 100644 index 000000000..6e16305ed --- /dev/null +++ b/tests/testdata/buf.build/community/nipunn1313-mypy-grpc/v3.4.0/petapis/plugin.sum @@ -0,0 +1 @@ +h1:MWz8GNw9QHRiQZ1FZ/twTTwpQleK+Msf9BckmRsbSEg= diff --git a/tests/testdata/buf.build/community/nipunn1313-mypy/v3.4.0/eliza/plugin.sum b/tests/testdata/buf.build/community/nipunn1313-mypy/v3.4.0/eliza/plugin.sum new file mode 100644 index 000000000..3378b2642 --- /dev/null +++ b/tests/testdata/buf.build/community/nipunn1313-mypy/v3.4.0/eliza/plugin.sum @@ -0,0 +1 @@ +h1:g9p6eDyJyzHhp8zDP3ZbYIBl/CMoG5d8Q8mjMusOqY8= diff --git a/tests/testdata/buf.build/community/nipunn1313-mypy/v3.4.0/petapis/plugin.sum b/tests/testdata/buf.build/community/nipunn1313-mypy/v3.4.0/petapis/plugin.sum new file mode 100644 index 000000000..d8adf5c31 --- /dev/null +++ b/tests/testdata/buf.build/community/nipunn1313-mypy/v3.4.0/petapis/plugin.sum @@ -0,0 +1 @@ +h1:Si8XgIwUSUICXMVOAqHgRd4rUeUb7bEyD8yos4Ko2t8=