# Semantic search for this forum

**URL:** <https://discourse.slicer.org/t/semantic-search-for-this-forum/34811>\
**Category:** Forum and website feedback\
**Created:** [March 10, 2024, 4:32pm UTC](https://discourse.slicer.org/t/semantic-search-for-this-forum/34811 "2024-03-10T16:32:39Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [April 29, 2024, 10:48pm UTC](https://discourse.slicer.org/t/semantic-search-for-this-forum/34811/7 "2024-04-29T22:48:14Z")

</div>

Here’s what the chatbot said in response to this question:

> [@Strategies for Distributing Python Programs Securely](https://discourse.slicer.org/t/strategies-for-distributing-python-programs-securely/35807):
>
> Hello all, I’m looking to develop a commercial program using a slicer. However, I’ve discovered that when I package and distribute this custom program, the source code remains exposed in the scripted model folder. After searching the community, I found a solution suggesting converting .py files to .pyc files for distribution. [https://discourse.slicer.org/t/how-to-hide-the-code-of-the-script-module/26135/16](https://discourse.slicer.org/t/how-to-hide-the-code-of-the-script-module/26135/16) Considering the time that has passed, is this still a viable option? Furthermore, I’m …

[claude\_3\_opus\_bot](https://discourse.slicer.org/u/claude_3_opus_bot)Forum Helper

[1m](https://discourse.slicer.org/t/untitled-ai-bot-pm/35822/2)

Search

Based on my search of the Slicer forum, it looks like converting .py files to .pyc files is still a reasonable approach for distributing Slicer extensions while hiding the original Python source code:

[How to hide the code of the script module?](https://discourse.slicer.org/t/how-to-hide-the-code-of-the-script-module/26135/13)

In that post from early 2024, it was suggested to write a short Python script that compiles your .py files to .pyc and then replaces the .py files with the .pyc files in your extension. This compilation step could be added to your extension’s build process in the CMake files.

Your plan to first encrypt the .py files using a tool like pyarmor before compiling to .pyc sounds reasonable and would add an extra layer of protection.

A few other tips gathered from that discussion:

- Make sure to remove any original .py files and just distribute the .pyc
- Consider using Cython to compile to C extensions for even more obfuscation
- Look at the Slicer source code itself for examples, as some of its Python is distributed as .pyc

So in summary, encrypting with pyarmor, compiling to .pyc, removing .py files, and potentially using Cython seems like a solid approach based on recent community discussions. Let me know if you have any other specific questions!

---

_[View the full topic](https://discourse.slicer.org/t/semantic-search-for-this-forum/34811)._
