Skip to content

Commit 8b9efd5

Browse files
authored
Update nipunn1313-mypy plugins to the latest (#2105)
Update plugins to use bookworm based build image and distroless base image. Fixes #2104.
1 parent 9ac5149 commit 8b9efd5

File tree

12 files changed

+99
-0
lines changed

12 files changed

+99
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*
2+
!Dockerfile
3+
!requirements.txt
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# syntax=docker/dockerfile:1.19
2+
FROM python:3.11.13-bookworm AS build
3+
WORKDIR /app
4+
RUN python -mvenv /app
5+
ADD /requirements.txt requirements.txt
6+
RUN . ./bin/activate \
7+
&& pip install --no-cache-dir -r requirements.txt \
8+
&& pip uninstall --yes pip setuptools \
9+
&& rm -f requirements.txt bin/activate.fish bin/activate.csh bin/Activate.ps1 \
10+
&& rm -f bin/protoc-gen-mypy \
11+
&& ln -sf /usr/bin/python /app/bin/python
12+
13+
FROM gcr.io/distroless/python3-debian12:latest@sha256:afdfc6df9eb96cf65576d4d59af48c4b5dac29ad62066aee879f12b303298aac AS base
14+
15+
FROM scratch
16+
COPY --link --from=base / /
17+
COPY --link --from=build /app /app
18+
USER nobody
19+
ENTRYPOINT [ "/app/bin/protoc-gen-mypy_grpc" ]
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
version: v1
2+
name: buf.build/community/nipunn1313-mypy-grpc
3+
plugin_version: v3.7.0
4+
source_url: https://github.com/nipunn1313/mypy-protobuf
5+
description: Generate mypy stub files for grpcio generated code.
6+
spdx_license_id: Apache-2.0
7+
license_url: https://github.com/nipunn1313/mypy-protobuf/blob/v3.7.0/LICENSE
8+
output_languages:
9+
- python
10+
registry:
11+
python:
12+
package_type: "stub-only"
13+
# https://github.com/nipunn1313/mypy-protobuf/blob/v3.7.0/setup.cfg#L20
14+
requires_python: ">=3.8"
15+
deps:
16+
# https://github.com/nipunn1313/mypy-protobuf/tree/v3.7.0#requirements-to-run-typecheckers-on-stubs-generated-by-mypy-protobuf
17+
# > Earlier releases might work, but aren't tested.
18+
- "types-protobuf >= 5.28"
19+
- "protobuf >= 5.28.2"
20+
# https://github.com/nipunn1313/mypy-protobuf/tree/v3.7.0#to-run-typecheckers-on-code-generated-with-grpc-plugin---youll-additionally-need
21+
# > Earlier releases might work, but aren't tested
22+
- "grpcio >= 1.66.2"
23+
# https://pypi.org/project/grpcio-tools/
24+
- "grpcio-tools >= 1.66.2"
25+
# https://pypi.org/project/grpc-stubs/
26+
- "grpc-stubs >= 1.53.0.5"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
mypy-protobuf==3.7.0
2+
protobuf==6.33.1
3+
types-protobuf==6.32.1.20251105
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*
2+
!Dockerfile
3+
!requirements.txt
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# syntax=docker/dockerfile:1.19
2+
FROM python:3.11.13-bookworm AS build
3+
WORKDIR /app
4+
RUN python -mvenv /app
5+
ADD /requirements.txt requirements.txt
6+
RUN . ./bin/activate \
7+
&& pip install --no-cache-dir -r requirements.txt \
8+
&& pip uninstall --yes pip setuptools \
9+
&& rm -f requirements.txt bin/activate.fish bin/activate.csh bin/Activate.ps1 \
10+
&& rm -f bin/protoc-gen-mypy_grpc \
11+
&& ln -sf /usr/bin/python /app/bin/python
12+
13+
FROM gcr.io/distroless/python3-debian12:latest@sha256:afdfc6df9eb96cf65576d4d59af48c4b5dac29ad62066aee879f12b303298aac AS base
14+
15+
FROM scratch
16+
COPY --link --from=base / /
17+
COPY --link --from=build /app /app
18+
USER nobody
19+
ENTRYPOINT [ "/app/bin/protoc-gen-mypy" ]
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
version: v1
2+
name: buf.build/community/nipunn1313-mypy
3+
plugin_version: v3.7.0
4+
source_url: https://github.com/nipunn1313/mypy-protobuf
5+
description: Generate mypy stub files from Protobuf definitions.
6+
spdx_license_id: Apache-2.0
7+
license_url: https://github.com/nipunn1313/mypy-protobuf/blob/v3.7.0/LICENSE
8+
output_languages:
9+
- python
10+
registry:
11+
python:
12+
package_type: "stub-only"
13+
# https://github.com/nipunn1313/mypy-protobuf/blob/v3.7.0/setup.cfg#L20
14+
requires_python: ">=3.8"
15+
deps:
16+
# https://github.com/nipunn1313/mypy-protobuf/tree/v3.7.0#requirements-to-run-typecheckers-on-stubs-generated-by-mypy-protobuf
17+
# > Earlier releases might work, but aren't tested.
18+
- "types-protobuf >= 5.28"
19+
- "protobuf >= 5.28.2"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
mypy-protobuf==3.7.0
2+
protobuf==6.33.1
3+
types-protobuf==6.32.1.20251105
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
h1:BYBWcreiMNyJTziSDWALko0+It2W4rJ10gW7o7SFwt0=
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
h1:1+ccsrCy1Elhcob9b7xjjzSeqcvX94svl2IgCvDssnM=

0 commit comments

Comments
 (0)