To see what needs to be set, (you could create a script file that sets these environment variables and then calls the Julia executable, and put that in your PATH) when you double-click on the.app file, it opens up a terminal and spits a bunch of text into it. As for browser and app support, well Pinboard offers its API to developers and they have made some of the best clients for Pinboard. You have dedicated extensions for Chrome, Safari, Firefox, and Edge. As for the apps, you have several clients for Android, iOS, Windows, and macOS.
In this tutorial we’ll be using py2app to create a standalone OSX application from a Python 2 or 3 source code with asimple Tkinter user interface.
'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.'
Relevant links about py2app:
- Source on BitBucket (last commit 2015-05-05)
- Issue Tracker, Mailing List
This guide is loosely based on the official tutorial.Based on a Python file called
Sandwich.py
, we’ll create an application called Sandwich.app
.Prerequisites
Create a custom directory and create a virtualenv:
Now create a very simple Tkinter app with the filename
Sandwich.py
:This little app will look like this:
Install py2app
The original version of py2app has a bug due to a newer version of ModuleGraph. Imade a fork of the project and fixed this bug on Github.Install it with pip like this:
Create a setup.py
file
py2app includes
py2applet
, a helper which generates a setup.py file for you:This
setup.py
is a basic definition of the app:If your application uses some data files, like a JSON, text files or images, you should include them in DATA_FILES. For example:
Build the app for development and testing
py2app builds the standalone application based on the definition in
setup.py
.For testing and development, py2app provides an “alias mode”, which builds anapp with symbolic links to the development files:
This creates the following files and directories:
This is not a standalone application, and the applications built in alias mode are not portable to other machines!
The app built with alias mode simply references the original code files, so any changes you make to the original
Sandwich.py
file are instantly available on the next app start.The resulting development app in
dist/Sandwich.app
can be opened just like any other .app with the Finderor the open command ($ open dist/Sandwich.app
). To run your application directly from the Terminalyou can just run:Building for deployment
When everything is tested you can produce a build for deployment with a calling
python setup.py py2app
. Make sure that any old build
and dist
directories are removed:This will assemble your application as
dist/Sandwich.app
. Since this application is self-contained, you will have to run the py2app command again any time you change any source code, data files, options, etc.The original py2app has a bug which would display “
AttributeError: 'ModuleGraph' object has no attribute 'scan_code'
” or load_module
. If you encounter this error, takea look at this StackOverflow thread or use my fork of py2app.The easiest way to wrap your application up for distribution at this point is simply to right-click the application from Finder and choose “Create Archive”.
Adding an icon
Simply add
'iconfile': 'youricon.icns'
to the OPTIONS
dict:You can find free icons in icns format around the web (eg. on IconFinder or freepik).
Advanced app settings
You can tweak the application information and behaviour with modificationsto the
Info.plist
. The most complete reference for the keys available is Apple’s Runtime Configuration Guidelines.Here is an example with more modifications:
With these settings, the app will have the following infos:
References
- py2app documentation, examples
- Tkinter, Tkinter resource collection, An Introduction to Tkinter
See Also
- PyInstaller - Another tool to create cross-platform standalone apps (libraries like PyQt, Django or matplotlib are fully supported)
- rumps - Ridiculously Uncomplicated Mac OS X Python Statusbar Apps
- py2exe - same as py2app but for Windows .exe files
- cx_Freeze - Another packager to create Windows .exe files
If you have suggestions, feedback or ideas, please reach out to me @metachris.
Create Standalone Application from MATLAB
Supported Platform: Windows®, Linux®, macOS
This example shows how to use MATLAB® Compiler™ to package the pre-written function that prints a magic square to the command prompt of a computer. The target system does not require a licensed copy of MATLAB to run the application.
You can create standalone applications using any of the following options::
- Use the Application Compiler app. Using this option produces an installer that installs both the standalone application and all required dependencies on a target system.
- Use the
compiler.build.standaloneApplication
function. This function produces a standalone executable that does not include MATLAB Runtime or an installer. To package the files and create an installer, usecompiler.package.installer
. - Use the
mcc
command. This command produces a standalone executable that does not include MATLAB Runtime or an installer. To package the files and create an installer, usecompiler.package.installer
.
Note
The file extension varies depending on the platform on which the installer was generated.
Create Function in MATLAB
In MATLAB, examine the MATLAB code that you want deployed as a standalone application. For this example, open
magicsquare.m
located in matlabroot
externexamplescompiler
.At the MATLAB command prompt, enter
magicsquare(5)
.The output is:
Create Standalone Application Using Application Compiler App
- On the MATLAB Apps tab, on the far right of the Apps section, click the arrow. In Application Deployment, click Application Compiler.Alternately, you can open the Application Compiler app by entering
applicationCompiler
at the MATLAB prompt. - In the MATLAB Compiler project window, specify the main file of the MATLAB application that you want to deploy.
- In the Main File section of the toolstrip, click .
- In the Add Files window, browse to
, and selectmatlabroot
externexamplescompilermagicsquare.m
. Click .The functionmagicsquare.m
is added to the list of main files.
- Decide whether to include the MATLAB Runtime installer in the generated application by selecting one of the two options in the Packaging Options section:
- Runtime downloaded from web — Generates an installer that downloads the MATLAB Runtime and installs it along with the deployed MATLAB application.
- Runtime included in package — Generates an installer that includes the MATLAB Runtime installer.
- Customize the packaged application and its appearance:
- Application information — Editable information about the deployed application. You can also customize the standalone applications appearance by changing the application icon and splash screen. The generated installer uses this information to populate the installed application metadata. See Customize the Installer.
- Command line input type options — Selection of input data types for the standalone application. For more information, see Determine Data Type of Command-Line Input (For Packaging Standalone Applications Only).
- Additional installer options — Edit the default installation path for the generated installer and selecting custom logo. See Change the Installation Path .
- Files required for your application to run — Additional files required by the generated application to run. These files are included in the generated application installer. See Manage Required Files in Compiler Project.
- Files installed for your end user — Files that are installed with your application. These files include:
- Generated
readme.txt
- Generated executable for the target platform
See Specify Files to Install with Application. - Additional runtime settings — Platform-specific options for controlling the generated executable. See Additional Runtime Settings.CautionOn Windows operating systems, when creating a console only application, uncheck the box Do not display the Windows Command Shell (console) for execution. By default this box is checked. If the box is left checked, output from your console only application is not displayed. Since this example is a console only application, the box must be unchecked.
- To generate the packaged application, click .In the Save Project dialog box, specify the location to save the project.
- In the Package dialog box, verify that Open output folder when process completes is selected.When the packaging process is complete, examine the generated output.
- Three folders are generated in the target folder location:
for_redistribution
,for_redistribution_files_only
, andfor_testing
.For further information about the files generated in these folders, see Files Generated After Packaging MATLAB Functions. PackagingLog.html
— Log file generated by MATLAB Compiler.
Create Standalone Application Using the compiler.build.standaloneApplication
Function
Note
If you have already created a standalone application using the Application Compiler app, you can skip this section. However, if you want to know how to create a standalone application from the MATLAB command prompt using a programmatic approach, follow these instructions.
- Build the standalone application using the
compiler.build.standaloneApplication
function.Information about the build type, included files, and build options are saved to thecompiler.build.Results
objectbuildResults
. - The following files are generated within a folder named
magicsquarestandaloneApplication
in your current working directory:magicsquare.exe
ormymagic.sh
—Executable file that has the.exe
extension if compiled on a Windows system or the.sh
extension if compiled on Linux or macOS.mccExcludedFiles.log
—Log file that contains a list of any toolbox functions that were not included in the application. Best note keeping apps for mac windows 10. For more information on non-supported functions, see MATLAB Compiler Limitations.readme.txt
—Readme file that contains information on deployment prerequisites and the list of files to package for deployment.requiredMCRProducts.txt
—Text file that contains product IDs of products required by MATLAB Runtime to run the application.
- Additional options can be specified as one or more comma-separated pairs of name-value arguments in the
compiler.build
command.'AdditionalFiles'
— Path to additional files to be included in the standalone application.'AutoDetectDataFiles'
— Flag to automatically include data files.'CustomHelpTextFile'
— Path to a help file containing help text for the end user of the application.'EmbedArchive'
— Flag to embed the standalone archive in the generated executable.'ExecutableIcon'
— Path to a custom icon image.'ExecutableName'
— Name of the generated application.'ExecutableSplashScreen'
— Path to a custom splash screen image.'ExecutableVersion'
— System-level version of the generated application. This is only used on Windows. https://newwebdesign683.weebly.com/best-video-crop-app-mac.html.'OutputDirectory'
— Path to the output directory where the build files are saved.'TreatInputsAsNumeric'
— Flag to interpret command line inputs as numeric MATLAB doubles.'Verbose'
— Flag to display progress information indicating compiler output during the build process.
- Create an installer by passing the
compiler.build.Results
objectbuildResults
as an input argument to thecompiler.package.installer
function.This creates a new folder containing the installer.
Install Standalone Application
- If you created an installer using the Application Compiler App, you can install the standalone application by double-clicking the
MyAppInstaller_web
executable in thefor_redistribution
folder.NoteThe file extension varies depending on the platform on which the installer was generated. - If you want to connect to the Internet using a proxy server, click . Enter the proxy server settings in the provided window. Click .To complete installation, follow the instructions on the user interface.NoteOn Linux and Mac OS X, you do not have the option of adding a desktop shortcut.
- To run your standalone application: How to remove apps on my mac.
- Open a terminal window.
- Navigate to the folder into which you installed the application.If you accepted the default settings, you can find the folder in one of the following locations:
Windows C:Program Filesmagicsquare
macOS /Applications/magicsquare
Linux /usr/magicsquare
Julia Compile Macos App Windows 10
Run Standalone Application
Run the application using one of the following commands:
Windows | applicationmagicsquare 5 |
macOS | First, set the DYLD_LIBRARY_PATH environment variable in the Terminal window from where you want to execute the application.$export DYLD_LIBRARY_PATH = MATLAB_RUNTIME_INSTALL_DIR/v99/runtime/maci64:MATLAB_RUNTIME_INSTALL_DIR/v99/sys/os/maci64:MATLAB_RUNTIME_INSTALL_DIR/v99/bin/maci64 Now run the application: ./ magicsquare.app/Contents/macOS/magicsquare 5 |
Linux | ./ magicsquare 5 |
Julia Compile Macos App Installer
A 5-by-5 magic square is displayed in the console:
See Also
applicationCompiler
| compiler.build.standaloneApplication
| compiler.build.standaloneWindowsApplication
| compiler.package.installer
| deploytool
| mcc