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): start wiring up "Export Python" button to generate Python #17453

Merged
merged 2 commits into from
Feb 7, 2025

Conversation

ddcc4
Copy link
Contributor

@ddcc4 ddcc4 commented Feb 6, 2025

Overview

Make the "Export Python" button start generating the skeleton of a Python protocol file. This just generates the metadata section right now. AUTH-1091 AUTH-1393 AUTH-1385

I tried to follow the structure of the existing createFile() function. Eventually, the createPythonFile() function is just going to replace createFile(), so that's why I'm reusing the existing SAVE_PROTOCOL_FILE action rather than defining a bunch of new Python-specific constants and interfaces.

Test Plan and Hands on Testing

Added unit tests for both the top-level file creator, and for the specific metadata fields.

I also tested the button in my browser.

Risk assessment

Low. This is all hidden behind a feature flag, and doesn't interact with any existing functionality.

@ddcc4 ddcc4 requested a review from jerader February 6, 2025 19:36
@ddcc4 ddcc4 requested a review from a team as a code owner February 6, 2025 19:36
Copy link

codecov bot commented Feb 6, 2025

Codecov Report

Attention: Patch coverage is 65.00000% with 21 lines in your changes missing coverage. Please review.

Project coverage is 20.05%. Comparing base (73b70f4) to head (ccab8df).
Report is 7 commits behind head on edge.

Files with missing lines Patch % Lines
protocol-designer/src/load-file/actions.ts 5.88% 16 Missing ⚠️
protocol-designer/src/load-file/utils.ts 25.00% 3 Missing ⚠️
...ocol-designer/src/pages/ProtocolOverview/index.tsx 0.00% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             edge   #17453      +/-   ##
==========================================
- Coverage   20.07%   20.05%   -0.02%     
==========================================
  Files        3187     3194       +7     
  Lines      229811   230200     +389     
  Branches     8190     8204      +14     
==========================================
+ Hits        46132    46171      +39     
- Misses     183679   184029     +350     
Flag Coverage Δ
protocol-designer 17.37% <65.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...ol-designer/src/file-data/selectors/fileCreator.ts 88.78% <100.00%> (+0.69%) ⬆️
...col-designer/src/file-data/selectors/pythonFile.ts 100.00% <100.00%> (ø)
...ocol-designer/src/pages/ProtocolOverview/index.tsx 80.69% <0.00%> (ø)
protocol-designer/src/load-file/utils.ts 27.27% <25.00%> (-1.30%) ⬇️
protocol-designer/src/load-file/actions.ts 24.71% <5.88%> (-4.45%) ⬇️

... and 18 files with indirect coverage changes

@@ -47,6 +47,7 @@ import type {
import type { LabwareDefByDefURI } from '../../labware-defs'
import type { Selector } from '../../types'
import type { PDMetadata } from '../../file-types'
import { pythonImports, pythonMetadata } from './pythonFile'
Copy link
Collaborator

Choose a reason for hiding this comment

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

can this import go above the types? 😄

not sure if you were told our preferred import order but we like to do it like:

  • dependencies
  • top level imports from other projects like @opentrons/components
  • local paths furtherest away to closest so like ../.../ should go above ../
  • types (types follow the same pattern as a non type)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, I wasn't aware of that preferred order, thanks!

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.

looks great, just left a small nit. Thanks for leaving the comments, they make it easy to follow along whats going on. Tested it out and got the python metadata output 🚀

@ddcc4 ddcc4 merged commit f8a5436 into edge Feb 7, 2025
16 checks passed
@ddcc4 ddcc4 deleted the dc-pd-pygenskel branch February 7, 2025 20:23
caila-marashaj pushed a commit that referenced this pull request Feb 11, 2025
…nerate Python (#17453)

# Overview

Make the "Export Python" button start generating the skeleton of a
Python protocol file. This just generates the `metadata` section right
now. AUTH-1091 AUTH-1393 AUTH-1385

I tried to follow the structure of the existing `createFile()` function.
Eventually, the `createPythonFile()` function is just going to replace
`createFile()`, so that's why I'm reusing the existing
`SAVE_PROTOCOL_FILE` action rather than defining a bunch of new
Python-specific constants and interfaces.

## Test Plan and Hands on Testing

Added unit tests for both the top-level file creator, and for the
specific metadata fields.

I also tested the button in my browser.

## Risk assessment

Low. This is all hidden behind a feature flag, and doesn't interact with
any existing functionality.
TamarZanzouri pushed a commit that referenced this pull request Feb 11, 2025
…nerate Python (#17453)

# Overview

Make the "Export Python" button start generating the skeleton of a
Python protocol file. This just generates the `metadata` section right
now. AUTH-1091 AUTH-1393 AUTH-1385

I tried to follow the structure of the existing `createFile()` function.
Eventually, the `createPythonFile()` function is just going to replace
`createFile()`, so that's why I'm reusing the existing
`SAVE_PROTOCOL_FILE` action rather than defining a bunch of new
Python-specific constants and interfaces.

## Test Plan and Hands on Testing

Added unit tests for both the top-level file creator, and for the
specific metadata fields.

I also tested the button in my browser.

## Risk assessment

Low. This is all hidden behind a feature flag, and doesn't interact with
any existing functionality.
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