ARCANE NECTAR Mac OS

Apple then announced that the next official Apple OS for the Mac would be derived from NeXTSTEP/OPENSTEP. It was finally released as a public beta in 2000 as Mac OS X. At the same time in 2000, the core elements were released as open source as Darwin under the Apple Public Source License. The Cocoa and Carbon frameworks in particular, as well. You can find them by navigating to an arcane folder deep within the bowels of your Mac. Just click on an open part of your desktop and mouse up to the bar at the top of your screen. Click on Go, and in the drop-down menu, click on Go to Folder.

The open source Qt development toolkit is a popular choice for cross-platform development. It provides native-looking widgets and tight integration with the underlying platform on Windows, Linux, and Mac OS X. Qt applications that are written in C++ are easy to compile and deploy across all three platforms, but what if you don't like C++? I prefer Python, a dynamic programming language with a richly expressive syntax and exceptionally powerful support for introspection.

Fortunately, there are cross-platform Python bindings for Qt. The downside, however, is that packaging PyQt applications so that they can be deployed to users on Windows and Mac OS X is an immensely frustrating and arcane process. I declared victory last week after spending several hours battling with MacPorts and distutils. Now that I have unlocked the toolkit's dark mysteries, I can show you the hidden secrets that will allow you to achieve mastery of the alchemical art of cross-platform PyQt application deployment.

First, you'll need access to each platform for which you want to build redistributable packages. The easiest way to accomplish this is to use a Mac and either triple-boot or virtualize Windows and Linux. The initial setup process for Mac OS X will require a lot of very heavy compilation, so you are going to be in for a world of pain and a very long wait if you try to do this on a Mac mini.

My test application

Arcane nectar mac os download

My computing environment is a quad core Mac Pro configured to dual-boot OS X and openSUSE 11.1. For Windows, I'm running XP in VirtualBox. I do most of my actual development in Linux, but you can do it pretty comfortably on any of the platforms.

My test application, which I call Orbital Liftr, is a simple utility that I made for batch uploading graphics to Ars Technica's content management system. The Ars CMS is built on Movable Type, which means that it supports the MetaWeblog XML-RPC API, and my app lets you upload images to any standard Movable Type or WordPress blog that supports the API. The app has a few simple features like support for receiving images via drag-and-drop, and it can proportionally resize them before uploading.

The program consists of one module of Python code which contains the application logic and a few basic user interface forms that I made with the Qt Designer program. I have published the complete source code of the program on Launchpad. You can use it to follow along with this tutorial, or you can use your own code.

Advertisement

PyQt on Windows

To build a distributable PyQt package for Windows, you first need to set up a working PyQt execution environment. Start by downloading and installing the standard Qt SDK from the Qt Software website. Next, you will need to install Python 2.6.1. Use the binary installer for Windows from the Python website.

The next step is installing the Python bindings, which can be obtained from the download page at the PyQt website. You'll want to get the Windows installer that is compatible with Python 2.6; it's listed at the bottom of the Binary Packages section.

Arcane Nectar Mac Os X

These components should be enough to give you a fully functional environment for running PyQt applications. You can test it by making a simple PyQt application with a few widgets in a single .pyw file. If your PyQt environment installed correctly, you should be able to run the program by double-clicking the .pyw file in the file manager. There are several example scripts that come bundled with the PyQt installation. These can be found in the site-packagesPyQt4examples folder.

Now that you have a working PyQt environment, you need to package up the application so that you can distribute it to users and make it possible for them to run it without having to install all of the dependencies. This is done with a utility called py2exe that leverages Python's distutils framework. An installer for py2exe is available from the SourceForge website.

You will need to adapt your setup.py script so that it can provide proper instructions to py2exe. If your program is simple and you already know how to use distutils, this shouldn't be terribly hard. The following example shows my setup.py file:

Most of that is pretty much standard distutils. The last two lines were added to accommodate py2exe. The 'windows' parameter specifies the script that py2exe should use to launch the actual program. As you can see, for a simple program that is being ported from Linux, it's the same thing that you already have in your 'scripts' parameter.

The 'options' parameter allows you to pass specific instructions to py2exe. For PyQt applications, you will need to tell it to include sip, a fundamental component of the PyQt binding system.

Advertisement NECTAR

The py2exe tool will typically compress all of your required Python library modules into a single zip file in order to reduce space and keep your redistributable package clean. I disable that with the skip_archive option. My program dynamically loads the user interface description XML files at runtime, but it can't read those files when they are bundled up in the zip archive.

When you are building PyQt applications with py2exe, you need to either statically generate your user interface modules from the XML description files in advance, disable archiving with the skip_archive option, or structure your program so that the UI files will not end up in the archive.

After you finish making your setup.py script, you can build your redistributable package by running it from the command line:

Arcane Nectar Mac Os Catalina

The terminal will display a lot of messages as it byte-compiles your modules and copies all of the necessary dll files and other dependency components. The automated setup process will take place in the 'build' directory and everything that your users need will be copied into the 'dist' directory. If the script won't execute, make sure that Python is in your PATH environment variable.

To deploy your application to users, ship them everything that is in the 'dist' directory. This adds up to roughly 25 MB for a simple program. It includes the executable and all of the runtime dependencies, which means that users will be able to run the program without having to install the other components.

You can just zip it up and ship it out that way, but it will be more convenient for your users if you give them a single self-standing executable with a standard installer wizard. A lot of PyQt developers seem to like Inno Setup, a free installer maker.

Although your users will not have to manually install Qt or the PyQt bindings, they might still have to install the VC++ 2008 Redistributable Package. This package is available directly from Microsoft.

Deploying PyQt on Windows works reasonably well. Inno Setup uses good compression, so you can get your final package down to an acceptable size and make it easy for users to install. The biggest challenge is getting py2exe to deal appropriately with certain kinds of corner cases.

If your application is complex or structured in an unusual way, you might run into problems. For example, py2exe doesn't respect the distutils package_data option. There are a few workarounds for problems of that nature, and you can get more details about py2exe from the project's website.

I have been wrestling recently with a series of self-imposed requirements that sprang from two personal needs; the first being the development of “sane” native tools and libraries for manipulating Raspberry Pi 3 built-in peripherals (GPIO being at the top of my list), and the second being a way to find a common language and framework that would work across multiple operating systems, those operating systems being Arch Linux ARM, Mac OS X, and Windows 10. And a web framework would be really nice to have because I’m really getting tired of having to use ssh all the time.

Arcane Nectar Mac Os 11

So I did a bit of research and decided to focus on Python, specifically version 3.5 and later. That version of Python is available across all those platforms, and appears to work equally well across them. That means that trivial and not-so-trivial Python applications that aren’t platform specific work equally well across all three. That means I can do a good deal of work on either my Samsung running Windows 10 or my MBP, which includes debugging. I would then transfer the code over to the RPi3 and do final integration there.

The problem I ran into was the choice of a Python web framework. For reasons I won’t go into here I decided to install and learn how to use Django. I’ve successfully followed the getting started tutorials on both the MBP and the Samsung. On the MBP I’ve used Homebrew to install a number of up-to-date software tools, specifically Python 3.5, while on Windows I downloaded and installed Python 3.5 from the Python site. The only comments I have to make about installing Python on Windows 10 are these:

  • Install Python at the root of the C: drive (i.e. C:Python3.5, for example). This makes the path to Python a lot shorter than where the default is, somewhere in your private user area.
  • Assuming you installed Python in C:Python3.5 (for example) you should also add the Python Scripts folder to the path, i.e. C:Python3.5Scripts. This will put pip and django-admin in the path and make the instructions for using both the same as under Linux and Mac OS X. I don’t know why the tutorial instructions didn’t point this out.

Arcane Nectar Mac Os Download

As I said, running the Django utilities works just fine on Mac OS X and Windows 10. Getting Django installed on Arch Linux ARM doesn’t work, either as a pacman package or via pip. There is no package for ARM Arch, and even though the pip install seems to work, trying to create a default site with django-admin on Arch ARM fails, with django-admin complaining there is no django.core. This makes the second major framework failure I’ve run into under Arch ARM, the first being the failure of Express under Node.js. The Express failure was particularly annoying, as it worked about a year ago when I was investigating Express and Node.js on the Raspberry Pi 2. If anything, these failures have proven that the Raspberry Pi 3, at least under Arch Linux ARM, is not the full first-class client that regular installations are.

I suppose I could be a hero (to someone) if I could find and fix the problems I’ve run into on the Raspberry Pi 3, but I don’t feel particularly heroic. I’e gone down multiple paths now with trying to build a full stack of software with a web front end on the RPi 3, and it’s not gone well. One reason for doing the same types of activities on a “regular” computer is to see if the tutorials are repeatable, and they are. It’s trying to move over to the RPi 3 with Arch Linux where it breaks down.

Perhaps it’s time to realize that if I want a better development experience that I need to spend more money and buy a more commercial system than the Raspberry.

As for where the title came from, here it is:

Life’s but a walking shadow, a poor player
That struts and frets his hour upon the stage
And then is heard no more: it is a tale
Told by an idiot, full of sound and fury,
Signifying nothing.
Macbeth, Act 5, Scene 5

The quote about life could just as easily apply to software development.