This Week's Sponsor:

FastMinder

A Simple, Lightweight, and Clutter-Free Intermittent Fasting Tracking Experience


Posts tagged with "pythonista"

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.

Permalink

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


My iOS Screenshot Generation Workflow

Screenshots

Screenshots

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


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).

Permalink

Check Dev Center Status From iOS with Pythonista

A great idea by reader Nicolas Hoibian, which uses BeautifulSoup to fetch the source code of Apple’s System Status page, parse it, and print it with custom fonts and colors in Pythonista’s console.

Here’s my modified version that uses Pythonista’s notification module to re-run the script every 6 hours by firing a local iOS notification on your iPhone or iPad (it assumes the script is named “DevCenter” in Pythonista).

Permalink

Resolve Short URLs with Pythonista on iOS

Clean URLs

Clean URLs

I don’t like it when third-party apps or services force me to share links to articles or webpages using their own custom shortened links. I understand the appeal of personalized short domains – after all, we tweet mcstr.net links with the @macstoriesnet account – as they can provide analytics to track clicks, can save characters, and, at least in theory, they “look cool”. However, I’ve been long considering the idea of dropping our mcstr.net links, but I think the issue is worse (and more annoying) for apps and services that don’t tweet links to their own content (like we do) but that override others’ links with different domains. An example is Pocket, which gives you the clean, original URL when you choose the “Copy Link” action from the sharing menu, but that instead returns pocket.co links when sending text to Drafts (which I do often). I’ve grown tired of this practice (in Pocket and other services), and I’ve put together a workflow based on a Python script that allows me to easily resolve short links without having to open the browser and tap on multiple menus. Read more


A Better Chrome To Safari Bookmarklet

pythonista

pythonista

In January, I tried to put together a bookmarklet to send the webpage currently open in Google Chrome for iOS to Apple’s Safari. That turned out to be a surprisingly complex effort as Google didn’t think offering an “Open In Safari” option would be a good idea, and the app’s URL scheme produced some interesting results when opening and closing Chrome.

I was reminded of the bookmarklet this morning by reader @CNWLshadow, and I realized that I never posted the solution I settled with. It consists of a browser bookmarklet and a Pythonista script, and it works with just one tap.

Read more