I don't think omz would like there to be too much discussion about Pythonista and jailbreaking, as such conversation may spook Apple. I'll discuss some of my thoughts, but feel free to delete this post (fortunately, however, my conclusion works in Pythonista's favor).
Without going into too much detail, the easiest way to "break out" of the sandbox would be to run the app as root
. In order to run an app as root
, the app must be built in a certain way (see this stackoverflow question). Presumably, only the app developer, who has access to the source code, can make these modifications. Therefore, we are not able to run the app itself as root
, and we cannot break out of the iOS sandbox. For more detailed information about how the iOS sandbox works, see saurik's description of the jailbreak patching process on Hacker News. In short:
App Store applications on jailbroken devices still cannot snoop into your keychain, mail, or the data stored for other applications such as Facebook. They do have access to your camera roll, but that is true of non-jailbroken devices as well (this is fixed on iOS 6).
We can gain some advantages on a jailbroken device, however. You may try symlinking directories within the Pythonista app to other areas of the filesystem, but I doubt the sandbox would let Pythonista access the filesystem that way. (EDIT: I tried this, and Pythonista can browse the filesystem, but you cannot create or modify files outside of the sandbox.) You can launch Pythonista scripts via url, so you can set up cronjobs and launch daemons which run scripts in Pythonista. Perhaps most interestingly, with root access you can install Python 2.7.3 on your device (download the .deb here), and make use of Pythonista as a top-of-the-line IDE. (I also have some python packages available here which worked on the 2.6 iOS python build.) You may be able to make Pythonista run persistently in the background, but not sure about that one.
With access to the iOS filesystem, take a look in Pythonista.app/pylib
, and you'll find a bunch of python modules and scripts which may be of use. It seems that omz implements the iOS modules using open-source "wrappers" located in the pylib
directory which provide front ends to the actual closed-source modules (I wasn't able to find Pythonista's iOS modules (_notifications
, _contacts
, etc.), so I think they are compiled as part of the app binary along with Pythonista's python distribution). Even so, you can try to import Pythonista's modules (e.g. pylib/notification.py
) from the system python distribution and see if they work. (EDIT: Just tried this, and indeed python cannot find the underscored modules. However, if you run the python REPL in the Pythonista.app/pylib
directory, you can import any of the non-Pythonista modules included in the Pythonista distribution, like dropbox
, evernote
, bs4
, etc. Additionally, since you have write access to the pylib
directory you could plausibly add your own modules to Pythonista.)
Again, because Pythonista is a great app I do not want to jeopardize its availability by broadcasting its uses on jailbroken devices, but I do think it can be extremely useful in this regard.
(I did find an easter egg though :-P)