Skip to content

Commit

Permalink
Demo of Python export from PD.
Browse files Browse the repository at this point in the history
  • Loading branch information
ddcc4 committed Dec 20, 2024
1 parent d36b284 commit d86c562
Show file tree
Hide file tree
Showing 4 changed files with 400 additions and 0 deletions.
17 changes: 17 additions & 0 deletions protocol-designer/src/file-data/__tests__/pythonProtocol.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { describe, it, expect, vi, beforeEach } from 'vitest'

Check failure on line 1 in protocol-designer/src/file-data/__tests__/pythonProtocol.test.tsx

View workflow job for this annotation

GitHub Actions / js checks

'expect' is defined but never used

Check failure on line 1 in protocol-designer/src/file-data/__tests__/pythonProtocol.test.tsx

View workflow job for this annotation

GitHub Actions / js checks

'vi' is defined but never used

Check failure on line 1 in protocol-designer/src/file-data/__tests__/pythonProtocol.test.tsx

View workflow job for this annotation

GitHub Actions / js checks

'beforeEach' is defined but never used
import genPythonProtocol from '../selectors/pythonProtocol'
import { FLEX_ROBOT_TYPE } from '@opentrons/shared-data';

describe('Python', () => {

it('should render Python protocol', () => {
console.log(genPythonProtocol({

Check failure on line 8 in protocol-designer/src/file-data/__tests__/pythonProtocol.test.tsx

View workflow job for this annotation

GitHub Actions / js checks

Expected 9 arguments, but got 1.
fileMetadata: {
protocolName: 'My Protocol',
author: [1.23, 'cat', true, false, null, undefined, -1./0, {nested: 42, hm: 43}, 0./0],
},
robotType: FLEX_ROBOT_TYPE,
}));
});

})
15 changes: 15 additions & 0 deletions protocol-designer/src/file-data/selectors/fileCreator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ import type { LabwareDefByDefURI } from '../../labware-defs'
import type { Selector } from '../../types'
import type { DesignerApplicationData } from '../../load-file/migration/utils/getLoadLiquidCommands'
import type { SecondOrderCommandAnnotation } from '@opentrons/shared-data/commandAnnotation/types'
import genPythonProtocol from './pythonProtocol'

// TODO: BC: 2018-02-21 uncomment this assert, causes test failures
// console.assert(!isEmpty(process.env.OT_PD_VERSION), 'Could not find application version!')
Expand Down Expand Up @@ -432,13 +433,27 @@ export const createFile: Selector<ProtocolFile> = createSelector(
designerApplication,
}

const pythonProtocol = genPythonProtocol(
fileMetadata,
robotType,
initialRobotState,
labwareEntities,
labwareNicknamesById,
moduleEntities,
pipetteEntities,
ingredients,
ingredLocations,
);
console.log(pythonProtocol);

return {
...protocolBase,
...deckStructure,
...labwareV2Mixin,
...liquidV1Mixin,
...commandv8Mixin,
...commandAnnotionaV1Mixin,
PYTHONFILE: pythonProtocol,
}
}
)
Loading

0 comments on commit d86c562

Please sign in to comment.