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 35422b6 commit 0161d3e
Show file tree
Hide file tree
Showing 5 changed files with 398 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

'it' 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

'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'

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

View workflow job for this annotation

GitHub Actions / js checks

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

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

View workflow job for this annotation

GitHub Actions / js checks

'FLEX_ROBOT_TYPE' is defined but never used

describe('Python', () => {

// it('should render Python protocol', () => {
// console.log(genPythonProtocol({
// 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 0161d3e

Please sign in to comment.