Skip to content

Commit bfe6457

Browse files
authored
Generate gRPC client locally (#84)
One of the last repos required for this. Following this we can archive the APIs repository and remove generation github actions.
2 parents 96608e9 + 66e6e22 commit bfe6457

59 files changed

Lines changed: 3606 additions & 465 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/test.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ jobs:
2424
python-version: ${{ matrix.python-version }}
2525
- name: Install
2626
run: make install
27+
- name: Check generated sources
28+
run: |
29+
make grpc-client
30+
git add .
31+
git diff --cached --quiet
2732
- name: Run Tox
2833
# Run tox using the version of Python in `PATH`
2934
run: tox -e py

.gitignore

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# Protoc Output Files
2-
nitric/proto/
3-
41
.idea/
52

63
# Byte-compiled / optimized / DLL files
@@ -145,3 +142,5 @@ cython_debug/
145142

146143

147144
.vscode/
145+
146+
contracts/

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ repos:
33
rev: stable
44
hooks:
55
- id: black
6-
exclude: ^(examples)/
6+
exclude: ^(examples|nitric/proto)/
77
- repo: https://github.com/pycqa/flake8
88
rev: 3.7.9
99
hooks:

docs/nitric/api/documents.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ <h1 class="title">Module <code>nitric.api.documents</code></h1>
5454

5555
from nitric.api.const import MAX_SUB_COLLECTION_DEPTH
5656
from nitric.api.exception import exception_from_grpc_error
57-
from nitricapi.nitric.document.v1 import (
57+
from proto.nitric.document.v1 import (
5858
DocumentServiceStub,
5959
Collection as CollectionMessage,
6060
Key as KeyMessage,

docs/nitric/api/events.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ <h1 class="title">Module <code>nitric.api.events</code></h1>
5252

5353
from nitric.api.exception import exception_from_grpc_error
5454
from nitric.utils import new_default_channel, _struct_from_dict
55-
from nitricapi.nitric.event.v1 import EventServiceStub, NitricEvent, TopicServiceStub
55+
from proto.nitric.event.v1 import EventServiceStub, NitricEvent, TopicServiceStub
5656
from dataclasses import dataclass, field
5757

5858

docs/nitric/api/queues.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ <h1 class="title">Module <code>nitric.api.queues</code></h1>
5252

5353
from nitric.api.exception import FailedPreconditionException, exception_from_grpc_error, InvalidArgumentException
5454
from nitric.utils import new_default_channel, _struct_from_dict, _dict_from_struct
55-
from nitricapi.nitric.queue.v1 import QueueServiceStub, NitricTask, FailedTask as WireFailedTask
55+
from proto.nitric.queue.v1 import QueueServiceStub, NitricTask, FailedTask as WireFailedTask
5656
from dataclasses import dataclass, field
5757

5858

docs/nitric/api/secrets.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ <h1 class="title">Module <code>nitric.api.secrets</code></h1>
5252

5353
from nitric.api.exception import exception_from_grpc_error
5454
from nitric.utils import new_default_channel
55-
from nitricapi.nitric.secret.v1 import SecretServiceStub, Secret as SecretMessage, SecretVersion as VersionMessage
55+
from proto.nitric.secret.v1 import SecretServiceStub, Secret as SecretMessage, SecretVersion as VersionMessage
5656

5757

5858
class Secrets(object):

docs/nitric/api/storage.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ <h1 class="title">Module <code>nitric.api.storage</code></h1>
5050

5151
from nitric.api.exception import exception_from_grpc_error
5252
from nitric.utils import new_default_channel
53-
from nitricapi.nitric.storage.v1 import StorageServiceStub
53+
from proto.nitric.storage.v1 import StorageServiceStub
5454

5555

5656
class Storage(object):

docs/nitric/faas.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ <h1 class="title">Module <code>nitric.faas</code></h1>
3636
import betterproto
3737
from betterproto.grpc.util.async_channel import AsyncChannel
3838
from nitric.utils import new_default_channel
39-
from nitricapi.nitric.faas.v1 import (
39+
from proto.nitric.faas.v1 import (
4040
FaasServiceStub,
4141
InitRequest,
4242
ClientMessage,

makefile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,23 @@ clean:
1616
@rm -rf ./build
1717
@rm -rf ./dist
1818

19+
NITRIC_VERSION="v0.20.0-rc.2"
20+
21+
download:
22+
@curl -L https://github.com/nitrictech/nitric/releases/download/${NITRIC_VERSION}/contracts.tgz -o contracts.tgz
23+
@tar xvzf contracts.tgz
24+
@rm contracts.tgz
25+
26+
OUTPUT="./nitric/proto"
27+
CONTRACTS="./contracts"
28+
29+
grpc-client: install download
30+
@echo Generating Proto Sources
31+
@echo $(OUTPUT)
32+
@mkdir -p $(OUTPUT)
33+
@python3 -m grpc_tools.protoc -I $(CONTRACTS) --python_betterproto_out=$(OUTPUT) ./contracts/proto/*/*/*.proto
34+
35+
1936
license:
2037
@echo Applying Apache 2 header to source files
2138
@licenseheaders -t tools/apache-2.tmpl -o "Nitric Technologies Pty Ltd" -y 2021 -n "Nitric Python 3 SDK" -u "https://github.com/nitrictech/python-sdk" -d nitric

0 commit comments

Comments
 (0)