Skip to content

Use remote plugin to generate typing stubs #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ __pycache__
.pytest_cache
.vscode
.coverage
.python-version
4 changes: 2 additions & 2 deletions buf/buf.gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins:
out: ./src
- plugin: buf.build/protocolbuffers/python
out: ./src
- name: "mypy"
- plugin: buf.build/protocolbuffers/pyi
out: "./src"
- name: "mypy_grpc"
- plugin: "buf.build/community/nipunn1313-mypy-grpc"
out: "./src"
2 changes: 1 addition & 1 deletion init_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def __init__(self):
self._in_const: bool = False

def visit_ClassDef(self, node: ast.ClassDef):
if self.is_public(node.name):
if self.is_public(node.name) and not node.name.endswith("AsyncStub"):
self.symbols.append(node.name)

def is_public(self, name: str) -> bool:
Expand Down
1 change: 1 addition & 0 deletions magefiles/magefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ func gen(bufImage, fileSources string) error {
for bufImage, clientFiles := range files {
err = buf.Run(
buf.AddArg("generate"),
buf.AddArg("--include-imports"),
buf.AddArg("--template"),
buf.AddArg(filepath.Join("buf", "buf.gen.yaml")),
buf.AddArg(bufImage),
Expand Down
222 changes: 187 additions & 35 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 9 additions & 28 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,40 +25,21 @@ classifiers = [
]
packages = [
{ include = "aserto", from = "src" },
{ include = "google", from = "src" },
{ include = "buf", from = "src" },
]


[tool.poetry.dependencies]
python = ">=3.8"
python = ">=3.8,<4"
grpcio = "^1.49"
protobuf = "^4.21.0"
protovalidate = { version = "^0.3.0", python = ">=3.11"}

[tool.poetry.dev-dependencies]
mypy = "^1.6.1"
mypy-protobuf = "^3.5.0"
black = "^23.10.1"
isort = "^5.10.1"

[tool.mypy]
show_error_codes = true
check_untyped_defs = false
disallow_any_decorated = false
disallow_any_explicit = false
disallow_any_expr = false
disallow_any_generics = false
disallow_any_unimported = true
disallow_incomplete_defs = true
disallow_subclassing_any = true
disallow_untyped_calls = true
disallow_untyped_decorators = true
disallow_untyped_defs = true
implicit_reexport = true
no_implicit_optional = true
strict_equality = true
strict_optional = false
warn_no_return = true
warn_redundant_casts = true
warn_return_any = true
warn_unreachable = true
warn_unused_ignores = true
black = "^23.11.0"
isort = "^5.10.0"
pyright = "^1.1.0"

[build-system]
requires = ["poetry-core>=1.0.0"]
Expand Down
2 changes: 1 addition & 1 deletion src/aserto/directory/common/v2/common_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading