Python Make Macos App
Write your apps in Python and release them on iOS, Android, Windows, MacOS, Linux, Web, and tvOS using rich, native user interfaces. Multiple apps, one codebase, with a fully native user experience on every platform. Take the Tutorial I Want To Contribute Donate and Support Us! It supports Linux, Windows and macOS and works with Python 2.7+ as well as Python 3.4+. Kumar B on 28 Apr 2018 Permalink Among the above-mentioned tools, Tkinter is the easiest tool to develop GUI based interfaces.
Python & Mac OS Projects for $10 - $30. Hi, I have a Python code and I want to convert it into.app (Supported by MacOs). Code read some files from current directory. You can use py2app. Py2app - Create standalone Mac OS X applications with Python¶. Py2app is a Python setuptools command which will allow you to make standalone application bundles and plugins from Python scripts. Py2app is similar in purpose and design to py2exe for Windows. To run Python script on Mac you need to make sure you have Python already installed on your Mac OS X machine, go to Launchpad, search for the terminal and after you have opened it, type the following command. After the above command is executed on your Mac OS X, if everything goes fine, the following will come up. Make a file executable in Terminal on Mac. Shell scripts must be executable files in order to run. You can use the chmod command to indicate that the text file is executable (that is, its contents can be run as a shell script).
Table Of Contents
- Creating packages for OS X
- Using PyInstaller and Homebrew
- Additional Libraries
- Using the Kivy SDK
- To include other frameworks
- Using PyInstaller and Homebrew
Note
This guide describes multiple ways for packaging Kivy applications.Packaging with PyInstaller is recommended for general use.
This Linux media server software can be accessed from pretty much anywhere thanks to the inclusion of an easy to use web-based manager and several mobile and TV apps.Emby is free, but some of the features are only available to those who subscribe to its Premiere service. Emby server mac app won't open. Emby GUIThe software automatically converts all the content from your server to a format that’s supported by the devices you’re streaming to. Among other things, Emby can also be used to stream Live TV or different types of content via Chromecast and features both cloud sync and mobile sync. Emby also acts as a reliable media manager, allowing you to add and edit everything ranging from subtitles to metadata and images.
Using PyInstaller and Homebrew¶
Note
Package your app on the oldest OS X version you want to support.
Complete guide¶
Install Homebrew
Install Python:
Note
To use Python 3,
brewinstallpython3and replacepipwithpip3in the guide below.(Re)install your dependencies with
--build-bottleto make sure they canbe used on other machines:Note
If your project depends on GStreamer or other additional libraries(re)install them with
--build-bottleas describedbelow.Install Cython and Kivy:
Install PyInstaller:
Package your app using the path to your main.py:
Note
This will not yet copy additional image or sound files. You would need toadapt the created
.specfile for that.
Editing the spec file¶
The specs file is named touchtracer.spec and is located in the directorywhere you ran the pyinstaller command.
You need to change the COLLECT() call to add the data of touchtracer(touchtracer.kv, particle.png, …). Change the line to add a Tree()object. This Tree will search and add every file found in the touchtracerdirectory to your final package. Your COLLECT section should look somethinglike this:
This will add the required hooks so that PyInstaller gets the required Kivyfiles. We are done. Your spec is ready to be executed.
Build the spec and create a DMG¶
Open a console.
Go to the PyInstaller directory, and build the spec:
Run:
You will now have a Touchtracer.dmg available in the dist directory.
Fast File Sharing Web Server is a Mac file sharing software that allows visitors to upload/download unlimited files easily through a Web Browser (Safari, IE, Firefox, Chrome, mobile browser etc.). It can help you share files with your users, customers and partners. They can search for and download f. One of the powerful and strongest apps on the app store is Share Files for Mac which is holding the average rating of 5. This Share Files provides the current version 1.0.0 for Mac to install on your device. The installation number of the Share Files is 100+ This number proves how much favorable the Share Files is among the users. Share files app mac.
Additional Libraries¶
GStreamer¶
If your project depends on GStreamer:
Note
If your Project needs Ogg Vorbis support be sure to add the--with-libvorbis option to the command above.
If you are using Python from Homebrew you will also need the following stepuntil this pull requestgets merged:
Using PyInstaller without Homebrew¶
First install Kivy and its dependencies without using Homebrew as mentioned herehttp://kivy.org/docs/installation/installation.html#development-version.
Once you have kivy and its deps installed, you need to install PyInstaller.
Let’s assume we use a folder like testpackaging:
Create a file named touchtracer.spec in this directory and add the followingcode to it:
Change the paths with your relevant paths:
Then run the following command:
Replace touchtracer with your app where appropriate.This will give you a <yourapp>.app in the dist/ folder.
Using Buildozer¶
Note
Packaging Kivy applications with the following method must be done insideOS X, 32-bit platforms are no longer supported.
Edit the buildozer.spec and add the details for your app.Dependencies can be added to the requirements= section.
By default the kivy version specified in the requirements is ignored.
If you have a Kivy.app at /Applications/Kivy.app then that is used,for packaging. Otherwise the latest build from kivy.org using Kivymaster will be downloaded and used.
If you want to package for python 3.x.x simply download the packagenamed Kivy3.7z from the download section of kivy.org and extract itto Kivy.app in /Applications, then run:
Once the app is packaged, you might want to remove unneededpackages like gstreamer, if you don’t need video support.Same logic applies for other things you do not use, just reducethe package to its minimal state that is needed for the app to run.
Python Make Macos App Installer
As an example we are including the showcase example packaged usingthis method for both Python 2 (9.xMB) and 3 (15.xMB), you can find thepackages here:https://drive.google.com/drive/folders/0B1WO07-OL50_alFzSXJUajBFdnc .
That’s it. Enjoy!
Buildozer right now uses the Kivy SDK to package your app.If you want to control more details about your app than buildozercurrently offers then you can use the SDK directly, as detailed in thesection below.
Using the Kivy SDK¶
Note
Kivy.app is not available for download at the moment. For details,see this issue.
Note
Packaging Kivy applications with the following method must be done insideOS X, 32-bit platforms are no longer supported.
Since version 1.9.0, Kivy is released for the OS X platform in aself-contained, portable distribution.
Apps can be packaged and distributed with the Kivy SDK using the methoddescribed below, making it easier to include frameworks like SDL2 andGStreamer.
Make sure you have the unmodified Kivy SDK (Kivy.app) from the download page.
Run the following commands:
Note
This step above is important, you have to make sure to preserve the pathsand permissions. A command like cp-rf will copy but make the appunusable and lead to error later on.
Now all you need to do is to include your compiled app in the Kivy.appby running the following command:
Where <app_folder_name> is the name of your app.
This copies Kivy.app to <app_folder_name>.app and includes a compiled copyof your app into this package.
- That’s it, your self-contained package is ready to be deployed!You can now further customize your app as described bellow.
Installing modules¶
Kivy package on osx uses its own virtual env that is activated when you runyour app using kivy command.To install any module you need to install the module like so:
Where are the modules/files installed?¶
Inside the portable venv within the app at:
If you install a module that installs a binary for example like kivy-gardenThat binary will be only available from the venv above, as in after you do:
The garden lib will be only available when you activate this env.
To install binary files¶
Just copy the binary to the Kivy.app/Contents/Resources/venv/bin/ directory.
To include other frameworks¶
Kivy.app comes with SDL2 and Gstreamer frameworks provided.To include frameworks other than the ones provided do the following:
Do not forget to replace <Framework_name> with your framework.This tool osxrelocator essentially changes the path for thelibs in the framework such that they are relative to the executablewithin the .app, making the Framework portable with the .app.
Shrinking the app size¶
The app has a considerable size right now, however the unneeded parts can beremoved from the package.
For example if you don’t use GStreamer, simply remove it fromYourApp.app/Contents/Frameworks.Similarly you can remove the examples folder from/Applications/Kivy.app/Contents/Resources/kivy/examples/ or kivy/tools,kivy/docs etc.
This way the package can be made to only include the parts that are needed foryour app.
Adjust settings¶
Icons and other settings of your app can be changed by editingYourApp/Contents/info.plist to suit your needs.
Macos Python Pip
Create a DMG¶
To make a DMG of your app use the following command:
Note the lack of / at the end.This should give you a compressed dmg that will further shrink the size of yourdistributed app.
| « Kivy on Android | Create a package for IOS » |