Skip to content

Commit

Permalink
Migrate to buf plugins (#26)
Browse files Browse the repository at this point in the history
Per the
[docs](https://buf.build/docs/migration-guides/migrate-remote-generation-alpha#migrate-to-remote-plugins),
migrating from remote plugin execution to the new remote plugins.

#### Changes
* `buf.gen.yaml` - Update from `remote` to `plugin`. The plugin names
and versions were located using https://buf.build/plugins, which lists
the publicly available plugins.
* `README.md` - Include maven as a dependency
  • Loading branch information
Krithika Sundararajan authored Oct 30, 2023
1 parent 9d25e93 commit 648cb36
Show file tree
Hide file tree
Showing 43 changed files with 836 additions and 785 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ Universal Prediction Interface (UPI) aims to standardize prediction interface wi
## Getting Started

To get started, install following software:

- Java
- [maven](https://maven.apache.org/install.html) ([brew](https://formulae.brew.sh/formula/maven))
- [buf](https://docs.buf.build/installation)
- [Go 1.18 or above](https://go.dev/doc/install)
- Go dependencies and protoc plugins
Expand Down
10 changes: 5 additions & 5 deletions buf.gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,21 @@ plugins:
out: gen/go/grpc
opt: paths=import,module=github.com/caraml-dev/universal-prediction-interface/gen/go
# Python code gen
- remote: buf.build/protocolbuffers/plugins/python:v3.19.1-1
- plugin: buf.build/protocolbuffers/python:v24.4
out: gen/python/grpc
- remote: buf.build/grpc/plugins/python:v1.46.2-1
- plugin: buf.build/grpc/python:v1.58.1
out: gen/python/grpc
- remote: buf.build/jeffsawatzky/plugins/mypy-protobuf:v3.2.0-1
- plugin: buf.build/community/nipunn1313-mypy:v3.5.0
out: gen/python/grpc
- remote: buf.build/jeffsawatzky/plugins/mypy-grpc-protobuf:v3.2.0-1
- plugin: buf.build/community/nipunn1313-mypy-grpc:v3.5.0
out: gen/python/grpc
# Ruby code gen
- plugin: buf.build/grpc/ruby
out: gen/ruby/grpc
- plugin: buf.build/protocolbuffers/ruby
out: gen/ruby/grpc
# Documentations
- remote: buf.build/grpc-ecosystem/plugins/openapiv2:v2.6.0-1
- plugin: buf.build/grpc-ecosystem/openapiv2:v2.18.0
out: docs/openapiv2
- name: doc
out: docs/api_html
Expand Down
1 change: 1 addition & 0 deletions docs/openapiv2/caraml/upi/v1/header.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"details": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/protobufAny"
}
}
Expand Down
4 changes: 4 additions & 0 deletions docs/openapiv2/caraml/upi/v1/observation_log.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
"details": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/protobufAny"
}
}
Expand All @@ -95,6 +96,7 @@
"observations": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/v1ObservationLog"
},
"title": "List of observations per request"
Expand Down Expand Up @@ -128,13 +130,15 @@
"observationValues": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/v1Variable"
},
"description": "The ground-truth value. It can be a double, string or integer type."
},
"observationContext": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/v1Variable"
},
"description": "A set of key-value pairs to provide additional context for the observation."
Expand Down
1 change: 1 addition & 0 deletions docs/openapiv2/caraml/upi/v1/prediction_log.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"details": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/protobufAny"
}
}
Expand Down
1 change: 1 addition & 0 deletions docs/openapiv2/caraml/upi/v1/router_log.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"details": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/protobufAny"
}
}
Expand Down
1 change: 1 addition & 0 deletions docs/openapiv2/caraml/upi/v1/table.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"details": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/protobufAny"
}
}
Expand Down
1 change: 1 addition & 0 deletions docs/openapiv2/caraml/upi/v1/type.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"details": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/protobufAny"
}
}
Expand Down
9 changes: 9 additions & 0 deletions docs/openapiv2/caraml/upi/v1/upi.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
"details": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/protobufAny"
}
}
Expand Down Expand Up @@ -156,6 +157,7 @@
"predictionContext": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/v1Variable"
},
"title": "Prediction context may contain additional data applicable to all prediction instances\nFor example it can be used to store information for traffic rules, experimentation\nor tracking purposes.\nEg. country_code, service_type, service_area_id"
Expand All @@ -181,6 +183,7 @@
"predictionContext": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/v1Variable"
},
"title": "Extensible field to cover unforeseen requirements"
Expand Down Expand Up @@ -215,6 +218,7 @@
"models": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/v1ModelMetadata"
},
"title": "List of model that produces the prediction \nThis field is repeated to cater for use case such as ensembling several model production results"
Expand All @@ -239,6 +243,7 @@
"values": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/upiv1Value"
},
"description": "List of values within a row. \nIt is table's creator responsibility to ensure that the number of entry \nvalues matches with the length of columns in the table."
Expand All @@ -256,13 +261,15 @@
"columns": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/v1Column"
},
"description": "Columns stores schema informations of all columns in the table."
},
"rows": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/v1Row"
},
"description": "Rows stores list of row values in the table."
Expand All @@ -276,13 +283,15 @@
"tables": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/v1Table"
},
"description": "List of tables\nAll tables must have unique name.\nEach table doesn't need to have same number of row."
},
"variables": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/v1Variable"
},
"title": "List of variables"
Expand Down
1 change: 1 addition & 0 deletions docs/openapiv2/caraml/upi/v1/variable.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"details": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/protobufAny"
}
}
Expand Down
25 changes: 8 additions & 17 deletions gen/python/grpc/caraml/upi/v1/header_pb2.py

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

26 changes: 17 additions & 9 deletions gen/python/grpc/caraml/upi/v1/header_pb2.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,29 @@ isort:skip_file
import builtins
import google.protobuf.descriptor
import google.protobuf.message
import typing
import typing_extensions
import sys

if sys.version_info >= (3, 8):
import typing as typing_extensions
else:
import typing_extensions

DESCRIPTOR: google.protobuf.descriptor.FileDescriptor

@typing_extensions.final
class Header(google.protobuf.message.Message):
DESCRIPTOR: google.protobuf.descriptor.Descriptor

KEY_FIELD_NUMBER: builtins.int
VALUE_FIELD_NUMBER: builtins.int
key: typing.Text
value: typing.Text
def __init__(self,
key: builtins.str
value: builtins.str
def __init__(
self,
*,
key: typing.Text = ...,
value: typing.Text = ...,
) -> None: ...
def ClearField(self, field_name: typing_extensions.Literal["key",b"key","value",b"value"]) -> None: ...
key: builtins.str = ...,
value: builtins.str = ...,
) -> None: ...
def ClearField(self, field_name: typing_extensions.Literal["key", b"key", "value", b"value"]) -> None: ...

global___Header = Header
13 changes: 13 additions & 0 deletions gen/python/grpc/caraml/upi/v1/header_pb2_grpc.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,16 @@
@generated by mypy-protobuf. Do not edit manually!
isort:skip_file
"""
import abc
import collections.abc
import grpc
import grpc.aio
import typing

_T = typing.TypeVar('_T')

class _MaybeAsyncIterator(collections.abc.AsyncIterator[_T], collections.abc.Iterator[_T], metaclass=abc.ABCMeta):
...

class _ServicerContext(grpc.ServicerContext, grpc.aio.ServicerContext): # type: ignore
...
72 changes: 19 additions & 53 deletions gen/python/grpc/caraml/upi/v1/observation_log_pb2.py

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

Loading

0 comments on commit 648cb36

Please sign in to comment.