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 8920578
Show file tree
Hide file tree
Showing 4 changed files with 401 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'
import genPythonProtocol from '../selectors/pythonProtocol'
import { FLEX_ROBOT_TYPE } from '@opentrons/shared-data';

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 8920578

Please sign in to comment.