Skip to content

Commit cfb5ba7

Browse files
author
Ronen Hilewicz
committed
Use remote plugin to generate typing stubs
1 parent 42c6d6d commit cfb5ba7

File tree

5 files changed

+23
-66
lines changed

5 files changed

+23
-66
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,6 @@ jobs:
5959
with:
6060
python-version: '3.10'
6161

62-
- name: Install Poetry
63-
uses: snok/install-poetry@v1
64-
6562
- name: Install dependencies
6663
run: |
6764
mkdir -p $HOME/.ssh
@@ -77,16 +74,14 @@ jobs:
7774
7875
go run mage.go deps
7976
80-
poetry install --no-interaction
81-
8277
- name: Clean generated code
8378
run: go run mage.go clean
8479

8580
- name: Setup Buf Registry
8681
run: echo -e "machine buf.build\npassword ${ASERTO_BUF_TOKEN}" >> ~/.netrc
8782

8883
- name: Generate
89-
run: poetry run go run mage.go generate
84+
run: go run mage.go generate
9085

9186
- name: Commit changes
9287
if: github.event_name == 'workflow_dispatch'
@@ -161,7 +156,6 @@ jobs:
161156
- name: Install Poetry
162157
uses: snok/install-poetry@v1
163158

164-
165159
- name: Build and push the python package
166160
run: go run mage.go release
167161

buf/buf.gen.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ plugins:
66
out: ./src
77
- plugin: buf.build/protocolbuffers/python
88
out: ./src
9-
- name: "mypy"
9+
- plugin: buf.build/protocolbuffers/pyi
1010
out: "./src"
11-
- name: "mypy_grpc"
11+
- plugin: "buf.build/community/nipunn1313-mypy-grpc"
1212
out: "./src"

init_gen.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def __init__(self):
9090
self._in_const: bool = False
9191

9292
def visit_ClassDef(self, node: ast.ClassDef):
93-
if self.is_public(node.name):
93+
if self.is_public(node.name) and not node.name.endswith("AsyncStub"):
9494
self.symbols.append(node.name)
9595

9696
def is_public(self, name: str) -> bool:

poetry.lock

Lines changed: 16 additions & 54 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,15 @@ packages = [
3030

3131
[tool.poetry.dependencies]
3232
python = ">=3.8"
33+
grpcio = ">=1.58.0"
34+
typing-extensions = ">=3.10.0"
3335

3436
[tool.poetry.dev-dependencies]
35-
mypy = "^1.6.1"
36-
mypy-protobuf = "^3.5.0"
3737
black = "^23.10.1"
3838
isort = "^5.10.1"
3939

4040
[tool.mypy]
41+
explicit_package_bases = true
4142
show_error_codes = true
4243
check_untyped_defs = false
4344
disallow_any_decorated = false

0 commit comments

Comments
 (0)