Skip to content

Commit ede71cc

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

File tree

4 files changed

+22
-59
lines changed

4 files changed

+22
-59
lines changed

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)