Skip to content

Commit 1deabc1

Browse files
oliversun9anuraaga
andauthored
Add protobuf-py plugins (#2561)
This contains changes from #2553 with `registry` field added to the `buf.pluin.yaml`s and `v0.1.0` changed to `v0.1.1`. --------- Co-authored-by: Anuraag Agrawal <anuraaga@gmail.com>
1 parent 2f7f96e commit 1deabc1

14 files changed

Lines changed: 94 additions & 0 deletions

File tree

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
source:
2+
pypi:
3+
name: protoc-gen-grpc-py
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: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# syntax=docker/dockerfile:1.24
2+
FROM python:3.13.14-trixie@sha256:6cd5c8d0efe5d264728f3690053b26807572f25805a643395752eca19148e31c 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+
&& ln -sf /usr/bin/python /app/bin/python
11+
12+
FROM gcr.io/distroless/python3-debian13:latest@sha256:178dd00f2da3271f3819df5cd327472754946c7430d82197b247e95e839a3d55 AS base
13+
14+
FROM scratch
15+
COPY --link --from=base / /
16+
COPY --link --from=build --chmod=0755 /app /app
17+
USER nobody
18+
CMD [ "/app/bin/protoc-gen-grpc-py" ]
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
version: v1
2+
name: buf.build/bufbuild/grpc-py
3+
plugin_version: v0.1.1
4+
source_url: https://github.com/bufbuild/protobuf-py
5+
description: Generates gRPC-Python stubs that use protobuf-py.
6+
deps:
7+
- plugin: buf.build/bufbuild/py:v0.1.1
8+
spdx_license_id: Apache-2.0
9+
license_url: https://github.com/bufbuild/protobuf-py/blob/v0.1.1/LICENSE
10+
output_languages:
11+
- python
12+
registry:
13+
python:
14+
package_type: "runtime"
15+
requires_python: ">=3.10"
16+
deps:
17+
# https://pypi.org/project/grpcio/
18+
- "grpcio>=1.68"
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
protoc-gen-grpc-py==0.1.1
2+
protobuf-py==0.1.1

plugins/bufbuild/py/source.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
source:
2+
pypi:
3+
name: protoc-gen-py
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: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# syntax=docker/dockerfile:1.24
2+
FROM python:3.13.14-trixie@sha256:6cd5c8d0efe5d264728f3690053b26807572f25805a643395752eca19148e31c 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+
&& ln -sf /usr/bin/python /app/bin/python
11+
12+
FROM gcr.io/distroless/python3-debian13:latest@sha256:178dd00f2da3271f3819df5cd327472754946c7430d82197b247e95e839a3d55 AS base
13+
14+
FROM scratch
15+
COPY --link --from=base / /
16+
COPY --link --from=build --chmod=0755 /app /app
17+
USER nobody
18+
CMD [ "/app/bin/protoc-gen-py" ]
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
version: v1
2+
name: buf.build/bufbuild/py
3+
plugin_version: v0.1.1
4+
source_url: https://github.com/bufbuild/protobuf-py
5+
description: Generates idiomatic Python code from Protocol Buffers definitions using protobuf-py.
6+
spdx_license_id: Apache-2.0
7+
license_url: https://github.com/bufbuild/protobuf-py/blob/v0.1.1/LICENSE
8+
output_languages:
9+
- python
10+
registry:
11+
python:
12+
package_type: "runtime"
13+
requires_python: ">=3.10"
14+
deps:
15+
# https://pypi.org/project/protobuf-py/
16+
- "protobuf-py>=0.1.1"
17+
opts:
18+
# Produce PEP 420 namespace packages so the py, grpc-py, and dependency
19+
# SDKs for a module can share the same top-level package.
20+
- init_files=false
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
protoc-gen-py==0.1.1
2+
protobuf-py==0.1.1

0 commit comments

Comments
 (0)