What others do: Pythonista

I haven’t actually had a chance to play with io.* that much, but I assume you can navigate to anywhere within the Codea sandbox — so all projects should be in reach.

I will be unsandboxing os.getenv so that you can get the system environment variables (such as “HOME”) to make directory navigation easier.

I would still like to add a higher-level API for this stuff, because it would be nice to have. I am thinking:

saveProject("ProjectName")

saveBuffer("ProjectName:BufferName", contents)
saveBuffer("ProjectName:BufferName", nil) --delete

buffers = listBuffers("ProjectName")

contents = readBuffer("ProjectName:BufferName")

Hi @Simeon, saw ‘buffers’ and wondered would this lead to saving and loading sound buffers?

Basically, access to io.* and os.* would be enough. Ruilov might write a small program that loads his GithubClient.

However, a higher level API is convenient. It may e.g. handle the entries in Info.plist better or provide security features like a pop-up dialog on file modification.

.@Fred perhaps I should have called them “Tabs” and not “Buffers” in the API above. But that’s a good point about being able to save and load into soundbuffer objects. It’s something we will be interested in doing, but I can’t say exactly when (we have a lot of new features in progress).

Hem, while you are at io functions, what about a simple binary reading for raw file, to be able to read too big images in several blocks? Read(file, offset, number of octets) would be fine. And the write function, with append capability…

What we really need ( instead of or in addition to os.* ) is lua-fs. There’s stuff missing from io.* - cwd, mkdir, chdir, chmod, and so on. Between that and io.*, we can build whatever we wanted.

So - some observations about pythonista:

First: There’s a lot of neat things in Pythonista that we should… be inspired by. :slight_smile: and then move right on to copying in Codea. I’m not proud, and it’s CLEARLY been inspired by the ground Codea has broken.

a) when you’re in a program, tapping the title gives you a dropdown with shortcuts to all classes/functions in that module.

b) probably too late for this - but they have a full-on console mode, and if you don’t do the run loop explicitly ( you generally set up a scene, then run(scene) at the ‘end’ to start your event loop) you end up with old-school procedural code. I think this hangs up a lot of people. I made an abortive attempt (pre-font days) of writing a console class - it might be worth looking at again.

c) Their print() doesn’t seem to get hosed if you call it a bunch. We need to fix this. I use print for debugging a lot.

d) you can pick a font and size for the editor (so I can make it smaller, and see more on the screen, which is nice).

e) Their editor is scriptable (!) - so you can write code in python to extend it, and there’s a dropdown to execute that.

f) when you make a new project, they give you multiple templates - blank, scene, scene with layers. That’s kinda neat.

g) Their standard library is huge. This is more a Python thing than a pythonista thing, but I’m jealous. I know the original concept of Codea was a processing-type thing, but it’s more than that now - we should go thru the normal libraries that lua has, and include them if there’s not a good reason not to. Things they can do out of the box include get/set the clipboard(!), keychain access, bit manipulation, unicode, date/time manipulation, support for big decimal and rational numbers, full file/directory support, data marshalling/unmarshalling, deep copies, dbm support including SQLITE3, zlib and archive (zip/tar) support, parsing and emitting CSV and plist files, crypto services (not just https, but hmac and md5 and unix crypt), low level sockets and signals, MIME and JSON support, XML parsing, an embedded web browser (yes, not spawning out to safari - I suspect I can run javascript in it), HTTP Server support, POSIX support… the list goes on. I have wanted most of these at one point or another for Codea (I didn’t list the stuff I didn’t want), and most of them shouldn’t tweak apple too much. This is one place where pythonista lucked out - this is all part of the standard python libraries, so it was “free” for them, or nearly so.

h) it runs on the iphone. Seriously - my iphone has the same resolution as my old ipad; make an upcoming version universal, and let people deal with teensy fonts, or a 40 column screen. I did lots of good programming in a 40 column 24 line screen, back in the 8-bit days.

Finally, lest you think I’m smitten: Python REALLY CHAPS MY HIDE. Oh - it’s killing me. The mindset of python is so alien to my own… I feel like I’m writing COBOL. And - I’ve written COBOL. If Codea didn’t exist, I’d be happy enough with pythonista, but I know we can do what it can, without silly whitespace rules and syntax gotchas. (Hey - “i++” is valid in python - it just doesn’t do what 99% of the world expects it to do. I could go on - I have a laundry list. Ask me about whitespace sometime you have an hour or two to kill…)

The pythonista guy did a great job - and picked the wrong language.

.@Bortels the editor font size can be changed from the settings menu (on the project browser screen).

Regarding the rest, most of them are covered by features we’re working on and more.

If i may add a comment: i bought pythonista, i found it great, i tried to write some code(don’t know pyhton), got stuck with errors i didn’t know how to solve from their docs, looked on the web to find some nice forum with game examples or else, found nothing usable… Studied the documentation, felt tired, felt as at work… Didn’t know where to start. Where do they get their images from? There always seem to be some library missing…felt lost and alone. Asked some question to the programmer, no answer…

I came back to Codea forum, read some great posts, copied some code, had fun in a couple minits. FUN! Didn’t run Pythonista since on week ago (i can’t do anything out of it yet)

As far as i am concerned: Bortel: 0 Simeon: 1.

:slight_smile:

Yes - pythonista has giant issues, other than “python”. There are no user forums that I could find (I wanted to know what was NOT supported - compass? accelerometer? camera? etc). A vibrant user community is a MUST for any new environment; more important, in many ways, than really super important things like library support. The python docs are good - but not perfect, and more “pythonista-specific” docs would be good. They need a damn FAQ, frankly. They also need, in the absence of forums, to respond to feedback sent to their contact email.

When Codea came out - no text other than print(). But - a forum, and people talking, and we rolled our own (multiple versions!). And I like to think the chatter and interest around this missing feature is what helped TLL add it’s excellent support for graphic fonts and such. Without that community - pythonista will be stillborn.

Having said that - there’s still a bunch of good ideas in it to draw from. It’s always good to see how others execute on the same basic concept (a self-hosted development environment). Based on how much I talked above, it should be clear - second only to a good user community, standard library support is a key thing. Codea lacks somewhat in that area, largely because the userbase and tasks we want to apply it to aren’t exactly what TLL envisioned when they started; who would have thought there’d be a call for stuff like zlib, or file IO, in a processing-type app? But - this is a situation that can be rectified (not easily - but it should be fairly straightforward in most cases).

PS. In answer to “where did they get their images from” (as I had the same question) - there’s a ton of built-in “icon” type images; you can hit the “+” in the upper right in the editor to browse them, or paste in your own. They included the Planet Cute graphics, which I was amused by, and it looks like they raided the emoji character set as well. Other than the existence of the image browser, this is all, so far as I can see, entirely undocumented.

As I promised, a few days ago, I bought Pythonista

I was playing a little with it. I know python from PC, so on the part of the console, I did many things.

About Drawing Mode, it’s a battle between my mind and my iPad, sounds like Pythoniadda, a war.

I am able to write / read files, loops, draw pictures.

Here is a different world, but you know what I like about Pythonista?

Initially, when I bought this app, I knew what was to come.

But, I bought Pythonista for processing text data, here API is well equipped.

How about Codea, Home Sweet Home, Codea remains a very good app for created all sorts of wonderful games and animations like processing.org

I want to remain neutral, because I have no right to give verdict who is stronger Codea or Pythonista. But what I’ll say? I’ll use them both. >:-)

Overall Codea is way more fun to use. Pythonista does have a wealth of libraries, but I mainly attribute that to the use of Python for it’s language and Python’s “batteries included” philosophy, rather than anything the developers did.

I actually kind of like the fact that Codea didn’t come with libraries for everything…thanks to this community there is a ton useful stuff around now, and it’s all targeted at Codea rather than Lua in general. If I were personally developing Codea, I probably wouldn’t have done much different in that respect. That said, zlib would be a nice addition. Also, once 1.5 comes out, with os.getenv() exposed and with the ability to create projects programmatically, I think we are really going to see the doors blown off with the stuff that people come up with.

EDIT: Oh yeah, it would be sweet if Codea worked on iPhone too :slight_smile:

I tried Pythonista and this is what I got :stuck_out_tongue:
This was originally made for Codea by
this guy → http://www.youtube.com/user/phyces

Here is my version for Pythonista with a few modifications :stuck_out_tongue:
https://www.dropbox.com/s/44fnbqj0mzqdz8a/Particle_Engine.py

I noticed that it runs smoother in Codea. Hope it isn’t my bad coding XD

Someone might of suggested this earlier but couldn’t you make a web page with the available modules in text form and have it so that people can just copy the text for a specific module they need and paste it into a file in pythonista?? It might be more work but I think it would make the app more usable.

Well - you could, but pythonista has a very complete set of standard libraries, so that’s likely to be less useful than you might imagine; indeed, that’s a strong point for them. You can write some very useful things in pythonista with the libraries included - was there one missing you were looking for?

Codea can do the same, kinda, with http.get and loadstring (or, yes, just cut and paste), but using the standard libraries available is tougher, as most of them have a binary component, and even then Codea is lacking - currently - many of the really base standard libraries that others are built on. Having said that, I’ve successfully done so with a json reading module I had hand-modified, so it’s not out of the realms of possibility.

Yea I’m in cs 1410 (object oriented programming) and I need a module called pygame, gtk and pygtk for some class projects and if there was some way of adding them like making the module in the app and copy then paste I think it would widen pythonista’s capabilities.

I’d be surprised to see those on the iPad - they’re pretty tied to the pc-type environment - keyboard, mouse, no touch, etc. so it wouldnt just be a port - it’d be a rewrite. Having said that, I suspect there are analogs already there for many or most of that functionality.

well i have a keyboard and can make a bluetooth mouse work on the ipad would that make those more resonable on the ipad or not??

I dont think you can use a bluetooth mouse with the iPad.

they have a app that jail breaks the ipad and allows the use of a bluetooth mouse. or so i’ve heard