4 ms·
Creating standalone Mac OS X applications with Python and py2app
- legulere 11y agoIf I see correctly this is using python 2?
- gamesbrainiac 11y agoYup, has a `from __future__ import print_function` in one of the examples in the bitbucket repository.
- metachris 11y agopy2app has experimental support for Python 3. I've just tested it with a simple Python 3 tkinter interface and it works just fine!
- Loic 11y agoIf you want to package your Python application, you should really take a look at PyInstaller[0]. I have been using it for years with great success. [0]: http://www.pyinstaller.org/ http://www.pyinstaller.org/
- subnaught 11y agoThis looks great. There is also rumps[0] if you just need to create a status bar app from Python code. [0]: https://github.com/jaredks/rumps https://github.com/jaredks/rumps
- metachris 11y agoThanks, added a link to the post!
- makecheck 11y agoHow does this package layout interface with code signing and bundle IDs? My main project uses a custom-setup ".app" bundle on Mac OS X (combining both a pure Python front-end and C++ bindings) and I've found that it does require a bit of care to see correct behavior. For instance I found that El Capitán seems to really hate symbolic links now and will consider a code-sign tainted if there is an outside symbolic link (at least, for certain link destinations?). And I found, at least on older Mac versions, that system calls would sometimes think my application was Python and assume the Python bundle ID instead of my own, if I simply ran Python itself. Whereas, after I included a built binary directly in the MacOS folder that essentially says "int main(int argc, char* argv[]) { return Py_Main(argc, argv); }", it was fine. I wanted to run the system Python by reference and not bloat my executable; the call-Py_Main() approach worked well for that, too.
- metachris 11y agoThanks for the thought! I haven't tried it, but this post [1] describes a project that got everything to work with the Mac App Store. [1] http://dafoster.net/articles/2014/06/24/submitting-a-python-app-to-the-mac-app-store/ http://dafoster.net/articles/2014/06/24/submitting-a-python-...
- jsjohnst 11y agoDo you happen to have a repo for this app you speak of? Would love to take a look!
- makecheck 11y agoYep. :) It's "MacTerm": https://github.com/kmgrant/macterm The Python front-end is mostly here: https://github.com/kmgrant/macterm/tree/master/Build/Application/PythonCode The ".app" bundle layout is constructed as part of the build: https://github.com/kmgrant/macterm/blob/master/Build/GNUmakefile ...but basically it puts Python scripts and a Python-runner into "MacOS", and Python and C++ libraries into "Frameworks". You could also download the built ".app" to see the final layout. This is actually quite a bit simpler than it used to be. In the old days I was able to support both PowerPC and Intel, multiple versions of Python and about 6 different old Mac OS X versions in the same bundle. I still can't quite believe that it worked. :)
- jsjohnst 11y agoAwesome! Thanks for sharing, will definitely dig through this. :)
- pbreit 11y agoIs Slack's desktop app just a container for web-based technologies? Is it's iOS app pure native or is it also built with web technologies?
- mmastrac 11y agoNo idea why you are getting downvoted -- Slack for OSX is built on Electron AFAIK. http://electron.atom.io/ http://electron.atom.io/
- personjerry 11y agoJust a reminder that this is a wrapper for the python app and not a compiler, hence someone can easily dig through the app and get your Python code.
- deleted 11y ago[deleted]