My first Pythonista script

· Ben’s Blog

Update: I figured out how to specify ranges and open YouVersion Bible app to more than a single verse.

I recently purchased omz:software's Pythonista, which is a Python programming environment for iOS. Thanks to Viticci's excellent piece about how it changed his iOS workflow, I saw how well-designed and powerful the program is. I've dabbled with Python on and off throughout my career and I'm always wanting to improve. This puts Python in my pocket, and after using it for a few hours, I can say Pythonista is worth the $5 entry fee.

The first script I decided to write is something I've wanted to have available on all of the computers I use—it's a script that essentially linkifies bible references to make accessing them more convenient. In this iOS implementation of it, the workflow is that you:

The first iteration of this has some severe limitations, but it does work. Here is the script on Gist.

The main limitations right now are that 1) it doesn't work on ranges. You have to specify a single verse, or an entire chapter. And 2), you must use the full book name. An abbreviation, such as Gen for Genesis will not work. These limitations present some interesting challenges that will give me the opportunity to improve my Python chops. I'd like to be able to support the various ways that bible passages can be represented, and I'm sure there are many edge cases which I haven't considered. There is a bible reference parser project on Github written in Coffeescript which is well-documented that I've referred to a couple times and will continue to do so.

The bible reader app I use right now is YouVersion, which does have an undocumented URL scheme. It also has its own limitations: I haven't figured out how to pull up ranges, and it may not be possible yet. So until that happens, I also won't have a complete working implementation.