Creating a React App Introduction. React is a user interface framework developed by Facebook. It has a quickly growing developer adoption rate and was ranked as the most loved web framework in the 2019 Stack Overflow developer survey. You can interactively create an app project with Run Shell Script action, then paste in your script in its editor, select your shell program (/usr/bin/python), finally save the project. And you have yourself a Mac native app. Automator can also be driven by AppleScript. So you can pipeline this py-2-app conversion process to your build scripts.

  1. Making A Python App
  2. Simple Python Web App
  3. How To Create A Mac App With Python

Do you want to share a Python script to a friend that doesn’t have Python installed? In this post you’ll learn how 🙂

With the py2app package you can compile a Python script and create a portable Mac application. If you’re using windows, you can check py2exe.

First of all, we need to install the py2app python package. If you have a virtual environment, activate it now 🙂

Next, we need to create a setup.py file for our project. In your working directory (the one that contains your Python script), type:

This will create the file setup.py, which is responsible to tell setuptools how to build your application.

If you edit this file, you should see something like:

$./dist/application_name.app/Contents/MacOS/application_name

or you can find your application in Finder and open it from there (you’ll find it in dist/application_name).

Once your application is running, we are ready to create the stand alone version. First remove the build and dist folders with:

and next, build your application:

During the building process, I encounter some problems with the ModuleGraph package (remember that this package is installed at the same time as py2app).

If you get one of the following errors:

myenv/lib/python2.7/site-packages/py2app/recipes/virtualenv.py
How To Create A Mac App With Pytho

Look for the functions scan_code or load_module and add it an underscore before them, _scan_code and _load_module. Build again your application, it should work now 🙂

Next, try to run your app, and see if it works.

If you get errors with external packages, like certificates with httplib2 or requests, missing files in selenium webdriver, or import errors that normally work, you’ll have to fully include these packages in your application. Edit again the setup.py file and add the package that raised the error: