Build Python extenstion

Hello everyone!

I am working on a python extension, which I would like to make easily shareable only with people from my lab. Ideally, I would like to use Extension Manager’s “Install from file…” functionality. I don’t have any experience building apps, and I am a little confused by the extension build manual Extensions — 3D Slicer documentation.

My question is: do I need to build slicer first and then build the extension to be able to share it as a zip file? Or there is an easier way for a python-only extension?

Thank you!

If it’s python-only then it’s very easy to share your extension with others. Just share the folder (probably from a git checkout so that you can easily update) and then set the module path.

1 Like

Thank you for a quick answer. But if I want it to work as “Install from file”, then the steps are: build slicer → build module → zip it, correct?

Yes build Slicer, build extension and package extension is the correct steps.

For a python extension,

  • Installing using the additional module paths method will take similar time and number of steps for people in your lab compared to using the Extensions Manager to “Install from file”.
  • The additional module paths approach is quickest for you if users are on different platforms such as Windows, macOS or on Linux because you don’t have to build Slicer, build extension and package extension for each of the platforms.
  • The building method is also for compatibility with a specific version of Slicer and not for multiple versions like Slicer stable (5.4.0) and latest Slicer Preview (5.5.0-2023-11-20).
  • The above two points are things to consider if you plan on updating the extension frequently once people in your lab begin to use it as you should plan on how you will distribute updates to them.