Skip to content
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

feat(protocol-designer): add python field to commands and timeline #17383

Merged
merged 1 commit into from
Jan 30, 2025

Conversation

ddcc4
Copy link
Contributor

@ddcc4 ddcc4 commented Jan 29, 2025

Overview

This starts the plumbing for Python generation from Protocol Designer. AUTH-1385

We're adding a field for Python code to each command (CommandsAndWarnings) and to each entry of the timeline (CommandsAndRobotState). And in the reducer, we concatenate the Python commands together, analogously to how we concatenate the JSON commands together.

Test Plan and Hands on Testing

I added unit tests to show that the Python code concatenation works, and that the Python code gets copied from the CommandCreators to the Timeline. The tests also demonstrate that the changes do NOT affect the behavior of existing commands that don't generate Python.

I've also done hands-on testing in a private experimental branch that has a more complete implementation of Python generation.

Review requests

My first time making a functional change to PD, let me know if I'm overlooking anything.

Risk assessment

Low. Should not cause any observable change to PD's behavior.

@ddcc4 ddcc4 requested a review from jerader January 29, 2025 23:25
@ddcc4 ddcc4 requested a review from a team as a code owner January 29, 2025 23:25
@@ -93,6 +93,30 @@ const divideCreator: any = (
}
}

const pythonHelloWorldCreator: any = (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we typing this and the fn on line 108 as any?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh i see, this is a mock for the tests, right? should be fine to type as any actually.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I was following the pattern in the mocks above. (In my private experimental branch, I have it typed as CommandCreator<{}> -- I'm not sure if that's the right way to write it.)

Copy link
Collaborator

@jerader jerader left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@ddcc4 ddcc4 merged commit a79e873 into edge Jan 30, 2025
22 checks passed
@ddcc4 ddcc4 deleted the dc-pd-pyfields branch January 30, 2025 21:57
caila-marashaj pushed a commit that referenced this pull request Feb 11, 2025
…17383)

# Overview

This starts the plumbing for Python generation from Protocol Designer.
AUTH-1385

We're adding a field for Python code to each command
(`CommandsAndWarnings`) and to each entry of the timeline
(`CommandsAndRobotState`). And in the reducer, we concatenate the Python
commands together, analogously to how we concatenate the JSON commands
together.

## Test Plan and Hands on Testing

I added unit tests to show that the Python code concatenation works, and
that the Python code gets copied from the CommandCreators to the
Timeline. The tests also demonstrate that the changes do NOT affect the
behavior of existing commands that don't generate Python.

I've also done hands-on testing in a private experimental branch that
has a more complete implementation of Python generation.

## Review requests

My first time making a functional change to PD, let me know if I'm
overlooking anything.

## Risk assessment

Low. Should not cause any observable change to PD's behavior.
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.

2 participants