Skip to content

Commit

Permalink
[hotfix] Fix buf generation errors (#742)
Browse files Browse the repository at this point in the history
  • Loading branch information
njooma authored Sep 24, 2024
1 parent 1604538 commit 3a682dc
Show file tree
Hide file tree
Showing 60 changed files with 3,760 additions and 3,584 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/update_protos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,20 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: bufbuild/buf-setup-action@v1.28.1
- uses: bufbuild/buf-setup-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- uses: arduino/setup-protoc@v1
- uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
version: "28.2"

- name: Install Poetry
uses: snok/install-poetry@v1

- name: Install package
run: poetry install --all-extras
run: |
poetry install --all-extras
- name: Store API version
run: |
Expand Down
3 changes: 0 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
"editor.defaultFormatter": "ms-python.black-formatter",
"editor.formatOnSave": true
},
"python.linting.flake8Enabled": true,
"editor.formatOnSave": true,
"python.analysis.typeCheckingMode": "basic",
"python.linting.ignorePatterns": [
"**/site-packages/**/*.py",
".vscode/*.py",
Expand All @@ -20,7 +18,6 @@
"color": "#777777"
}
],
"python.formatting.provider": "black",
"cSpell.words": [
"frombytes",
"grpclib",
Expand Down
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ _buf: clean
rm -rf src/viam/gen
chmod +x plugin/main.py
$(eval API_VERSION := $(shell grep 'API_VERSION' src/viam/version_metadata.py | awk -F '"' '{print $$2}'))
buf generate buf.build/viamrobotics/api:v${API_VERSION}
buf generate buf.build/viamrobotics/api:${API_VERSION}
buf generate buf.build/viamrobotics/goutils
pip install protoletariat mypy-protobuf
poetry install
protol -e googl* --in-place -s _grpc.py -s _pb2.py -s _pb2.pyi -o src/viam/gen buf buf.build/viamrobotics/api
protol -e googl* --in-place -s _grpc.py -s _pb2.py -s _pb2.pyi -o src/viam/gen buf buf.build/viamrobotics/goutils
find src/viam/gen -type d -exec touch {}/__init__.py \;
Expand Down
1,783 changes: 908 additions & 875 deletions poetry.lock

Large diffs are not rendered by default.

6 changes: 2 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,15 @@ include = ["LICENSE", "src/viam/rpc/libviam_rust_utils.*"]
[tool.poetry.dependencies]
python = ">=3.8.1,<3.13"
grpclib = ">=0.4.7,<1"
googleapis-common-protos = ">=1.60.0,<2"
googleapis-common-protos = ">=1.63.2,<2"
typing-extensions = ">=4.8.0,<5"
protobuf = ">=4.24.3"
protobuf = "5.28.2"
numpy = { version = ">=1.21,<2", optional = true }

[tool.poetry.group.dev.dependencies]
pytest = "^7.4.3"
pytest-asyncio = "^0.23.2"
coverage = "^7.3.2"
protoletariat = "^3.2.19"
jupyter = "^1.0.0"
flake8 = "^6.1.0"
myst-nb = [
Expand All @@ -41,7 +40,6 @@ include = ["LICENSE", "src/viam/rpc/libviam_rust_utils.*"]
black = {extras = ["jupyter"], version = "^23.12.0"}
nbmake = "^1.4.6"
types-pillow = "^10.1.0.2"
mypy-protobuf = "^3.5.0"
tox = "^4.11.4"
isort = "^5.12.0"
pytest-watcher = "^0.3.4"
Expand Down
4 changes: 2 additions & 2 deletions requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
grpclib~=0.4.6
googleapis-common-protos~=1.60.0
googleapis-common-protos~=1.63.2
typing-extensions~=4.8.0
Pillow~=9.1.0
protobuf~=4.24.3
protobuf==5.28.2
numpy~=1.21
2 changes: 1 addition & 1 deletion src/viam/components/component_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def from_robot(cls, robot: "RobotClient", name: str) -> Self:
Self: The component, if it exists on the robot
"""
component = robot.get_component(cls.get_resource_name(name))
return cast(cls, component)
return cast(cls, component) # type: ignore

async def do_command(self, command: Mapping[str, ValueTypes], *, timeout: Optional[float] = None, **kwargs) -> Mapping[str, ValueTypes]:
raise NotImplementedError()
Expand Down
59 changes: 31 additions & 28 deletions src/viam/gen/app/agent/v1/agent_pb2.py
Original file line number Diff line number Diff line change
@@ -1,36 +1,39 @@
"""Generated protocol buffer code."""
from google.protobuf.internal import builder as _builder
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import runtime_version as _runtime_version
from google.protobuf import symbol_database as _symbol_database
from google.protobuf.internal import builder as _builder
_runtime_version.ValidateProtobufRuntimeVersion(_runtime_version.Domain.PUBLIC, 5, 28, 1, '', 'app/agent/v1/agent.proto')
_sym_db = _symbol_database.Default()
from google.protobuf import duration_pb2 as google_dot_protobuf_dot_duration__pb2
from google.protobuf import struct_pb2 as google_dot_protobuf_dot_struct__pb2
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x18app/agent/v1/agent.proto\x12\x11viam.app.agent.v1\x1a\x1egoogle/protobuf/duration.proto\x1a\x1cgoogle/protobuf/struct.proto"\x9d\x02\n\x18DeviceAgentConfigRequest\x12\x0e\n\x02id\x18\x01 \x01(\tR\x02id\x128\n\thost_info\x18\x02 \x01(\x0b2\x1b.viam.app.agent.v1.HostInfoR\x08hostInfo\x12q\n\x12subsystem_versions\x18\x03 \x03(\x0b2B.viam.app.agent.v1.DeviceAgentConfigRequest.SubsystemVersionsEntryR\x11subsystemVersions\x1aD\n\x16SubsystemVersionsEntry\x12\x10\n\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n\x05value\x18\x02 \x01(\tR\x05value:\x028\x01"\xbd\x02\n\x19DeviceAgentConfigResponse\x12o\n\x11subsystem_configs\x18\x01 \x03(\x0b2B.viam.app.agent.v1.DeviceAgentConfigResponse.SubsystemConfigsEntryR\x10subsystemConfigs\x12@\n\x0echeck_interval\x18\x02 \x01(\x0b2\x19.google.protobuf.DurationR\rcheckInterval\x1am\n\x15SubsystemConfigsEntry\x12\x10\n\x03key\x18\x01 \x01(\tR\x03key\x12>\n\x05value\x18\x02 \x01(\x0b2(.viam.app.agent.v1.DeviceSubsystemConfigR\x05value:\x028\x01"\xd8\x01\n\x15DeviceSubsystemConfig\x12G\n\x0bupdate_info\x18\x01 \x01(\x0b2&.viam.app.agent.v1.SubsystemUpdateInfoR\nupdateInfo\x12\x18\n\x07disable\x18\x02 \x01(\x08R\x07disable\x12#\n\rforce_restart\x18\x03 \x01(\x08R\x0cforceRestart\x127\n\nattributes\x18\x04 \x01(\x0b2\x17.google.protobuf.StructR\nattributes"R\n\x08HostInfo\x12\x1a\n\x08platform\x18\x01 \x01(\tR\x08platform\x12\x16\n\x06distro\x18\x02 \x01(\tR\x06distro\x12\x12\n\x04tags\x18\x03 \x03(\tR\x04tags"\xaf\x01\n\x13SubsystemUpdateInfo\x12\x1a\n\x08filename\x18\x01 \x01(\tR\x08filename\x12\x10\n\x03url\x18\x02 \x01(\tR\x03url\x12\x18\n\x07version\x18\x03 \x01(\tR\x07version\x12\x16\n\x06sha256\x18\x04 \x01(\x0cR\x06sha256\x128\n\x06format\x18\x05 \x01(\x0e2 .viam.app.agent.v1.PackageFormatR\x06format*\x9f\x01\n\rPackageFormat\x12\x1e\n\x1aPACKAGE_FORMAT_UNSPECIFIED\x10\x00\x12\x16\n\x12PACKAGE_FORMAT_RAW\x10\x01\x12\x15\n\x11PACKAGE_FORMAT_XZ\x10\x02\x12\x1d\n\x19PACKAGE_FORMAT_EXECUTABLE\x10\x03\x12 \n\x1cPACKAGE_FORMAT_XZ_EXECUTABLE\x10\x042\x84\x01\n\x12AgentDeviceService\x12n\n\x11DeviceAgentConfig\x12+.viam.app.agent.v1.DeviceAgentConfigRequest\x1a,.viam.app.agent.v1.DeviceAgentConfigResponseB\x1eZ\x1cgo.viam.com/api/app/agent/v1b\x06proto3')
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals())
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'app.agent.v1.agent_pb2', globals())
if _descriptor._USE_C_DESCRIPTORS == False:
DESCRIPTOR._options = None
DESCRIPTOR._serialized_options = b'Z\x1cgo.viam.com/api/app/agent/v1'
_DEVICEAGENTCONFIGREQUEST_SUBSYSTEMVERSIONSENTRY._options = None
_DEVICEAGENTCONFIGREQUEST_SUBSYSTEMVERSIONSENTRY._serialized_options = b'8\x01'
_DEVICEAGENTCONFIGRESPONSE_SUBSYSTEMCONFIGSENTRY._options = None
_DEVICEAGENTCONFIGRESPONSE_SUBSYSTEMCONFIGSENTRY._serialized_options = b'8\x01'
_PACKAGEFORMAT._serialized_start = 1199
_PACKAGEFORMAT._serialized_end = 1358
_DEVICEAGENTCONFIGREQUEST._serialized_start = 110
_DEVICEAGENTCONFIGREQUEST._serialized_end = 395
_DEVICEAGENTCONFIGREQUEST_SUBSYSTEMVERSIONSENTRY._serialized_start = 327
_DEVICEAGENTCONFIGREQUEST_SUBSYSTEMVERSIONSENTRY._serialized_end = 395
_DEVICEAGENTCONFIGRESPONSE._serialized_start = 398
_DEVICEAGENTCONFIGRESPONSE._serialized_end = 715
_DEVICEAGENTCONFIGRESPONSE_SUBSYSTEMCONFIGSENTRY._serialized_start = 606
_DEVICEAGENTCONFIGRESPONSE_SUBSYSTEMCONFIGSENTRY._serialized_end = 715
_DEVICESUBSYSTEMCONFIG._serialized_start = 718
_DEVICESUBSYSTEMCONFIG._serialized_end = 934
_HOSTINFO._serialized_start = 936
_HOSTINFO._serialized_end = 1018
_SUBSYSTEMUPDATEINFO._serialized_start = 1021
_SUBSYSTEMUPDATEINFO._serialized_end = 1196
_AGENTDEVICESERVICE._serialized_start = 1361
_AGENTDEVICESERVICE._serialized_end = 1493
_globals = globals()
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'app.agent.v1.agent_pb2', _globals)
if not _descriptor._USE_C_DESCRIPTORS:
_globals['DESCRIPTOR']._loaded_options = None
_globals['DESCRIPTOR']._serialized_options = b'Z\x1cgo.viam.com/api/app/agent/v1'
_globals['_DEVICEAGENTCONFIGREQUEST_SUBSYSTEMVERSIONSENTRY']._loaded_options = None
_globals['_DEVICEAGENTCONFIGREQUEST_SUBSYSTEMVERSIONSENTRY']._serialized_options = b'8\x01'
_globals['_DEVICEAGENTCONFIGRESPONSE_SUBSYSTEMCONFIGSENTRY']._loaded_options = None
_globals['_DEVICEAGENTCONFIGRESPONSE_SUBSYSTEMCONFIGSENTRY']._serialized_options = b'8\x01'
_globals['_PACKAGEFORMAT']._serialized_start = 1199
_globals['_PACKAGEFORMAT']._serialized_end = 1358
_globals['_DEVICEAGENTCONFIGREQUEST']._serialized_start = 110
_globals['_DEVICEAGENTCONFIGREQUEST']._serialized_end = 395
_globals['_DEVICEAGENTCONFIGREQUEST_SUBSYSTEMVERSIONSENTRY']._serialized_start = 327
_globals['_DEVICEAGENTCONFIGREQUEST_SUBSYSTEMVERSIONSENTRY']._serialized_end = 395
_globals['_DEVICEAGENTCONFIGRESPONSE']._serialized_start = 398
_globals['_DEVICEAGENTCONFIGRESPONSE']._serialized_end = 715
_globals['_DEVICEAGENTCONFIGRESPONSE_SUBSYSTEMCONFIGSENTRY']._serialized_start = 606
_globals['_DEVICEAGENTCONFIGRESPONSE_SUBSYSTEMCONFIGSENTRY']._serialized_end = 715
_globals['_DEVICESUBSYSTEMCONFIG']._serialized_start = 718
_globals['_DEVICESUBSYSTEMCONFIG']._serialized_end = 934
_globals['_HOSTINFO']._serialized_start = 936
_globals['_HOSTINFO']._serialized_end = 1018
_globals['_SUBSYSTEMUPDATEINFO']._serialized_start = 1021
_globals['_SUBSYSTEMUPDATEINFO']._serialized_end = 1196
_globals['_AGENTDEVICESERVICE']._serialized_start = 1361
_globals['_AGENTDEVICESERVICE']._serialized_end = 1493
Loading

0 comments on commit 3a682dc

Please sign in to comment.