Skip to content

Automated Protos Update: Python wrappers - #1261

Open
github-actions[bot] wants to merge 5 commits into
workflow/update-protofrom
workflow/update-proto-ai
Open

Automated Protos Update: Python wrappers#1261
github-actions[bot] wants to merge 5 commits into
workflow/update-protofrom
workflow/update-proto-ai

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

This is an auto-generated PR updating the Python wrappers for the proto changes in #1260.

This PR is stacked on top of workflow/update-proto. Review and merge #1260 first; this PR will retarget to main automatically.

@github-actions
github-actions Bot requested a review from a team as a code owner September 10, 2026 19:56
@github-actions
github-actions Bot requested review from Gabriel Gottlob (gabegottlob) and Ethan (stuqdog) and removed request for a team September 10, 2026 19:56
@njooma
Naveed Jooma (njooma) added this pull request to stack #1262 September 10, 2026 19:57
@viambot
viambot force-pushed the workflow/update-proto-ai branch from 8ccae9f to 3edbb01 Compare September 10, 2026 20:34
@viambot
viambot force-pushed the workflow/update-proto-ai branch from 3edbb01 to c24b60e Compare September 10, 2026 21:47
@njooma

Copy link
Copy Markdown
Member

Claude (@claude) instead of creating a new dataclass for arm properties, please just typealias the arm proto's GetPropertiesResponse

@claude

claude Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Claude finished Naveed Jooma (@njooma)'s task in 2m 53s —— View job


Implementing type alias for arm properties

  • Read CLAUDE.md and understand conventions
  • Examine changed files to find the dataclass
  • Replace dataclass with type alias in arm.py
  • Simplify client.py to return response directly
  • Simplify service.py to pass properties directly
  • Update mock in tests/mocks/components.py
  • Update examples/server/v1/components.py
  • Run format and lint
  • Commit and push

Done. Here's what changed:

  • arm.py: Removed the @dataclass class Properties and replaced it with Properties = GetPropertiesResponse (imported from viam.proto.component.arm).
  • client.py: get_properties now returns the gRPC response object directly — no conversion needed. Removed the now-unused GetPropertiesResponse import.
  • service.py: GetProperties passes the result of arm.get_properties() directly to send_message — no GetPropertiesResponse(**properties.__dict__) splat needed.
  • tests/mocks/components.py: Mock initialises self.properties with GetPropertiesResponse(...) instead of Arm.Properties(...).
  • examples/server/v1/components.py: Same change as the mock.

All tests assertions remain valid since Arm.Properties is now just GetPropertiesResponse.
|

@njooma

Copy link
Copy Markdown
Member

Claude (@claude) type it properly with the typealias type-hint

@claude

claude Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Claude finished Naveed Jooma (@njooma)'s task in 1m 18s —— View job


Adding TypeAlias annotation to Properties

  • Read CLAUDE.md
  • Read arm.py to see current state
  • Add TypeAlias annotation to Properties
  • Run format and lint
  • Commit and push

Done. Changed arm.py line 2 and 35 to match the pattern used throughout the codebase (e.g. audio_in.py, camera.py, board.py):

# Before
from typing import Any, Dict, Final, List, Mapping, Optional
...
    Properties = GetPropertiesResponse

# After
from typing import Any, Dict, Final, List, Mapping, Optional, TypeAlias
...
    Properties: "TypeAlias" = GetPropertiesResponse

@njooma

Copy link
Copy Markdown
Member

Claude (@claude) fix the test errors -- seems like you missed adding the new abstract methods to the FakeArmClient

@claude

claude Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Claude finished Naveed Jooma (@njooma)'s task in 1m 38s —— View job


Fixing test errors in FakeArmClient

  • Read CLAUDE.md
  • Find the FakeArmClient and identify missing abstract methods — set_manual_mode, get_manual_mode, get_properties
  • Add missing abstract methods to FakeArmClient in tests/test_robot.py
  • Run format and lint — all checks passed
  • Commit and push

Added three methods to FakeArmClient (each delegating to self.actual_client):

  • set_manual_mode(manual_mode, enabled_for, *, extra, timeout)
  • get_manual_mode(*, extra, timeout) -> bool
  • get_properties(*, extra, timeout) -> Arm.Properties

@njooma

Copy link
Copy Markdown
Member

Claude (@claude) also update docs/examples/example.ipynb, docs/examples/my_cool_arm.py and examples/complex_module/src/arm/my_arm.py

@claude

claude Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Claude finished Naveed Jooma (@njooma)'s task in 3m 51s —— View job


Updating additional example files

  • Read CLAUDE.md and understand conventions
  • Read docs/examples/example.ipynb
  • Read docs/examples/my_cool_arm.py
  • Read examples/complex_module/src/arm/my_arm.py
  • Add set_manual_mode, get_manual_mode, get_properties to my_cool_arm.py
  • Add set_manual_mode, get_manual_mode, get_properties to examples/complex_module/src/arm/my_arm.py
  • Update example.ipynb notebook code example to include the three new methods
  • Run format and lint — all checks passed
  • Commit and push

Done. All three files now implement the three new abstract methods:

  • docs/examples/my_cool_arm.py: Added set_manual_mode (pass), get_manual_mode (returns False), get_properties (returns Arm.Properties()) before close().
  • examples/complex_module/src/arm/my_arm.py: Same additions before close().
  • docs/examples/example.ipynb (cell-15): Updated the MyModularArm code example in the markdown cell to include the three new methods after get_kinematics.

github-actions Bot and others added 5 commits September 10, 2026 18:28
Replace the custom `Arm.Properties` dataclass with a type alias
pointing to the proto's `GetPropertiesResponse`. This eliminates the
manual conversion in client.py and the `**__dict__` splat in service.py.

Co-authored-by: Naveed Jooma <njooma@users.noreply.github.com>
Co-authored-by: Naveed Jooma <njooma@users.noreply.github.com>
set_manual_mode, get_manual_mode, and get_properties were added as new
abstract methods to Arm but not implemented in the FakeArmClient used
by test_robot.py, causing instantiation errors.

Co-authored-by: Naveed Jooma <njooma@users.noreply.github.com>
…mplementations

Co-authored-by: Naveed Jooma <njooma@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant