Hacker News new | past | comments | ask | show | jobs | submit login
Python for iOS (pythonforios.com)
107 points by rayvega on Feb 25, 2012 | hide | past | favorite | 39 comments



Nice. So, it's possible to integrate the interpreter on iOS? My app http://worqshop.com has the Python editor (with syntax highlighting) and GitHub support. But, no interpreter!


This looks neat, but does it support other Git repos or just Github?


Is this a fully capable interpreter? In other words, is it capable of importing and running code from external sources? This would allow for some cool use cases.


Unfortunately, Apple rejected my last update because I had added the ability to import .py files from other Apps. If/When Apple changes their policy on this I will submit an update the next day.


From your example, I can see it is possible to import sympy, and the app store page says that you added a few "extra" packages. Could you list those extra packages on your website?

Since it is not possible to import files for now, would you take requests to add new packages to that extra list?


Certainly, I'll list them on the site. I would love suggestions on other modules to include. At the moment I'm working on compiling in SciPy and NumPy. Any ideas can be sent to feedback@pythonforios.com or posted in the in-app Feedback Forums (via the Settings Tab).


I believe the AppStore restricts running external code, so even though it would be possible, I don't think such an app would be approved.


As it provides exec and a HTTP client, it more or less is. Here's an example, with code to make loading a multi-module library feasible: http://myblog.rsynnott.com/2012/02/fun-with-python-for-ios.h...


This is very interesting. If anyone is interested I've embedded Python on Android with support for the standard library. I actually wrote a 2D game platform similar to Corona (http://www.anscamobile.com) but almost entirely written in Python. You can use PyDev to develop and it looks/runs the same on the device. As a demo I wrote a simple free game (https://market.android.com/details?id=com.gravityfour.game.c...).

I have been thinking what to do with the code and how to release it. I want to open-source it and see what people do with it. I think it has a lot of potential to compete with Corona. It is in a prototype-ish state at the moment. If anybody is interested in helping send me an email :).

I realize "Scripting Layer for Android" exists but I wanted to combine native code with Python easily.


nice! i've been looking for a prototyping tool.

note that the email field in your hn profile doesn't show up publicly... you have to also put it in the about field.


oops updated :)


Downloaded it and love it. Sometimes I get the urge to mess around with simple ideas, but I need to work some part of them out by coding (i.e. RNG). If I'm out and about and have some time to spare, I can now pull out this app and do some coding exercises. :)

Problem: I can't seem to swipe between the console, editor, and docs.

Usinh iPhone 4, version 5.0 (9A334)


Swiping between tabs is an interesting idea. I'll see if there is a good way to implement this. Thanks for the suggestion!


This is awesome. I've been waiting for this! Now all I need is the same thing for JavaScript and I'll be in heaven!



Great program! Couple of suggestions:

* Can you add a free python reference like this one: http://www.diveintopython.net/

* Syntax highlighting!

* Dropbox support - a very simple module to save .py or txt files into a dropbox folder and sync - this would be great!


Awesomesauce! Even w/o the interpreter, it's helpful for trying snippets on the go. I think if you need something more elaborate, just spend 5 seconds more and open your laptop.


Is it as crippled as the lua ide? Or can you import/export scripts without copy/paste?


You can export script files and interpreter sessions (via email), but unfortunately, importing from outside the App is prohibited by Apple.


Can it save anything to the filesystem (within its own sandbox?)


Yes, you can save/load script files and interpreter sessions to the device. The save path is in sys.path so those saved scripts can be imported into other scripts or the interpreter as well.


Some of the icons do not have 2x versions; can you fix that?


Hmm, I did not realize that. I will fix it now and include them in the next update (v1.4).


The theme is horrible :/ We don't live in the matrix.


Or do we? dun dun duuuun


The colors (foreground & background) and font size are completly customizable in both the Interpreter and Script Editor tabs.


what kind of themes do you prefer?


I'd say, when in doubt, the rest of iOS is a good guideline. Plenty greys and blues, black-on-white text, boring, but at least not distracting.


Python for iOS is something that makes Python programs run as apps and maintains its library -- thus something explicitly impossible. This is just a gadget.


That's not true at all.

Interpreted code is perfectly legitimate to use in an iOS app, under certain restrictions.

The first is that you cannot JIT it, because the OS prevents execution of memory that has been writable (this is true for every app except for MobileSafari and it the reason why the only arbitrary code execution vulnerabilities have been found through MobileSafari).

The second is that you're not allowed download executable code to increase or change the functionality of the app. The reasoning for this I see as a little bit of selfishness on Apple's part, in that you can't really build a native app that acts as a platform for other people's fully-fledged 'apps' bypassing the app store, and the second being that the user's expectation of an app is that it be pretty much self contained in terms of functionality.

There have been exceptions to this though. CouchDB for iOS runs interpreted on the Erlang VM, but its database queries are executed by Mozilla's command line javascript engine. The code that runs on this query engine is actually downloaded through the database's syncing functionality, and it IS allowed in the app store.

So there does seem to be some leeway in terms of what is actually banned in that case. It seems that if downloading something technically turing-complete is REQUIRED as part of an essential function of the app, and cannot by necessity actually _change_ the main functionality of the app through running in a very limited sandbox (no I/O of any kind or indeed anything but data processing in this case), then it's allowed.

To get back to your original point, if someone wanted to build a bit of middleware that bridged the CocoaTouch libraries with python, then distributed that and allowed people to compile apps with it, it would be perfectly legal on iOS.


Maybe you can find a way into the open vs walled garden debate in a way that doesn't come off as shitting over someone else's work.


Unless I can program and do something useful on the target device itself, it will remain a mere gadget. The novelty of "trying out new ideas in the interpreter" wears off quite quickly. My MBA is (almost) as light as an ipad, and much more useful (programming wise.)


why it is not a free app?


Presumably because the author of the app feels like it would be nice to be compensated for the work involved in creating it.


Because it takes serious effort to do it.

I'm glad they did it. 3 dollars is nothing compared with the value I got from being able to use python on my phone.


I grant that "Python for iOS" took serious effort, but I am sure "Python" took more effort. Still Python is free.


Python is free because the creator wanted it to gain traction. This app costs money because the creator wants to charge for it. No other considerations are relevant really.


Because the developer worked to make it and, and he doesn't feel that he did it for the lulz...

The real question is: why the sense of entitlement?


> The real question is: why the sense of entitlement?

... on a platform that is definitely not free/open, and definitely not on the low end of the price scale.

"Free" software is great, except for the expectations some bring that everything should be free, and nobody should profit from their efforts - except for Apple apparently.

I use a mix of Apple products and F/OSS software, and I am happy to pay for quality products when they satisfy a need, especially from small or independent developers.




Consider applying for YC's first-ever Fall batch! Applications are open till Aug 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: