@opentrons/shared-data 0.1.7-alpha.0 → 0.2.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (372) hide show
  1. package/.coveragerc +4 -0
  2. package/.flake8 +31 -0
  3. package/Config.in +11 -0
  4. package/LICENSE +202 -0
  5. package/Makefile +13 -14
  6. package/Makefile-python.mk +134 -0
  7. package/buildroot.mk +35 -0
  8. package/command/index.ts +16 -2
  9. package/command/schemas/12.json +65 -0
  10. package/command/schemas/13.json +7039 -0
  11. package/command/schemas/14.json +7254 -0
  12. package/command/types/annotation.ts +1 -1
  13. package/command/types/calibration.ts +7 -6
  14. package/command/types/gantry.ts +7 -6
  15. package/command/types/incidental.ts +1 -1
  16. package/command/types/index.ts +79 -20
  17. package/command/types/module.ts +98 -11
  18. package/command/types/pipetting.ts +9 -3
  19. package/command/types/robot.ts +98 -0
  20. package/command/types/setup.ts +8 -8
  21. package/command/types/support.ts +14 -2
  22. package/command/types/timing.ts +1 -1
  23. package/command/types/unsafe.ts +63 -1
  24. package/deck/definitions/5/ot2_short_trash.json +37 -0
  25. package/deck/definitions/5/ot2_standard.json +37 -0
  26. package/deck/definitions/5/ot3_standard.json +152 -51
  27. package/deck/index.ts +3 -6
  28. package/deck/schemas/5.json +46 -1
  29. package/errors/definitions/1/errors.json +12 -0
  30. package/errors/index.ts +2 -1
  31. package/labware/definitions/2/agilent_1_reservoir_290ml/3.json +80 -0
  32. package/labware/definitions/2/appliedbiosystemsmicroamp_384_wellplate_40ul/3.json +4737 -0
  33. package/labware/definitions/2/axygen_96_wellplate_500ul/1.json +1036 -0
  34. package/labware/definitions/2/axygen_96_wellplate_500ul/2.json +1159 -0
  35. package/labware/definitions/2/biorad_384_wellplate_50ul/4.json +4748 -0
  36. package/labware/definitions/2/biorad_96_wellplate_200ul_pcr/4.json +1187 -0
  37. package/labware/definitions/2/corning_12_wellplate_6.9ml_flat/4.json +210 -0
  38. package/labware/definitions/2/corning_24_wellplate_3.4ml_flat/4.json +342 -0
  39. package/labware/definitions/2/corning_384_wellplate_112ul_flat/4.json +5116 -0
  40. package/labware/definitions/2/corning_48_wellplate_1.6ml_flat/4.json +605 -0
  41. package/labware/definitions/2/corning_48_wellplate_1.6ml_flat/5.json +610 -0
  42. package/labware/definitions/2/corning_6_wellplate_16.8ml_flat/4.json +134 -0
  43. package/labware/definitions/2/corning_96_wellplate_360ul_flat/4.json +1177 -0
  44. package/labware/definitions/2/corning_96_wellplate_360ul_lid/1.json +111 -0
  45. package/labware/definitions/2/ev_resin_tips_flex_96_labware/1.json +1 -1
  46. package/labware/definitions/2/ibidi_96_square_well_plate_300ul/1.json +1105 -0
  47. package/labware/definitions/2/ibidi_96_square_well_plate_300ul/2.json +1216 -0
  48. package/labware/definitions/2/ibidi_96_square_well_plate_300ul_lid/1.json +110 -0
  49. package/labware/definitions/2/nest_12_reservoir_22ml/1.json +232 -0
  50. package/labware/definitions/2/nest_1_reservoir_290ml/3.json +80 -0
  51. package/labware/definitions/2/nest_24_wellplate_10.4ml/1.json +386 -0
  52. package/labware/definitions/2/nest_8_reservoir_22ml/1.json +162 -0
  53. package/labware/definitions/2/nest_96_wellplate_100ul_pcr_full_skirt/4.json +1166 -0
  54. package/labware/definitions/2/nest_96_wellplate_200ul_flat/4.json +1145 -0
  55. package/labware/definitions/2/nest_96_wellplate_2ml_deep/4.json +1261 -0
  56. package/labware/definitions/2/opentrons_24_aluminumblock_nest_0.5ml_screwcap/3.json +370 -0
  57. package/labware/definitions/2/opentrons_24_tuberack_nest_0.5ml_screwcap/3.json +371 -0
  58. package/labware/definitions/2/opentrons_96_aluminumblock_generic_pcr_strip_200ul/4.json +1149 -0
  59. package/labware/definitions/2/opentrons_96_wellplate_200ul_pcr_full_skirt/4.json +1174 -0
  60. package/labware/definitions/2/opentrons_flex_96_filtertiprack_1000ul/1.json +5 -0
  61. package/labware/definitions/2/opentrons_flex_96_filtertiprack_200ul/1.json +5 -0
  62. package/labware/definitions/2/opentrons_flex_96_filtertiprack_20ul/1.json +5 -0
  63. package/labware/definitions/2/opentrons_flex_96_filtertiprack_50ul/1.json +5 -0
  64. package/labware/definitions/2/opentrons_flex_96_tiprack_1000ul/1.json +5 -0
  65. package/labware/definitions/2/opentrons_flex_96_tiprack_200ul/1.json +5 -0
  66. package/labware/definitions/2/opentrons_flex_96_tiprack_20ul/1.json +5 -0
  67. package/labware/definitions/2/opentrons_flex_96_tiprack_50ul/1.json +5 -0
  68. package/labware/definitions/2/opentrons_flex_tiprack_lid/1.json +15 -9
  69. package/labware/definitions/2/opentrons_tough_pcr_auto_sealing_lid/1.json +8 -0
  70. package/labware/definitions/2/opentrons_tough_universal_lid/1.json +16 -1
  71. package/labware/definitions/2/smc_384_read_plate/1.json +4701 -0
  72. package/labware/definitions/2/smc_384_read_plate/2.json +5100 -0
  73. package/labware/definitions/2/thermoscientificnunc_96_wellplate_1300ul/3.json +1141 -0
  74. package/labware/definitions/2/thermoscientificnunc_96_wellplate_2000ul/3.json +1141 -0
  75. package/labware/definitions/2/usascientific_12_reservoir_22ml/3.json +237 -0
  76. package/labware/definitions/2/usascientific_96_wellplate_2.4ml_deep/3.json +1243 -0
  77. package/labware/definitions/3/schema3test_96_well_aluminum_block/999.json +1050 -0
  78. package/labware/definitions/3/schema3test_96_wellplate_200ul_pcr_full_skirt/999.json +1202 -0
  79. package/labware/definitions/3/schema3test_aluminum_flat_bottom_plate/999.json +70 -0
  80. package/labware/definitions/3/schema3test_flex_96_tiprack_200ul/999.json +1037 -0
  81. package/labware/definitions/3/schema3test_flex_96_tiprack_adapter/999.json +70 -0
  82. package/labware/definitions/3/schema3test_flex_tiprack_lid/999.json +146 -0
  83. package/labware/definitions/3/schema3test_tough_pcr_auto_sealing_lid/999.json +162 -0
  84. package/labware/definitions/3/schema3test_universal_flat_adapter/999.json +157 -0
  85. package/labware/fixtures/2/fixture_user_volumes_prototype.json +1137 -0
  86. package/labware/fixtures/2/index.ts +4 -4
  87. package/labware/fixtures/3/fixture_2_plate.json +28 -11
  88. package/labware/fixtures/3/fixture_corning_24_plate.json +51 -34
  89. package/labware/fixtures/3/index.ts +4 -0
  90. package/labware/schemas/2.json +36 -1
  91. package/labware/schemas/3.json +115 -25
  92. package/lib/command/index.d.ts +4211 -2095
  93. package/lib/command/schemas/12.json +65 -0
  94. package/lib/command/schemas/13.json +7039 -0
  95. package/lib/command/schemas/14.json +7254 -0
  96. package/lib/command/types/annotation.d.ts +1 -1
  97. package/lib/command/types/calibration.d.ts +5 -5
  98. package/lib/command/types/gantry.d.ts +5 -4
  99. package/lib/command/types/incidental.d.ts +1 -1
  100. package/lib/command/types/index.d.ts +60 -14
  101. package/lib/command/types/module.d.ts +75 -13
  102. package/lib/command/types/pipetting.d.ts +8 -3
  103. package/lib/command/types/robot.d.ts +71 -0
  104. package/lib/command/types/setup.d.ts +5 -5
  105. package/lib/command/types/support.d.ts +3 -2
  106. package/lib/command/types/timing.d.ts +1 -1
  107. package/lib/command/types/unsafe.d.ts +44 -3
  108. package/lib/deck/definitions/5/ot2_short_trash.json +37 -0
  109. package/lib/deck/definitions/5/ot2_standard.json +37 -0
  110. package/lib/deck/definitions/5/ot3_standard.json +152 -51
  111. package/lib/deck/index.d.ts +3 -3
  112. package/lib/deck/schemas/5.json +46 -1
  113. package/lib/errors/definitions/1/errors.json +12 -0
  114. package/lib/errors/index.d.ts +1 -1
  115. package/lib/index.mjs +380872 -297265
  116. package/lib/js/constants.d.ts +45 -17
  117. package/lib/js/deck/index.d.ts +2 -2
  118. package/lib/js/fixtures.d.ts +78 -3
  119. package/lib/js/getLabware.d.ts +3 -3
  120. package/lib/js/gripper.d.ts +1 -1
  121. package/lib/js/helpers/__tests__/getMaxPushOutVolume.test.d.ts +1 -0
  122. package/lib/js/helpers/__tests__/getMmFromBottom.test.d.ts +1 -0
  123. package/lib/js/helpers/__tests__/getStackedItemsOnStartingDeck.test.d.ts +1 -0
  124. package/lib/js/helpers/__tests__/labwareSchemaShims.test.d.ts +1 -0
  125. package/lib/js/helpers/__tests__/liquidClasses.test.d.ts +1 -0
  126. package/lib/js/helpers/__tests__/pairsFromArray.test.d.ts +1 -0
  127. package/lib/js/helpers/__tests__/vectorMath.test.d.ts +1 -0
  128. package/lib/js/helpers/getFixedTrashLabwareDefinition.d.ts +2 -2
  129. package/lib/js/helpers/getLabwareDefURI.d.ts +3 -0
  130. package/lib/js/helpers/getLabwareDefinitionsByURIForProtocol.d.ts +6 -0
  131. package/lib/js/helpers/getLabwareInfoByLiquidId.d.ts +10 -0
  132. package/lib/js/helpers/getLiquidsByIdForLabware.d.ts +2 -0
  133. package/lib/js/helpers/getLoadedLabwareDefinitionsByUri.d.ts +2 -2
  134. package/lib/js/helpers/getMaxPushOutVolume.d.ts +2 -0
  135. package/lib/js/helpers/getMmFromBottom.d.ts +2 -0
  136. package/lib/js/helpers/getSimplestFlexDeckConfig.d.ts +1 -1
  137. package/lib/js/helpers/getStackedItemsOnStartingDeck.d.ts +50 -0
  138. package/lib/js/helpers/getStandardDeckViewLayerBlockList.d.ts +2 -0
  139. package/lib/js/helpers/getTipTypeFromTipRackDefinition.d.ts +2 -2
  140. package/lib/js/helpers/getWellFillFromLabwareId.d.ts +4 -0
  141. package/lib/js/helpers/getWellNamePerMultiTip.d.ts +3 -3
  142. package/lib/js/helpers/getWellRangeForLiquidLabwarePair.d.ts +6 -0
  143. package/lib/js/helpers/getWellTotalVolume.d.ts +2 -2
  144. package/lib/js/helpers/index.d.ts +25 -14
  145. package/lib/js/helpers/labwareInference.d.ts +3 -3
  146. package/lib/js/helpers/liquidClasses.d.ts +10 -0
  147. package/lib/js/helpers/matrixMath.d.ts +3 -0
  148. package/lib/js/helpers/pairsFromArray.d.ts +8 -0
  149. package/lib/js/helpers/parseAddressableArea.d.ts +1 -1
  150. package/lib/js/helpers/parseProtocolCommands.d.ts +5 -5
  151. package/lib/js/helpers/positionMath.d.ts +127 -0
  152. package/lib/js/helpers/validateCustomLabwareHelper.d.ts +2 -2
  153. package/lib/js/helpers/vectorMath.d.ts +14 -0
  154. package/lib/js/helpers/wellSets.d.ts +4 -4
  155. package/lib/js/labware.d.ts +10 -9
  156. package/lib/js/labwareTools/index.d.ts +1 -1
  157. package/lib/js/liquidClasses.d.ts +4 -0
  158. package/lib/js/modules.d.ts +2 -2
  159. package/lib/js/pipettes.d.ts +3 -2
  160. package/lib/js/types.d.ts +105 -38
  161. package/lib/labware/definitions/2/agilent_1_reservoir_290ml/3.json +80 -0
  162. package/lib/labware/definitions/2/appliedbiosystemsmicroamp_384_wellplate_40ul/3.json +4737 -0
  163. package/lib/labware/definitions/2/axygen_96_wellplate_500ul/1.json +1036 -0
  164. package/lib/labware/definitions/2/axygen_96_wellplate_500ul/2.json +1159 -0
  165. package/lib/labware/definitions/2/biorad_384_wellplate_50ul/4.json +4748 -0
  166. package/lib/labware/definitions/2/biorad_96_wellplate_200ul_pcr/4.json +1187 -0
  167. package/lib/labware/definitions/2/corning_12_wellplate_6.9ml_flat/4.json +210 -0
  168. package/lib/labware/definitions/2/corning_24_wellplate_3.4ml_flat/4.json +342 -0
  169. package/lib/labware/definitions/2/corning_384_wellplate_112ul_flat/4.json +5116 -0
  170. package/lib/labware/definitions/2/corning_48_wellplate_1.6ml_flat/4.json +605 -0
  171. package/lib/labware/definitions/2/corning_48_wellplate_1.6ml_flat/5.json +610 -0
  172. package/lib/labware/definitions/2/corning_6_wellplate_16.8ml_flat/4.json +134 -0
  173. package/lib/labware/definitions/2/corning_96_wellplate_360ul_flat/4.json +1177 -0
  174. package/lib/labware/definitions/2/corning_96_wellplate_360ul_lid/1.json +111 -0
  175. package/lib/labware/definitions/2/ev_resin_tips_flex_96_labware/1.json +1 -1
  176. package/lib/labware/definitions/2/ibidi_96_square_well_plate_300ul/1.json +1105 -0
  177. package/lib/labware/definitions/2/ibidi_96_square_well_plate_300ul/2.json +1216 -0
  178. package/lib/labware/definitions/2/ibidi_96_square_well_plate_300ul_lid/1.json +110 -0
  179. package/lib/labware/definitions/2/nest_12_reservoir_22ml/1.json +232 -0
  180. package/lib/labware/definitions/2/nest_1_reservoir_290ml/3.json +80 -0
  181. package/lib/labware/definitions/2/nest_24_wellplate_10.4ml/1.json +386 -0
  182. package/lib/labware/definitions/2/nest_8_reservoir_22ml/1.json +162 -0
  183. package/lib/labware/definitions/2/nest_96_wellplate_100ul_pcr_full_skirt/4.json +1166 -0
  184. package/lib/labware/definitions/2/nest_96_wellplate_200ul_flat/4.json +1145 -0
  185. package/lib/labware/definitions/2/nest_96_wellplate_2ml_deep/4.json +1261 -0
  186. package/lib/labware/definitions/2/opentrons_24_aluminumblock_nest_0.5ml_screwcap/3.json +370 -0
  187. package/lib/labware/definitions/2/opentrons_24_tuberack_nest_0.5ml_screwcap/3.json +371 -0
  188. package/lib/labware/definitions/2/opentrons_96_aluminumblock_generic_pcr_strip_200ul/4.json +1149 -0
  189. package/lib/labware/definitions/2/opentrons_96_wellplate_200ul_pcr_full_skirt/4.json +1174 -0
  190. package/lib/labware/definitions/2/opentrons_flex_96_filtertiprack_1000ul/1.json +5 -0
  191. package/lib/labware/definitions/2/opentrons_flex_96_filtertiprack_200ul/1.json +5 -0
  192. package/lib/labware/definitions/2/opentrons_flex_96_filtertiprack_20ul/1.json +5 -0
  193. package/lib/labware/definitions/2/opentrons_flex_96_filtertiprack_50ul/1.json +5 -0
  194. package/lib/labware/definitions/2/opentrons_flex_96_tiprack_1000ul/1.json +5 -0
  195. package/lib/labware/definitions/2/opentrons_flex_96_tiprack_200ul/1.json +5 -0
  196. package/lib/labware/definitions/2/opentrons_flex_96_tiprack_20ul/1.json +5 -0
  197. package/lib/labware/definitions/2/opentrons_flex_96_tiprack_50ul/1.json +5 -0
  198. package/lib/labware/definitions/2/opentrons_flex_tiprack_lid/1.json +15 -9
  199. package/lib/labware/definitions/2/opentrons_tough_pcr_auto_sealing_lid/1.json +8 -0
  200. package/lib/labware/definitions/2/opentrons_tough_universal_lid/1.json +16 -1
  201. package/lib/labware/definitions/2/smc_384_read_plate/1.json +4701 -0
  202. package/lib/labware/definitions/2/smc_384_read_plate/2.json +5100 -0
  203. package/lib/labware/definitions/2/thermoscientificnunc_96_wellplate_1300ul/3.json +1141 -0
  204. package/lib/labware/definitions/2/thermoscientificnunc_96_wellplate_2000ul/3.json +1141 -0
  205. package/lib/labware/definitions/2/usascientific_12_reservoir_22ml/3.json +237 -0
  206. package/lib/labware/definitions/2/usascientific_96_wellplate_2.4ml_deep/3.json +1243 -0
  207. package/lib/labware/definitions/3/schema3test_96_well_aluminum_block/999.json +1050 -0
  208. package/lib/labware/definitions/3/schema3test_96_wellplate_200ul_pcr_full_skirt/999.json +1202 -0
  209. package/lib/labware/definitions/3/schema3test_aluminum_flat_bottom_plate/999.json +70 -0
  210. package/lib/labware/definitions/3/schema3test_flex_96_tiprack_200ul/999.json +1037 -0
  211. package/lib/labware/definitions/3/schema3test_flex_96_tiprack_adapter/999.json +70 -0
  212. package/lib/labware/definitions/3/schema3test_flex_tiprack_lid/999.json +146 -0
  213. package/lib/labware/definitions/3/schema3test_tough_pcr_auto_sealing_lid/999.json +162 -0
  214. package/lib/labware/definitions/3/schema3test_universal_flat_adapter/999.json +157 -0
  215. package/lib/labware/fixtures/2/fixture_user_volumes_prototype.json +1137 -0
  216. package/lib/labware/fixtures/2/index.d.ts +4 -4
  217. package/lib/labware/fixtures/3/fixture_2_plate.json +28 -11
  218. package/lib/labware/fixtures/3/fixture_corning_24_plate.json +51 -34
  219. package/lib/labware/fixtures/3/index.d.ts +3 -0
  220. package/lib/labware/schemas/2.json +36 -1
  221. package/lib/labware/schemas/3.json +115 -25
  222. package/lib/liquid-class/definitions/1/{ethanol_80.json → ethanol_80/1.json} +1957 -1406
  223. package/lib/liquid-class/definitions/1/{glycerol_50.json → glycerol_50/1.json} +1781 -1230
  224. package/lib/liquid-class/definitions/1/{water.json → water/1.json} +1567 -1082
  225. package/lib/liquid-class/fixtures/1/fixture_glycerol50.json +67 -48
  226. package/lib/liquid-class/schemas/1.json +40 -48
  227. package/lib/module/definitions/3/absorbanceReaderV1.json +20 -150
  228. package/lib/module/definitions/3/flexStackerModuleV1.json +31 -385
  229. package/lib/module/definitions/3/heaterShakerModuleV1.json +16 -357
  230. package/lib/module/definitions/3/magneticBlockV1.json +18 -148
  231. package/lib/module/definitions/3/magneticModuleV1.json +16 -398
  232. package/lib/module/definitions/3/magneticModuleV2.json +16 -398
  233. package/lib/module/definitions/3/temperatureModuleV1.json +16 -152
  234. package/lib/module/definitions/3/temperatureModuleV2.json +16 -152
  235. package/lib/module/definitions/3/thermocyclerModuleV1.json +16 -1339
  236. package/lib/module/definitions/3/thermocyclerModuleV2.json +18 -3616
  237. package/lib/module/schemas/3.json +111 -10
  238. package/lib/pipette/definitions/1/pipetteModelSpecs.json +336 -0
  239. package/lib/pipette/definitions/2/general/ninety_six_channel/p200/3_2.json +660 -0
  240. package/lib/pipette/definitions/2/geometry/eight_channel/p50/3_5.json +4 -0
  241. package/lib/pipette/definitions/2/geometry/ninety_six_channel/p200/3_0.json +4 -0
  242. package/lib/pipette/definitions/2/geometry/ninety_six_channel/p200/3_2.json +309 -0
  243. package/lib/pipette/definitions/2/geometry/single_channel/p50/3_6.json +4 -0
  244. package/lib/pipette/definitions/2/liquid/ninety_six_channel/p200/default/1_0.json +11 -11
  245. package/lib/pipette/definitions/2/liquid/ninety_six_channel/p200/default/3_0.json +12 -12
  246. package/lib/pipette/definitions/2/liquid/ninety_six_channel/p200/default/3_1.json +28 -18
  247. package/lib/pipette/definitions/2/liquid/ninety_six_channel/p200/default/3_2.json +192 -0
  248. package/lib/pipette/definitions/2/liquid/single_channel/p50/default/3_6.json +5 -5
  249. package/lib/pipette/definitions/2/liquid/single_channel/p50/lowVolumeDefault/3_6.json +5 -5
  250. package/lib/pipette/fixtures/name/index.d.ts +1 -1
  251. package/lib/protocol/fixtures/index.d.ts +2 -2
  252. package/lib/protocol/index.d.ts +7 -7
  253. package/lib/protocol/types/schemaV4.d.ts +1 -1
  254. package/lib/protocol/types/schemaV5.d.ts +1 -1
  255. package/lib/protocol/types/schemaV5Addendum.d.ts +1 -1
  256. package/lib/protocol/types/schemaV6/command/gantry.d.ts +4 -4
  257. package/lib/protocol/types/schemaV6/command/index.d.ts +5 -5
  258. package/lib/protocol/types/schemaV6/command/module.d.ts +1 -1
  259. package/lib/protocol/types/schemaV6/command/pipetting.d.ts +1 -1
  260. package/lib/protocol/types/schemaV6/command/setup.d.ts +1 -1
  261. package/lib/protocol/types/schemaV6/command/timing.d.ts +1 -1
  262. package/lib/protocol/types/schemaV6/index.d.ts +2 -2
  263. package/lib/protocol/types/schemaV7/command/annotation.d.ts +1 -1
  264. package/lib/protocol/types/schemaV7/command/calibration.d.ts +5 -5
  265. package/lib/protocol/types/schemaV7/command/gantry.d.ts +4 -4
  266. package/lib/protocol/types/schemaV7/command/incidental.d.ts +1 -1
  267. package/lib/protocol/types/schemaV7/command/index.d.ts +7 -7
  268. package/lib/protocol/types/schemaV7/command/module.d.ts +1 -1
  269. package/lib/protocol/types/schemaV7/command/pipetting.d.ts +1 -1
  270. package/lib/protocol/types/schemaV7/command/setup.d.ts +1 -1
  271. package/lib/protocol/types/schemaV7/command/timing.d.ts +1 -1
  272. package/lib/protocol/types/schemaV7/index.d.ts +2 -2
  273. package/lib/protocol/types/schemaV8/index.d.ts +18 -2
  274. package/liquid-class/definitions/1/{ethanol_80.json → ethanol_80/1.json} +1957 -1406
  275. package/liquid-class/definitions/1/{glycerol_50.json → glycerol_50/1.json} +1781 -1230
  276. package/liquid-class/definitions/1/{water.json → water/1.json} +1567 -1082
  277. package/liquid-class/fixtures/1/fixture_glycerol50.json +67 -48
  278. package/liquid-class/schemas/1.json +40 -48
  279. package/module/definitions/3/absorbanceReaderV1.json +20 -150
  280. package/module/definitions/3/flexStackerModuleV1.json +31 -385
  281. package/module/definitions/3/heaterShakerModuleV1.json +16 -357
  282. package/module/definitions/3/magneticBlockV1.json +18 -148
  283. package/module/definitions/3/magneticModuleV1.json +16 -398
  284. package/module/definitions/3/magneticModuleV2.json +16 -398
  285. package/module/definitions/3/temperatureModuleV1.json +16 -152
  286. package/module/definitions/3/temperatureModuleV2.json +16 -152
  287. package/module/definitions/3/thermocyclerModuleV1.json +16 -1339
  288. package/module/definitions/3/thermocyclerModuleV2.json +18 -3616
  289. package/module/schemas/3.json +111 -10
  290. package/mypy.ini +22 -0
  291. package/package.json +1 -1
  292. package/pipette/definitions/1/pipetteModelSpecs.json +336 -0
  293. package/pipette/definitions/2/general/ninety_six_channel/p200/3_2.json +660 -0
  294. package/pipette/definitions/2/geometry/eight_channel/p50/3_5.json +4 -0
  295. package/pipette/definitions/2/geometry/ninety_six_channel/p200/3_0.json +4 -0
  296. package/pipette/definitions/2/geometry/ninety_six_channel/p200/3_2.json +309 -0
  297. package/pipette/definitions/2/geometry/single_channel/p50/3_6.json +4 -0
  298. package/pipette/definitions/2/liquid/ninety_six_channel/p200/default/1_0.json +11 -11
  299. package/pipette/definitions/2/liquid/ninety_six_channel/p200/default/3_0.json +12 -12
  300. package/pipette/definitions/2/liquid/ninety_six_channel/p200/default/3_1.json +28 -18
  301. package/pipette/definitions/2/liquid/ninety_six_channel/p200/default/3_2.json +192 -0
  302. package/pipette/definitions/2/liquid/single_channel/p50/default/3_6.json +5 -5
  303. package/pipette/definitions/2/liquid/single_channel/p50/lowVolumeDefault/3_6.json +5 -5
  304. package/pipette/fixtures/index.ts +12 -12
  305. package/pipette/fixtures/name/index.ts +1 -0
  306. package/protocol/fixtures/index.ts +2 -3
  307. package/protocol/index.ts +9 -8
  308. package/protocol/types/schemaV4.ts +4 -4
  309. package/protocol/types/schemaV5.ts +1 -1
  310. package/protocol/types/schemaV5Addendum.ts +1 -1
  311. package/protocol/types/schemaV6/command/gantry.ts +4 -4
  312. package/protocol/types/schemaV6/command/index.ts +6 -6
  313. package/protocol/types/schemaV6/command/module.ts +1 -1
  314. package/protocol/types/schemaV6/command/pipetting.ts +2 -1
  315. package/protocol/types/schemaV6/command/setup.ts +2 -2
  316. package/protocol/types/schemaV6/command/timing.ts +1 -1
  317. package/protocol/types/schemaV6/index.ts +3 -3
  318. package/protocol/types/schemaV7/command/annotation.ts +1 -1
  319. package/protocol/types/schemaV7/command/calibration.ts +7 -6
  320. package/protocol/types/schemaV7/command/gantry.ts +5 -5
  321. package/protocol/types/schemaV7/command/incidental.ts +1 -1
  322. package/protocol/types/schemaV7/command/index.ts +14 -14
  323. package/protocol/types/schemaV7/command/module.ts +1 -1
  324. package/protocol/types/schemaV7/command/pipetting.ts +2 -1
  325. package/protocol/types/schemaV7/command/setup.ts +2 -2
  326. package/protocol/types/schemaV7/command/timing.ts +1 -1
  327. package/protocol/types/schemaV7/index.ts +3 -3
  328. package/protocol/types/schemaV8/index.ts +32 -4
  329. package/pyproject.toml +119 -0
  330. package/pytest.ini +8 -0
  331. package/python_tests/__init__.py +1 -0
  332. package/python_tests/command/test_known_schema_ids.py +9 -0
  333. package/python_tests/conftest.py +108 -0
  334. package/python_tests/deck/__init__.py +0 -0
  335. package/python_tests/deck/test_list_names.py +12 -0
  336. package/python_tests/deck/test_position.py +101 -0
  337. package/python_tests/deck/test_typechecks.py +23 -0
  338. package/python_tests/errors/__init__.py +1 -0
  339. package/python_tests/errors/test_error_completeness.py +19 -0
  340. package/python_tests/errors/test_exceptions.py +74 -0
  341. package/python_tests/gripper/__init__.py +0 -0
  342. package/python_tests/gripper/test_definition.py +30 -0
  343. package/python_tests/gripper/test_load.py +19 -0
  344. package/python_tests/labware/__init__.py +13 -0
  345. package/python_tests/labware/test_typechecks.py +80 -0
  346. package/python_tests/liquid_classes/__init__.py +0 -0
  347. package/python_tests/liquid_classes/test_liquid_class_values.py +59 -0
  348. package/python_tests/liquid_classes/test_load.py +45 -0
  349. package/python_tests/liquid_classes/test_validations.py +192 -0
  350. package/python_tests/module/__init__.py +20 -0
  351. package/python_tests/module/test_load.py +49 -0
  352. package/python_tests/module/test_typechecks.py +26 -0
  353. package/python_tests/pipette/__init__.py +0 -0
  354. package/python_tests/pipette/test_load_data.py +109 -0
  355. package/python_tests/pipette/test_max_flow_rates_per_volume.py +112 -0
  356. package/python_tests/pipette/test_mutable_configurations.py +467 -0
  357. package/python_tests/pipette/test_pipette_definition.py +183 -0
  358. package/python_tests/pipette/test_pipette_load_name_conversions.py +244 -0
  359. package/python_tests/pipette/test_typechecks.py +47 -0
  360. package/python_tests/pipette/test_validate_schema.py +198 -0
  361. package/python_tests/protocol/__init__.py +7 -0
  362. package/python_tests/protocol/test_protocol_schema_v6.py +108 -0
  363. package/python_tests/protocol/test_protocol_schema_v7.py +35 -0
  364. package/python_tests/protocol/test_protocol_schema_v8.py +17 -0
  365. package/python_tests/protocol/test_typechecks.py +30 -0
  366. package/python_tests/robot/__init__.py +0 -0
  367. package/python_tests/robot/test_typechecks.py +13 -0
  368. package/lib/js/cypressUtils.d.ts +0 -1
  369. package/lib/js/helpers/getVectorDifference.d.ts +0 -2
  370. package/lib/js/helpers/getVectorSum.d.ts +0 -2
  371. /package/lib/js/{helpers/__tests__/getVectorDifference.test.d.ts → __tests__/fixtures.test.d.ts} +0 -0
  372. /package/lib/js/helpers/__tests__/{getVectorSum.test.d.ts → getLabwareInfoByLiquidId.test.d.ts} +0 -0
@@ -0,0 +1,9 @@
1
+ from opentrons_shared_data.load import get_shared_data_root
2
+ from opentrons_shared_data.command import known_schema_ids
3
+
4
+
5
+ def test_known_schema_ids() -> None:
6
+ schema_paths = get_shared_data_root() / "command" / "schemas"
7
+ names = [filename.stem for filename in schema_paths.iterdir()]
8
+ ids = [f"opentronsCommandSchemaV{version}" for version in names]
9
+ assert sorted(ids) == sorted(known_schema_ids())
@@ -0,0 +1,108 @@
1
+ """Fixtures and helpers for python tests."""
2
+
3
+ import pytest
4
+ from typing import Any, Dict
5
+
6
+
7
+ @pytest.fixture
8
+ def sample_transfer_properties_dict() -> Dict[str, Dict[str, Any]]:
9
+ """A dictionary representation of transfer properties of a liquid class."""
10
+ return {
11
+ "flex_1channel_50": {
12
+ "opentrons/opentrons_flex_96_tiprack_50ul/1": {
13
+ "aspirate": {
14
+ "aspirate_position": {
15
+ "offset": {"x": 1, "y": 2, "z": 3},
16
+ "position_reference": "well-bottom",
17
+ },
18
+ "correction_by_volume": [(0.0, 0.0)],
19
+ "delay": {"enable": False},
20
+ "flow_rate_by_volume": [(10.0, 40.0), (20.0, 30.0)],
21
+ "mix": {"enable": False},
22
+ "pre_wet": True,
23
+ "retract": {
24
+ "air_gap_by_volume": [(5.0, 3.0), (10.0, 4.0)],
25
+ "delay": {"enable": False},
26
+ "end_position": {
27
+ "offset": {"x": 1, "y": 2, "z": 3},
28
+ "position_reference": "well-bottom",
29
+ },
30
+ "speed": 40,
31
+ "touch_tip": {"enable": False},
32
+ },
33
+ "submerge": {
34
+ "delay": {"enable": False},
35
+ "speed": 100,
36
+ "start_position": {
37
+ "offset": {"x": 1, "y": 2, "z": 3},
38
+ "position_reference": "well-bottom",
39
+ },
40
+ },
41
+ },
42
+ "dispense": {
43
+ "dispense_position": {
44
+ "offset": {"x": 1, "y": 2, "z": 3},
45
+ "position_reference": "well-bottom",
46
+ },
47
+ "correction_by_volume": [(0.0, 0.0)],
48
+ "delay": {"enable": False},
49
+ "flow_rate_by_volume": [(10.0, 40.0), (20.0, 30.0)],
50
+ "mix": {"enable": False},
51
+ "push_out_by_volume": [(10.0, 7.0), (20.0, 10.0)],
52
+ "retract": {
53
+ "air_gap_by_volume": [(5.0, 3.0), (10.0, 4.0)],
54
+ "blowout": {"enable": False},
55
+ "delay": {"enable": False},
56
+ "end_position": {
57
+ "offset": {"x": 1, "y": 2, "z": 3},
58
+ "position_reference": "well-bottom",
59
+ },
60
+ "speed": 40,
61
+ "touch_tip": {"enable": False},
62
+ },
63
+ "submerge": {
64
+ "delay": {"enable": False},
65
+ "speed": 100,
66
+ "start_position": {
67
+ "offset": {"x": 1, "y": 2, "z": 3},
68
+ "position_reference": "well-bottom",
69
+ },
70
+ },
71
+ },
72
+ "multi_dispense": {
73
+ "dispense_position": {
74
+ "offset": {"x": 0, "y": 0, "z": 1},
75
+ "position_reference": "well-bottom",
76
+ },
77
+ "flow_rate_by_volume": [(0, 318)],
78
+ "correction_by_volume": [(0, 0)],
79
+ "delay": {"enabled": False},
80
+ "submerge": {
81
+ "delay": {"enabled": False},
82
+ "speed": 100,
83
+ "start_position": {
84
+ "offset": {"x": 0, "y": 0, "z": 2},
85
+ "position_reference": "well-top",
86
+ },
87
+ },
88
+ "retract": {
89
+ "air_gap_by_volume": [(0, 0)],
90
+ "delay": {"enabled": False},
91
+ "end_position": {
92
+ "offset": {"x": 0, "y": 0, "z": 2},
93
+ "position_reference": "well-top",
94
+ },
95
+ "speed": 50,
96
+ "touch_tip": {"enabled": False},
97
+ "blowout": {
98
+ "enabled": True,
99
+ "location": "trash",
100
+ "flow_rate": 478,
101
+ },
102
+ },
103
+ "conditioning_by_volume": [(0, 0)],
104
+ "disposal_by_volume": [(0, 5)],
105
+ },
106
+ }
107
+ }
108
+ }
File without changes
@@ -0,0 +1,12 @@
1
+ import pytest
2
+
3
+ from opentrons_shared_data.deck import list_names
4
+
5
+
6
+ @pytest.mark.parametrize("version", [3, 4])
7
+ def test_list_names(version: int) -> None:
8
+ """Make sure `list_names()` returns something.
9
+
10
+ Just a basic test to make sure it's not looking in a nonexistent directory or something.
11
+ """
12
+ assert len(list_names(version)) > 0
@@ -0,0 +1,101 @@
1
+ from typing import Dict, Generator, List, Set, Tuple
2
+
3
+ import pytest
4
+
5
+ from opentrons_shared_data.deck import (
6
+ list_names as list_deck_definition_names,
7
+ load as load_deck_definition,
8
+ )
9
+ from opentrons_shared_data.deck.types import (
10
+ AddressableArea,
11
+ Cutout,
12
+ CutoutFixture,
13
+ DeckDefinitionV3,
14
+ DeckDefinitionV4,
15
+ )
16
+
17
+
18
+ def as_tuple(list: List[float]) -> Tuple[float, float, float]:
19
+ """Convert an [x,y,z] list from the definitions to an (x,y,z) tuple, for hashability."""
20
+ [x, y, z] = list
21
+ return (x, y, z)
22
+
23
+
24
+ def get_v3_slot_positions(
25
+ definition: DeckDefinitionV3,
26
+ ) -> Set[Tuple[str, Tuple[float, float, float]]]:
27
+ """Return all the slot positions defined by the deck definition, as (slot_id, [x,y,z]) tuples."""
28
+ return set(
29
+ (ordered_slot["id"], as_tuple(ordered_slot["position"]))
30
+ for ordered_slot in definition["locations"]["orderedSlots"]
31
+ )
32
+
33
+
34
+ def get_v4_stacks(
35
+ definition: DeckDefinitionV4,
36
+ ) -> Generator[Tuple[Cutout, CutoutFixture, AddressableArea], None, None]:
37
+ """Yield all the (cutout, cutoutFixture, addressableArea) combinations that the def allows."""
38
+ cutout_fixtures = definition["cutoutFixtures"]
39
+ cutouts_by_id: Dict[str, Cutout] = {
40
+ cutout["id"]: cutout for cutout in definition["locations"]["cutouts"]
41
+ }
42
+ addressable_areas_by_id: Dict[str, AddressableArea] = {
43
+ addressable_area["id"]: addressable_area
44
+ for addressable_area in definition["locations"]["addressableAreas"]
45
+ }
46
+
47
+ for cutout_fixture in cutout_fixtures:
48
+ for cutout_id, addressable_area_ids in cutout_fixture[
49
+ "providesAddressableAreas"
50
+ ].items():
51
+ for addressable_area_id in addressable_area_ids:
52
+ cutout = cutouts_by_id[cutout_id]
53
+ addressable_area = addressable_areas_by_id[addressable_area_id]
54
+ yield cutout, cutout_fixture, addressable_area
55
+
56
+
57
+ def compute_v4_position(
58
+ cutout: Cutout, addressable_area: AddressableArea
59
+ ) -> List[float]:
60
+ return [
61
+ a + b
62
+ for a, b in zip(cutout["position"], addressable_area["offsetFromCutoutFixture"])
63
+ ]
64
+
65
+
66
+ def get_v4_slot_positions(
67
+ definition: DeckDefinitionV4,
68
+ ) -> Set[Tuple[str, Tuple[float, float, float]]]:
69
+ """Return all the slot positions defined by the deck definition, as (addressable_area_id, [x,y,z]) tuples.
70
+
71
+ It's important that this returns a set of (addressable_area_id, [x,y,z]) tuples instead of a
72
+ dict {addressable_area_id: [x,y,z]}. Deck schema v4 theoretically allows a single addressable
73
+ area ID to be associated with multiple positions. If that happens, we don't want to accidentally
74
+ overwrite any.
75
+ """
76
+ stacks_with_slots = (
77
+ (cutout, cutout_fixture, addressable_area)
78
+ for (cutout, cutout_fixture, addressable_area) in get_v4_stacks(definition)
79
+ if addressable_area["areaType"] == "slot"
80
+ )
81
+
82
+ slot_positions = (
83
+ (
84
+ addressable_area["id"],
85
+ as_tuple(compute_v4_position(cutout, addressable_area)),
86
+ )
87
+ for (cutout, cutout_fixture, addressable_area) in stacks_with_slots
88
+ )
89
+
90
+ return set(slot_positions)
91
+
92
+
93
+ @pytest.mark.parametrize("definition_name", list_deck_definition_names(version=4))
94
+ def test_v3_and_v4_positional_equivalence(definition_name: str) -> None:
95
+ deck_v3 = load_deck_definition(name=definition_name, version=3)
96
+ deck_v4 = load_deck_definition(name=definition_name, version=4)
97
+
98
+ v3_slot_positions = get_v3_slot_positions(deck_v3)
99
+ v4_slot_positions = get_v4_slot_positions(deck_v4)
100
+
101
+ assert v3_slot_positions == v4_slot_positions
@@ -0,0 +1,23 @@
1
+ import pytest
2
+ import typeguard
3
+
4
+ from opentrons_shared_data.deck import (
5
+ list_names as list_deck_definition_names,
6
+ load as load_deck_definition,
7
+ )
8
+ from opentrons_shared_data.deck.types import (
9
+ DeckDefinitionV3,
10
+ DeckDefinitionV5,
11
+ )
12
+
13
+
14
+ @pytest.mark.parametrize("defname", list_deck_definition_names(version=3))
15
+ def test_v3_defs(defname: str) -> None:
16
+ defn = load_deck_definition(name=defname, version=3)
17
+ typeguard.check_type(defn, DeckDefinitionV3)
18
+
19
+
20
+ @pytest.mark.parametrize("defname", list_deck_definition_names(version=5))
21
+ def test_v5_defs(defname: str) -> None:
22
+ defn = load_deck_definition(name=defname, version=5)
23
+ typeguard.check_type(defn, DeckDefinitionV5)
@@ -0,0 +1 @@
1
+ """Tests for shared-data global errors."""
@@ -0,0 +1,19 @@
1
+ """Tests that we have all errors in our python bindings."""
2
+
3
+ import json
4
+
5
+ import pytest
6
+
7
+ from opentrons_shared_data.load import load_shared_data
8
+ from opentrons_shared_data.errors.codes import ErrorCodes
9
+
10
+
11
+ error_json = json.loads(load_shared_data("errors/definitions/1/errors.json"))
12
+
13
+
14
+ @pytest.mark.parametrize("code", list(error_json["codes"].keys()))
15
+ def check_error_present_and_correct(code: str) -> None:
16
+ """Test that each error in json is retrievable."""
17
+ error = ErrorCodes.by_error_code(code)
18
+ assert error.value.code == code
19
+ assert error.value.category.value.name == error_json["code"]["category"]
@@ -0,0 +1,74 @@
1
+ """Test exception handling."""
2
+ from opentrons_shared_data.errors.exceptions import PythonException
3
+
4
+
5
+ def test_exception_wrapping_single_level() -> None:
6
+ """When we make a PythonException it should capture details of an exception."""
7
+ try:
8
+ raise RuntimeError("oh no!")
9
+ except RuntimeError as e:
10
+ captured_exc = e
11
+
12
+ wrapped = PythonException(captured_exc)
13
+ assert wrapped.detail["class"] == "RuntimeError"
14
+ assert wrapped.detail["traceback"]
15
+ assert wrapped.detail["args"] == "('oh no!',)"
16
+
17
+
18
+ def test_exception_wrapping_multi_level() -> None:
19
+ """We can wrap all exceptions in a raise-from chain."""
20
+
21
+ def _raise_inner() -> None:
22
+ raise KeyError("oh no!")
23
+
24
+ try:
25
+ try:
26
+ _raise_inner()
27
+ except KeyError as e:
28
+ raise RuntimeError("uh oh!") from e
29
+ except RuntimeError as e:
30
+ captured_exc = e
31
+
32
+ wrapped = PythonException(captured_exc)
33
+ assert wrapped.detail["class"] == "RuntimeError"
34
+ assert wrapped.detail["traceback"]
35
+ assert wrapped.detail["args"] == "('uh oh!',)"
36
+ second = wrapped.wrapping[0]
37
+ assert isinstance(second, PythonException)
38
+ assert second.detail["class"] == "KeyError"
39
+ assert second.detail["args"] == "('oh no!',)"
40
+ assert not second.wrapping
41
+
42
+
43
+ def test_exception_wrapping_rethrow() -> None:
44
+ """We can wrap raise-froms."""
45
+ try:
46
+ try:
47
+ raise RuntimeError("oh no!")
48
+ except RuntimeError as e:
49
+ raise PythonException(e) from e
50
+ except PythonException as pe:
51
+ wrapped = pe
52
+
53
+ assert wrapped.detail["class"] == "RuntimeError"
54
+ assert wrapped.detail["traceback"]
55
+ assert wrapped.detail["args"] == "('oh no!',)"
56
+
57
+
58
+ def test_exception_wrapping_error_in_except() -> None:
59
+ """We can even wrap exceptions in exception handlers."""
60
+ try:
61
+ try:
62
+ raise RuntimeError("oh no!")
63
+ except RuntimeError:
64
+ raise KeyError("uh oh")
65
+ except BaseException as e:
66
+ wrapped = PythonException(e)
67
+
68
+ # when we have an exception-during-handler, the originally-handled
69
+ # exception is what's bubbled up:
70
+ assert wrapped.detail["class"] == "KeyError"
71
+ assert len(wrapped.wrapping) == 1
72
+ assert wrapped.wrapping[0].detail["class"] == "RuntimeError"
73
+ assert wrapped.wrapping[0].detail["traceback"]
74
+ assert wrapped.wrapping[0].detail["args"] == "('oh no!',)"
File without changes
@@ -0,0 +1,30 @@
1
+ import pytest
2
+ from pydantic import ValidationError
3
+ import json
4
+ from opentrons_shared_data import gripper, load_shared_data
5
+ from opentrons_shared_data.gripper import (
6
+ GripperDefinition,
7
+ GripperModel,
8
+ )
9
+
10
+ GRIPPER_DEF = json.loads(load_shared_data("gripper/definitions/1/gripperV1.json"))
11
+
12
+
13
+ def test_gripper_definition() -> None:
14
+ gripper_def = gripper.load_definition(GripperModel.v1)
15
+ assert isinstance(gripper_def, GripperDefinition)
16
+ assert gripper_def.schema_version == 1
17
+
18
+
19
+ def test_gripper_definition_type() -> None:
20
+ assert GripperDefinition.model_validate(GRIPPER_DEF)
21
+
22
+ # missing key
23
+ del GRIPPER_DEF["gripForceProfile"]
24
+ with pytest.raises(ValidationError):
25
+ assert GripperDefinition.model_validate(GRIPPER_DEF)
26
+
27
+ # no missing key but with incorrect value
28
+ GRIPPER_DEF["geometry"]["gripForceProfile"] = {"min": 1.0, "max": "0.0"}
29
+ with pytest.raises(ValidationError):
30
+ assert GripperDefinition.model_validate(GRIPPER_DEF)
@@ -0,0 +1,19 @@
1
+ import json
2
+ from opentrons_shared_data.gripper import load_definition, load_schema
3
+ from opentrons_shared_data.gripper.gripper_definition import (
4
+ GripperModel,
5
+ GripperDefinition,
6
+ )
7
+ from opentrons_shared_data import load_shared_data
8
+
9
+
10
+ def test_load_schema() -> None:
11
+ assert load_schema(1) == json.loads(load_shared_data("gripper/schemas/1.json"))
12
+
13
+
14
+ def test_load_definition() -> None:
15
+ gripper_def = load_definition(GripperModel.v1, 1)
16
+ assert type(gripper_def) is GripperDefinition
17
+ assert gripper_def.model == GripperModel.v1
18
+ assert gripper_def.grip_force_profile.default_grip_force == 15
19
+ assert gripper_def.geometry.base_offset_from_mount == (19.5, -74.325, -94.825)
@@ -0,0 +1,13 @@
1
+ from typing import List, Tuple
2
+
3
+ from pathlib import Path
4
+
5
+
6
+ def get_ot_defs(schema: int) -> List[Tuple[str, int]]:
7
+ def_files = (
8
+ Path(__file__).parent / ".." / ".." / "labware" / "definitions" / str(schema)
9
+ ).glob("**/*.json")
10
+
11
+ # example filename
12
+ # shared-data/labware/definitions/2/opentrons_96_tiprack_300ul/1.json
13
+ return [(f.parent.name, int(f.stem)) for f in def_files]
@@ -0,0 +1,80 @@
1
+ """Test that our bindings can validate and parse our standard labware definitions."""
2
+
3
+ from typing import Literal
4
+
5
+ import pytest
6
+ import typeguard
7
+ import pydantic
8
+
9
+ from opentrons_shared_data.labware import load_definition
10
+ from opentrons_shared_data.labware.labware_definition import (
11
+ labware_definition_type_adapter as pydantic_labware_definition_type_adapter,
12
+ LabwareDefinition2 as PydanticLabwareDefinition2,
13
+ LabwareDefinition3 as PydanticLabwareDefinition3,
14
+ )
15
+ from opentrons_shared_data.labware.types import (
16
+ LabwareDefinition as TypedDictLabwareDefinition,
17
+ LabwareDefinition2 as TypedDictLabwareDefinition2,
18
+ LabwareDefinition3 as TypedDictLabwareDefinition3,
19
+ )
20
+
21
+
22
+ from . import get_ot_defs
23
+
24
+
25
+ @pytest.mark.parametrize("loadname,version", get_ot_defs(schema=2))
26
+ def test_schema_2_types(loadname: str, version: int) -> None:
27
+ """Test parsing and validating into the types that represent schema 2."""
28
+ defdict = load_definition(loadname, version, schema=2)
29
+
30
+ typeguard.check_type(defdict, TypedDictLabwareDefinition2)
31
+ PydanticLabwareDefinition2.model_validate(defdict)
32
+
33
+
34
+ @pytest.mark.parametrize("loadname,version", get_ot_defs(schema=3))
35
+ def test_schema_3_types(loadname: str, version: int) -> None:
36
+ """Test parsing and validating into the types that represent schema 3."""
37
+ defdict = load_definition(loadname, version, schema=3)
38
+
39
+ typeguard.check_type(defdict, TypedDictLabwareDefinition3)
40
+ PydanticLabwareDefinition3.model_validate(defdict)
41
+
42
+
43
+ @pytest.mark.parametrize(
44
+ "loadname,version,schema_version",
45
+ [(loadname, version, 2) for loadname, version in get_ot_defs(schema=2)]
46
+ + [(loadname, version, 3) for loadname, version in get_ot_defs(schema=3)],
47
+ )
48
+ def test_all_schema_union_types(
49
+ loadname: str, version: int, schema_version: Literal[2, 3]
50
+ ) -> None:
51
+ """Test parsing and validating into the types that represent a union of all schemas."""
52
+ defdict = load_definition(
53
+ loadname=loadname,
54
+ version=version,
55
+ schema=schema_version,
56
+ )
57
+
58
+ typeguard.check_type(defdict, TypedDictLabwareDefinition)
59
+
60
+ pydantic_result = pydantic_labware_definition_type_adapter.validate_python(defdict)
61
+ expected_result_type = (
62
+ PydanticLabwareDefinition2
63
+ if schema_version == 2
64
+ else PydanticLabwareDefinition3
65
+ )
66
+ assert isinstance(pydantic_result, expected_result_type)
67
+
68
+
69
+ def test_loadname_regex_applied() -> None:
70
+ defdict = load_definition(*get_ot_defs(schema=2)[0])
71
+ defdict["parameters"]["loadName"] = "ALSJHDAKJLA"
72
+ with pytest.raises(pydantic.ValidationError):
73
+ PydanticLabwareDefinition2.model_validate(defdict)
74
+
75
+
76
+ def test_namespace_regex_applied() -> None:
77
+ defdict = load_definition(*get_ot_defs(schema=2)[0])
78
+ defdict["namespace"] = "ALSJHDAKJLA"
79
+ with pytest.raises(pydantic.ValidationError):
80
+ PydanticLabwareDefinition2.model_validate(defdict)
File without changes
@@ -0,0 +1,59 @@
1
+ """Tests for the default values in built-in liquid class definitions."""
2
+ import pytest
3
+ from typing import List
4
+
5
+ from opentrons_shared_data import get_shared_data_root
6
+ from opentrons_shared_data.liquid_classes import load_definition
7
+
8
+
9
+ def _get_all_liquid_classes() -> List[str]:
10
+ return [
11
+ deffile.stem
12
+ for deffile in (
13
+ get_shared_data_root() / "liquid-class" / "definitions" / "1"
14
+ ).iterdir()
15
+ ]
16
+
17
+
18
+ @pytest.mark.parametrize("liquid_class_name", list(_get_all_liquid_classes()))
19
+ def test_correction_values_equal_each_other(liquid_class_name: str) -> None:
20
+ """The correction volume values for each pipette/tiprack combo should all be equal to one another."""
21
+ liquid_class_def = load_definition(liquid_class_name, version=1, schema_version=1)
22
+ incorrect_combos = []
23
+ for by_pipette in liquid_class_def.byPipette:
24
+ for liquid_class_props in by_pipette.byTipType:
25
+ if liquid_class_props.multiDispense is None:
26
+ continue
27
+ aspirate_correction = liquid_class_props.aspirate.correctionByVolume
28
+ dispense_correction = liquid_class_props.singleDispense.correctionByVolume
29
+ multi_dispense_correction = (
30
+ liquid_class_props.multiDispense.correctionByVolume
31
+ )
32
+ if (
33
+ aspirate_correction != dispense_correction
34
+ or dispense_correction != multi_dispense_correction
35
+ ):
36
+ incorrect_combos.append(
37
+ f"{by_pipette.pipetteModel} {liquid_class_props.tiprack}"
38
+ )
39
+ assert incorrect_combos == []
40
+
41
+
42
+ @pytest.mark.parametrize("liquid_class_name", list(_get_all_liquid_classes()))
43
+ def test_flow_rates_equal_each_other(liquid_class_name: str) -> None:
44
+ """The dispense flow rate values for each pipette/tiprack combo should all be equal to one another."""
45
+ liquid_class_def = load_definition(liquid_class_name, version=1, schema_version=1)
46
+ incorrect_combos = []
47
+ for by_pipette in liquid_class_def.byPipette:
48
+ for liquid_class_props in by_pipette.byTipType:
49
+ if liquid_class_props.multiDispense is None:
50
+ continue
51
+ dispense_flow_rates = liquid_class_props.singleDispense.flowRateByVolume
52
+ multi_dispense_flow_rates = (
53
+ liquid_class_props.multiDispense.flowRateByVolume
54
+ )
55
+ if dispense_flow_rates != multi_dispense_flow_rates:
56
+ incorrect_combos.append(
57
+ f"{by_pipette.pipetteModel} {liquid_class_props.tiprack}"
58
+ )
59
+ assert incorrect_combos == []
@@ -0,0 +1,45 @@
1
+ import json
2
+
3
+ from opentrons_shared_data import load_shared_data
4
+ from opentrons_shared_data.liquid_classes import load_definition, definition_exists
5
+ from opentrons_shared_data.liquid_classes.liquid_class_definition import (
6
+ LiquidClassSchemaV1,
7
+ PositionReference,
8
+ Coordinate,
9
+ TipPosition,
10
+ Submerge,
11
+ DelayParams,
12
+ DelayProperties,
13
+ )
14
+
15
+
16
+ def test_load_liquid_class_schema_v1() -> None:
17
+ fixture_data = load_shared_data("liquid-class/definitions/1/water/1.json")
18
+ liquid_class_model = LiquidClassSchemaV1.model_validate_json(fixture_data)
19
+ liquid_class_def_from_model = json.loads(
20
+ liquid_class_model.model_dump_json(exclude_unset=True)
21
+ )
22
+ expected_liquid_class_def = json.loads(fixture_data)
23
+ assert liquid_class_def_from_model == expected_liquid_class_def
24
+
25
+
26
+ def test_load_definition() -> None:
27
+ water_definition = load_definition(name="water", version=1, schema_version=1)
28
+ assert type(water_definition) is LiquidClassSchemaV1
29
+ assert water_definition.byPipette[0].pipetteModel == "flex_1channel_50"
30
+ assert water_definition.byPipette[0].byTipType[0].aspirate.submerge == Submerge(
31
+ startPosition=TipPosition(
32
+ positionReference=PositionReference.WELL_TOP,
33
+ offset=Coordinate(x=0, y=0, z=2),
34
+ ),
35
+ speed=100,
36
+ delay=DelayProperties(enable=False, params=DelayParams(duration=0)),
37
+ )
38
+
39
+
40
+ def test_definition_exists() -> None:
41
+ """Should return whether specified definition exists in shared data or not."""
42
+ assert definition_exists(name="water", version=1) is True
43
+ assert definition_exists(name="glycerol_50", version=1) is True
44
+ assert definition_exists(name="glycerol_oh_no", version=1) is False
45
+ assert definition_exists(name="glycerol_50", version=2) is False