Is it possible to package bokeh serve into an executable?

I can use “bokeh serve” to start a web server with python environment, I want to create a demo version of my web app and provide it to my customers so that they can run it in their computers offline, the customers’ computers don’t have python environment, also I don’t want to show the code to customers. Is it possible to package bokeh serve into an executable?

1 Like

Hi,

This is a question people have been asking for approximately as long as Python has existed. As near as I can tell, there are not any perfect solutions. You might look into py2exe:

  http://www.py2exe.org/

However, Bokeh is a big and complicated library, including having non-python components that are necessary in order to function. I have no information on whether py2exe would work "out of the box" or need some kind of specialized configuration or modification (or if it might not be able to work at all). There may be other tools, but I have no knowledge of them. This is not really a Bokeh-specific question, so you might have better luck asking elsewhere.

Regarding "obfuscating" code, pretty much the only simple option I know of is to compile the python files to .pyc files:

  python - How can I manually generate a .pyc file from a .py file - Stack Overflow

Then only ship the .pyc files to your clients. But please be aware, these are fairly trivially dis-assembleable into something resembling the original source, by anyone with motivation to do so. There may be other more esoteric tools or possibilities, but again I'd search wider, outside the Bokeh mailing list for information about that.

Thanks,

Bryan

···

On Mar 10, 2017, at 09:34, [email protected] wrote:

I can use "bokeh serve" to start a web server with python environment, I want to create a demo version of my web app and provide it to my customers so that they can run it in their computers offline, the customers' computers don't have python environment, also I don't want to show the code to customers. Is it possible to package bokeh serve into an executable?

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/fddbb33f-408b-41a6-932e-281dba7771a8%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

One additional approach to obscuring Python code that goes beyond .pyc files is using Cython to generate extensions. They don’t run any faster than the raw .py, but it’s a .so or .dll that is then harder to disassemble.​

-Peter

Hi, do you find any solution for this? i am trying to do the same thing as well.

···

On Friday, March 10, 2017 at 11:34:06 PM UTC+8, [email protected] wrote:

I can use “bokeh serve” to start a web server with python environment, I want to create a demo version of my web app and provide it to my customers so that they can run it in their computers offline, the customers’ computers don’t have python environment, also I don’t want to show the code to customers. Is it possible to package bokeh serve into an executable?

Hi,

People have have occasionally made issues/PRs to make changes around these "exe" tools, so there is some hope that things can work together:

  Issues · bokeh/bokeh · GitHub
  Pull requests · bokeh/bokeh · GitHub

So you will just have to try and see. You can embed bokeh as a library:

  Bokeh server — Bokeh 3.3.2 Documentation

Then use one of the various "exe makers": you can try: py2exe, pyInstaller, cx_Freeze. I don't ever use any of these tools, so I can't do more than point you in their direction.

Thanks,

Bryan

···

On Apr 9, 2019, at 9:39 PM, [email protected] wrote:

Hi, do you find any solution for this? i am trying to do the same thing as well.

On Friday, March 10, 2017 at 11:34:06 PM UTC+8, charley...@gmail.com wrote:
I can use "bokeh serve" to start a web server with python environment, I want to create a demo version of my web app and provide it to my customers so that they can run it in their computers offline, the customers' computers don't have python environment, also I don't want to show the code to customers. Is it possible to package bokeh serve into an executable?

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/598f932f-d9dd-488c-82c0-09bc5161701d%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.