Posts tagged with "python"

Pythonista 3.2 Syncs Scripts with iCloud, Supports Open-in-Place via iOS 11’s Files App

For a long time, Apple’s App Store review guidelines prohibited apps from downloading executable code from the Internet. The company’s original stance resulted in IDEs that couldn’t sync scripts and programs across multiple devices – a serious limitation for the emergent movement of programmers embracing the iPad Pro as a portable workstation.

Fortunately, Apple started relaxing their rules earlier this year, allowing “apps designed to teach, develop, or test executable code” to download and run code. Pythonista, the popular Python IDE for iOS (and one of the best pro apps for iOS, period), has been updated this week with the ability to sync scripts with iCloud and edit external scripts in-place using Files’ document picker.

As someone who used Pythonista heavily for years and remembers previous rejections based on old App Store guidelines, this is fantastic news. I moved my existing script library to iCloud, which means all my code is now shared between the iPhone and iPad – no workarounds required. Pythonista now supports the iPhone X and drag and drop for importing scripts, but, even better, the app can open scripts and edit them in-place (saving changes back to the original location) just by opening them with the built-in Files picker. This feature makes it possible to, say, use Pythonista as an editor for script files stored in GitHub repositories and managed by Working Copy – all entirely on iOS, and natively integrated with Files.

Version 3.2 of Pythonista gets rid of the most annoying limitations imposed by the old Apple, another sign that the company’s approach to professional iOS software has changed over the years. While I don’t use Pythonista nearly as much as I did a few years ago (you can imagine why), I plan on playing around with Pythonista 3.2 over the next couple of weeks.


Pythonista 2.0 Brings Action Extension, iPad Pro Support, Code Editor Improvements, and More

Back in the Fall of 2012, a few months after I had taken it upon myself to start moving all my work from OS X to iOS, I came across Ole Zorn’s Pythonista. A Python interpreter for iPhone and iPad that could natively integrate with iOS system features, Pythonista opened up a new world to me, demonstrating how I could automate tedious tasks on iOS devices via scripting. Since then, other apps have come along and shown how iOS tasks can be automated with visual interfaces and pre-packaged actions (above all, Workflow and Launch Center Pro), but Pythonista is, in many ways, the crown jewel of iOS automation and scripting for advanced users.

There’s nothing quite like Pythonista on iOS. As I’ve documented over the past three years, Ole Zorn has slowly but steadily extended the app’s capabilities with native ties to iOS interfaces via a UIKit bridge, support for location and the Reminders database, and even matplotlib and motion sensors. As it stands today, Pythonista is, by far, the richest and most powerful scripting app to integrate with native iOS features. Despite the variety of options now available for iOS automation and the continued evolution of iOS that cut down the number of tasks I need to automate (case in point: Split View and using two apps at once), I love keeping Pythonista around for key aspects of my workflow that can’t be automated in any other way.

For the past several months, I’ve been using version 2.0 of Pythonista on my iPhone and iPad, which, after a few rejections from Apple, has been approved and is launching today on the App Store. A free update for existing customers, Pythonista 2.0 brings a refreshed UI, support for the iPad Pro, new modules, and, more importantly, a redesigned code editor and an action extension.

Behind the scenes, Pythonista 2.0 has played an essential role in helping me assemble my reviews of iOS 9 and the iPad Pro, with an action extension I rely upon for all my image uploads, OCR, text statistics, and more.

Read more

Pythonista 1.5: Custom Interfaces, matplotlib, and No More “Open In”

Pythonista 1.5, the latest version of Ole Zorn’s Python interpreter for iOS, has been released today on the App Store, bringing new modules, native integrations, UI refinements, and the removal of the Open In feature to comply with Apple’s App Store guidelines. Pythonista 1.5 is another fantastic update to one of the most powerful and flexible iOS apps ever made, and it follows in the footsteps of Editorial 1.1, released last month.

Read more

How To Open iCloud Tabs In Editorial for iPad

Editorial iCloud Tabs

Editorial iCloud Tabs

I’ve always wanted to be able to access my iCloud Tabs directly from Editorial, but, unfortunately, due to the lack of an iCloud Tabs API, that’s currently not possible. Last week, however, when I linked to the iCloudTabs for Alfred project by Kevin Marchand and saw that the workflow was based on a bit of Python code, I realized that I could modify his script to find a way to make Editorial read constantly-updated iCloud Tabs from a text file.

What follows is a combination of a server-side script and an Editorial workflow to read and open iCloud Tabs within the app. The system works and I’ve been using it every day for the past week with good results.

Read more

My iOS Screenshot Generation Workflow



I didn’t think that complaining about iOS status bars on The Prompt would result in Dr. Drang going on a vision quest to produce better screenshots with Python. But I’m glad that I took the time to point out my dislike for messy status bars, because it led the good Doctor to work on some great scripts to automate the entire process with Python, which are compatible with Pythonista for iOS.

I waited to share my workflow for automated screenshot cleaning/generation because I wanted to see where Dr. Drang would end up with his script, Cleanbar. Now that he appears to have settled on a solution that requires standalone image files to act as partial status bar replacements, I think it’s the right time for me to share how I produce iPhone and iPad screenshots for MacStories.

The first step is to set up Cleanbar. I don’t need to repeat what Dr. Drang already explained, but to sum up: grab a black status bar, crop it to get two files similar to Drang’s, then run a script to pack those images as strings. Once set up, you’ll be able to a) use Cleanbar to clean single images picked from the Camera Roll with Pythonista and b) integrate it as cleanbar in other scripts to clean status bars programmatically.

As for my needs:

  • I usually need to combine two iPhone screenshots side-by-side in a single image as you can see in most reviews on this site;
  • I may or may not need to clean their status bars;
  • I don’t have to combine iPad screenshots. I only need to resize them and I may or may not have to clean their status bars;
  • Occasionally, I want to produce a banner with three screenshots (like this one), which can have original or cleaned status bars;
  • Sometimes, I only need to clean one screenshot out of two;
  • I always need to upload the final image to a Dropbox folder, which is monitored by Hazel.

And, because I’m not an animal, I wanted to automate all of this. The scripts that you’ll find below are the result of late night tweaking and lots of tests; they probably aren’t the most elegant or “Pythonic” way to handle this kind of image generation, but they work for me and they make me save several minutes every day. I haven’t been generating review screenshots manually in months, and they’re more flexible than my old workflow based on Keyboard Maestro.

Read more

Automate iOS Contacts, Location Services, and Open In Menu with Pythonista 1.4

Pythonista 1.4

Pythonista 1.4

Pythonista is the app that changed my iOS workflow a year ago. A Python interpreter with native access to iOS system features like photos, URLs, and interface elements, Pythonista allowed me to convert the scripts and macros that I was using on OS X to the iPad, automating iOS in better and sometimes unexpected ways. Pythonista eventually led to Editorial, also developed by Ole Zorn, which changed the way I write and work on my iPad every day.

Pythonista 1.4, available today on the App Store, is the biggest update to Zorn’s app to date. It includes a new UI for iOS 7 (the app is also iOS 7-only starting today), new modules and enhancements to existing ones, and, more importantly, it doubles down on iOS integration by bringing native support for contacts, location, and Open In. Read more

Getting App Prices with Editorial

Editorial workflow

Editorial workflow

When I write on my iPad mini, I often need to look up and reference price of apps that I already own. That’s a surprisingly hard thing to do on an iOS device, so I decided to remove the annoyance caused by this problem with an Editorial workflow. I call it “Get App Price”.

If you own an app, searching for it in the iOS 7 App Store won’t show you the price information alongside the app’s icon and description – you’ll only get an Open or Install button. Unlike the Mac App Store, there is no separate pricing field in the app information at the bottom of the screen, which usually forces me to go to a developer’s website to find out what the price of an app is.1 There wouldn’t be any problem if Apple allowed Safari to open iTunes web previews without redirecting them straight to the App Store, which is what they do on OS X. I have tried to force Safari to open web previews, and I even downloaded browsers that can set a modified user agent string to trick iOS into thinking they’re desktop web browsers worthy of a web preview – eventually, the App Store app always opened, displaying no price.

I set out to create a simple workflow to fetch an app’s title and price directly from iTunes with no clipboard import or other middleman. I later found out that you can tap on the “Related” tab in the App Store or gift an app to view its price, but I had already created a workflow that’s faster than opening the App Store and tapping a bunch of buttons just to get a price. I’m a free man, and I deserve my own App Store lookup solution.2

Read more

Fixing iOS Screenshot Status Bars with Python

Dr. Drang:

On last week’s episode of The Prompt, Federico went off on a rant about ugly iOS screenshots. He wasn’t complaining about the apps themselves being ugly, he was chastising those of us who post screenshots with status bars showing inconsistent times, signal strengths, and battery levels. And Lord help you if your battery icon is in the red.

His recommendation was Status Magic, a Mac app that cleans up the status bars in your iOS screenshots and makes them uniform. It looks like a nice app, but my thoughts gravitated toward a script using the Python Imaging Library. Why would I write a script when an inexpensive app is available?

Fixing iOS status bars is one of the reasons I need to use my Mac with Status Magic because there is no similar app on iOS. I am playing around with Dr. Drang’s script, which can be easily adapted to Pythonista and integrated with the app’s photos module for Camera Roll integration. Putting together status bar replacement images that match Apple’s ones is a bit of work (it’s tricky to get the fonts right, but now I’m trying this) and they won’t produce good results with blurred status bars, but those are the same inconveniences that iOS 7 brought to Status Magic anyway.

I’m looking forward to seeing what tweaks and improvements the Doctor will make to his script. Once I have a good solution for Pythonista (which I already use to combine screenshots on iOS), my iOS writing and editing workflow for text and screenshots will be largely similar to the OS X one (I still need a good uploader for Cloud Files and an iOS version of this).


Mirimage’s Editorial Workflows for Pocket and

Great demonstration of Editorial’s scripting capabilities. First, a workflow to fetch a random article from Pocket:

I’ve made 3 workflows; two for the authentication (Pocket Auth 1 & 2), and one that fetches a random article from the user’s unread queue and opens it in the Editorial browser. The Pocket authentication only needs to run once.

And then one to post on (which could be nicely chained to my Post To WordPress workflow):

If you’re an Developer, you can post to directly from Editorial. I integrated this workflow into Federico Viticci’s Post to WordPress workflow, to post new articles to in addition to Twitter.

Side note: I’m keeping track of Editorial workflows I find over at this Pinboard tag.