Opentrons / opentrons

Software for writing protocols and running them on the Opentrons Flex and Opentrons OT-2
https://opentrons.com
Apache License 2.0
399 stars 175 forks source link

feat: Add a "Reimport" button to protocols in the Opentrons GUI #15484

Open warmsoymilk opened 2 weeks ago

warmsoymilk commented 2 weeks ago

Overview

Currently, when you change the code of a protocol file, you have to delete the protocol in the GUI and then import the protocol again. This is a fairly lengthy and annoying process.

I propose that a "reimport" button should be added to the protocol overflow menu (which has options such as "start setup", "reanalyze", "delete", etc.) which reimports the protocol from the same disk location that it was originally imported from.

This would alleviate a major pain point in the Opentrons protocol developer experience.

Implementation details

We already have the functionality to:

  1. delete a protocol, and
  2. import a protocol.

The proposed functionality would have to simply perform (1) and (2) in sequence.

If a protocol's import location on disk is not currently saved, it would have to be stored somewhere for this functionality to work.

Design

No response

Acceptance criteria

koji commented 2 weeks ago

@warmsoymilk thank you for your suggestion.

I'm not sure which version you are on. However, if you use 6.0+, you don't have to delete a protocol.

click overflow menu (3 dots button) -> show in folder you can modify the protocol you imported and reanalyze the protocol after modifying the protocol.

https://github.com/Opentrons/opentrons/assets/474225/2286bb24-c0a4-4437-a5e6-3b2797ae92e6

warmsoymilk commented 1 week ago

@koji Please see the attached screen recording where I show that reimporting the protocol (using Opentrons app version 7.2.2) is necessary to fully recapitulate changes made to the source script.

In particular, I show that when I add or remove raise Exception('') to run(), which should make the protocol analysis fail, I have to actually reimport test_protocol.py to see the change affect the outcome of the reanalysis.

Video: https://www.dropbox.com/scl/fi/0n6evxzihw8roy9g5x59c/Screen-Recording-2024-06-24-at-10.51.45-AM.mov?rlkey=9rrv1cpm96avj5wajgxkzj5lo&dl=0 (Upload is too large for GitHub)

koji commented 1 week ago

@warmsoymilk thank you for your response.

From the video you shared with me, you need to reimport an updated protocol because the file you edited and the protocol that the app analyzed were different.

When you import a protocol into app, your protocol is moved into /Users/your_user_name/Library/Application Support/Opentrons/protocols. The protocol folder has folders, and each folder has a protocol.

Show in folder in my video opens one of the protocol folders and the app analyzes that protocol file.

warmsoymilk commented 1 week ago

@koji I see, thanks. I think this workflow is cumbersome in the context of standard coding practices (for example, I try to use Git to manage my Python protocols), and so I think a "reimport" button would still be helpful, but thank you for pointing out that I can edit the Opentrons copy of the protocol directly.