fyears / electron-python-example

Electron as GUI of Python Applications
MIT License
2.04k stars 232 forks source link

Windows? Mac? #1

Closed dovy closed 8 years ago

dovy commented 8 years ago

Would this compile and run as a self-contained environment without the need of additional dependencies?

I am VERY interested in this approach, and am looking for a solid method of ensuring this is entirely cross-platform.

fyears commented 8 years ago

Hi @dovy ,

Good question! I believe there are no strict restriction. So my answer is surely "yes". I am sure yhat has successfully built a complex application using the same idea.

But as far as I am concerned, you have to solve these three aspects:

  1. Packaging python applications, in other words, packaging the python interpreter as well as your application. Something like pyinstaller should be what you want, but you always have to deal with some tricky details because of the dynamics of python.
  2. Correctly spawning python thread from node.js and correctly close it too. It seems to be a little different in Windows, Linux and OS X.
  3. Packaging electron. No problem, electron is designed for this usage. See here and there.
dovy commented 8 years ago

Indeed I think pyinstaller is the best, was just looking at that.

The question is honestly can I code most of this in Python, or should I just find C++ experts. My gut tells me Python is a MUCH better route. :P

  1. What type of dynamics that I may have to deal with are you speaking of. Want to do this correctly. ;)
  2. Any guidance here?
  3. That's why I'm using it. :P
fyears commented 8 years ago
  1. For example, import. pyinstaller may not be able to automatically detect all the sub-libraries your app needs. Another example is relative paths. There might be problems about correctly phrase relative paths under the packaging situation.
  2. I don't know. But I remember in some of my personal experiments, electron incorrectly spawn two python flask processes in the packaged version while correctly spawning one process in the unpackaged version! I didn't know why...
  3. :-)
dovy commented 8 years ago

Could we Skype/Slack/Email somewhere? I'd like to pick your brain in a less public space. :)

Skype: DovyDigital Slack: http://slack.redux.io Email: me@dovy.io