[ 35 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Python Welcome?
PostPosted: Tue Aug 31, 2010 10:08 pm 
User avatar

Joined: Tue Feb 09, 2010 11:28 pm
Posts: 15
Will palm/hp allow me to embed python in my c/c++ app?


Top
 Profile  
 
 Post subject: Re: Python Welcome?
PostPosted: Tue Aug 31, 2010 11:08 pm 
User avatar

Joined: Thu Jul 16, 2009 2:37 pm
Posts: 5177
Location: HP (Palm), Austin, TX (@unwiredben on Twitter)
Yes!

(With the caveat that if you dynamically link python into your app rather than statically link it, the app catalog security scanner might reject it for linking against an unauthorized library.)


Top
 Profile  
 
 Post subject: Re: Python Welcome?
PostPosted: Wed Sep 01, 2010 12:31 am 
User avatar

Joined: Tue Feb 09, 2010 11:28 pm
Posts: 15
Awesome, anyone interested in embedding python? I'm new at it, but i think i've almost got it...


Top
 Profile  
 
 Post subject: Re: Python Welcome?
PostPosted: Wed Sep 01, 2010 2:56 am 
User avatar

Joined: Tue Feb 09, 2010 11:28 pm
Posts: 15
Ok, maybe not. Can anyone tell me if it is not possible to use the libpython2.7.a compiled on the device with the gcc from the pdk?

I thought it was that my computer is x64, but that shouldn't matter should it?


Top
 Profile  
 
 Post subject: Re: Python Welcome?
PostPosted: Wed Sep 01, 2010 5:01 am 
User avatar

Joined: Thu Jul 16, 2009 2:37 pm
Posts: 5177
Location: HP (Palm), Austin, TX (@unwiredben on Twitter)
A ARM build of libpython2.7.a should work on device.

I'd first try to get a python interpreter working just to get all the compiler options sorted out, then I'd work on getting the embedded version going.


Top
 Profile  
 
 Post subject: Re: Python Welcome?
PostPosted: Wed Sep 01, 2010 5:05 am 
User avatar

Joined: Tue Feb 09, 2010 11:28 pm
Posts: 15
yeah, i've got a python shell working fine, and just barely got the exe to compile and run on the device. Now on to embedded python problems.

Thanks for your help!


Top
 Profile  
 
 Post subject: Re: Python Welcome?
PostPosted: Mon Mar 07, 2011 3:11 pm 

Joined: Thu Jan 13, 2011 3:41 pm
Posts: 12
Location: Buenos Aires, Argentina
I was about to start my Python porting to webOS 2 (on my Palm Pre2) when I read this message.
My idea is to not only port Python, but also PyGame. There are A LOT of games and application using PyGame (even in iPhone apps). PyGame is very easy to use (it uses SDL) and you can create Python (with PyGame) apps in the PC and the just copy a .py or .pyc file to the Pre.

Would you like to start a project at Google Code, or we can use a subtopic in the forum.

Fell free to contact me, I believe it will be a great improvement for the webOS Platform to let developers use Python for the apps.

Keep in touch,

Ezequiel


Top
 Profile  
 
 Post subject: Re: Python Welcome?
PostPosted: Mon Mar 07, 2011 8:44 pm 

Joined: Thu Jul 16, 2009 3:23 pm
Posts: 632
Location: Indianapolis, IN
I'm watching this one closely. Python has become my goto language with all around hacking. It would be fun for the device.


Top
 Profile  
 
 Post subject: Re: Python Welcome?
PostPosted: Wed Mar 09, 2011 1:24 am 

Joined: Thu Feb 24, 2011 1:20 am
Posts: 1
It would be great if there is room for Python in webOS. Concerned seriously.


Top
 Profile  
 
 Post subject: Re: Python Welcome?
PostPosted: Sat Mar 12, 2011 11:48 pm 

Joined: Thu Jan 13, 2011 3:41 pm
Posts: 12
Location: Buenos Aires, Argentina
That's great, at least we are three or four interested in this topics. Let's join forces and organize in order to do something or at least try.

I have created a group at Google Groups in order to organize our ideas, and a future job. I hope this motivates all of us in order to put hands on this.

http://groups.google.com/group/python-for-webos

you can contact me at kimi (dot) pre2 (at) googlemail (dot) com

Thanks

Ezequiel


Top
 Profile  
 
 Post subject: Re: Python Welcome?
PostPosted: Fri Mar 18, 2011 12:53 pm 

Joined: Thu Jan 13, 2011 3:41 pm
Posts: 12
Location: Buenos Aires, Argentina
I tried this guide (http://randomsplat.com/id5-cross-compil ... linux.html) in order to cross compile python for webOS.

Until now I have a few errors that I'm trying to solve. The other approach is to open a .deb file with Python lib inside, and try to use that. May be I try this during the weekend.

Bye


Top
 Profile  
 
 Post subject: Re: Python Welcome?
PostPosted: Fri Mar 18, 2011 9:26 pm 
User avatar

Joined: Mon Dec 28, 2009 6:46 pm
Posts: 502
I just came across another link which may be helpful:

http://www.crosscompile.org/static/pages/Python.html

You will need to make sure that your build is compatible with an ARM processor architecture. Most Debian packages will be intended for an x86 or x86-64 architecture. Finding a way to compile the Python library with tools similar to the ARM/GNU Linux CodeSourcery toolchain is probably ideal.

_________________
Joshua Granick
Developer Relations


Top
 Profile  
 
 Post subject: Re: Python Welcome?
PostPosted: Wed Mar 23, 2011 8:38 pm 

Joined: Thu Jan 13, 2011 3:41 pm
Posts: 12
Location: Buenos Aires, Argentina
Very interesting... I will give it a try. And hopefully we will have a static library to include in our projects.

Thanks


Top
 Profile  
 
 Post subject: Re: Python Welcome?
PostPosted: Wed May 11, 2011 9:01 pm 

Joined: Wed May 11, 2011 8:58 pm
Posts: 4
I've been able to run the Python interpreter and PyGame on webOS, and have also started working on bindings for the PDL API:

http://thp.io/2011/webos/

Only tested with developer mode enabled. SSH and/or novaterm recommended. Give it a try :)


Top
 Profile  
 
 Post subject: Re: Python Welcome?
PostPosted: Wed May 11, 2011 9:12 pm 
User avatar

Joined: Mon Dec 28, 2009 6:46 pm
Posts: 502
Awesome!

Do you think it would be possible to bundle the Python libraries inside of an application package, so that an application could be installed from the App Catalog bundled with PyGame and Python?

_________________
Joshua Granick
Developer Relations


Top
 Profile  
 
 Post subject: Re: Python Welcome?
PostPosted: Wed May 11, 2011 10:02 pm 

Joined: Wed May 11, 2011 8:58 pm
Posts: 4
singmajesty wrote:
Do you think it would be possible to bundle the Python libraries inside of an application package, so that an application could be installed from the App Catalog bundled with PyGame and Python?

From what I can tell, there's no technical reason why it wouldn't work - apart from the size which could be a problem. But then, depending on the game, there's probably much of the Python standard library that can be left out from the application package, possibly shrinking the size.

I've also been thinking about installing Python/PyGame somewhere on the internal storage (/media/internal/) at first use, and creating a thin wrapper that checks if Python and PyGame are available and if not, downloads them. This would have two advantages: 1.) Python/PyGame is only downloaded once and shared between all PyGame packages, making the packages really small. 2.) Python and/or PyGame can be upgraded independently from the applications if need be.


Top
 Profile  
 
 Post subject: Re: Python Welcome?
PostPosted: Wed May 11, 2011 10:23 pm 
User avatar

Joined: Mon Dec 28, 2009 6:46 pm
Posts: 502
It looks like your minimal Python binary and PyGame binary together total around 10 MB in size. This seems perfectly reasonable to distribute with each game. I do something similar with the haXe games I have published. The libraries which support each of those applications are around 7 MB in size. When a device has 8GB, 16GB or 32GB of storage, this seems completely reasonable.

Another advantage to bundling these libraries is that it ensures that each application is stable. If a developer has ensured that their game works fine, they won't ever have a surprise if the libraries are updated or if the user decides to format their /media/internal partition.

It would probably be possible to make applications check to see if the libraries are on /media/internal, and to download them if necessary, however I think that the best user experience all around would be to package them together with each application, so once the user has download the game it is ready to go. Not a great surprise to try to start a new game, only to discover it needs to continue downloading.

This seems like this would be a great project to be able to offer to any webOS developer. I love homebrew, but I think it would be a shame if your library was only available to homebrew applications. If the library is solid, it would be great to be able to offer Python as an option alongside C++

_________________
Joshua Granick
Developer Relations


Top
 Profile  
 
 Post subject: Re: Python Welcome?
PostPosted: Wed May 11, 2011 11:33 pm 
User avatar

Joined: Thu Jul 16, 2009 2:37 pm
Posts: 5177
Location: HP (Palm), Austin, TX (@unwiredben on Twitter)
thpthp wrote:
I've been able to run the Python interpreter and PyGame on webOS, and have also started working on bindings for the PDL API:

http://thp.io/2011/webos/

Only tested with developer mode enabled. SSH and/or novaterm recommended. Give it a try :)


Oooh, shiny!


Top
 Profile  
 
 Post subject: Re: Python Welcome?
PostPosted: Sat May 14, 2011 9:23 pm 

Joined: Thu Jan 13, 2011 3:41 pm
Posts: 12
Location: Buenos Aires, Argentina
Hello everybody,

As I have told Thomas, I'm creating a thin C/C++ application that will run the python interpreter with a bundled python file.

This weekend I will try to first create a ipk, where "main" calls the python interpreter inside the memory card (it should not be difficult, unless "system" function does not work). As a second task I will upload all the binaries to a website, and create an app that check and download if you webOS device has a Python VM installed in the SD.

I will keep in touch with news about this. If everything goes right, I will upload all the files to the web, so everybody can start programming in python and having fun porting very nice games.

The best about this, is that the application you program and test in your PC (windows, linux or mac) using PyGame, will run without much modifications in webOS =)

Bye!

Ezequiel


Top
 Profile  
 
 Post subject: Re: Python Welcome?
PostPosted: Sat May 14, 2011 11:36 pm 

Joined: Thu Jan 13, 2011 3:41 pm
Posts: 12
Location: Buenos Aires, Argentina
Good news... I'm posting a link to a blog post, where you can find not only the binaries necessary to run python, but also a Xcode-PDL project that you can customize (and add your own python files) that launches your Python app. It also creates an IPK file, so you can use palm-package / palm-install, to build the IPK and load it on the device.

Hopefully, tomorrow I will have an application that checks if the VM is installed, and if not, it will download it and copy it into the internal memory. If this is working without errors, I will upload it to the App Catalog...

People... start writing Python apps for WebOS =)

BLOG POST (with complete template project + binaries)
http://www.ezequielaceto.com.ar/techblog/?p=359

Happy coding!
Ezequiel


Top
 Profile  
 
 Post subject: Re: Python Welcome?
PostPosted: Sun May 15, 2011 7:18 am 

Joined: Wed May 11, 2011 8:58 pm
Posts: 4
eaceto wrote:
Good news... I'm posting a link to a blog post, where you can find not only the binaries necessary to run python, but also a Xcode-PDL project that you can customize (and add your own python files) that launches your Python app. It also creates an IPK file, so you can use palm-package / palm-install, to build the IPK and load it on the device.

Right now, your main.c doesn't do anything that can't be done by a simple shell script - also, PDL_init() is already called by webos.init() in Python, and webos.quit() does a PDL_Quit so your application might do some things that should only be done once more than once.

Can you please post the code in a Git repository so that it's easy to check out and modify things, and also so that it's easier for people to contribute back changes?

Also, it would be nice if you could link to my page and to the python-webos repository, so that people know how the "webos" module works and where to contribute back any patches and how to build the binary themselves, because it's still missing the wrappers for some more advanced functions.

For App Catalog distribution, we would still need to generate a self-contained .ipk with the Python interpreter embedded. Otherwise people who accidentally delete the "python" folder from the internal memory (or even change some things in there) would have their application not working.


Top
 Profile  
 
 Post subject: Re: Python Welcome?
PostPosted: Sun May 15, 2011 3:46 pm 

Joined: Thu Jan 13, 2011 3:41 pm
Posts: 12
Location: Buenos Aires, Argentina
Hi Thomas,
eaceto wrote:
Right now, your main.c doesn't do anything that can't be done by a simple shell script - also, PDL_init() is already called by webos.init() in Python, and webos.quit() does a PDL_Quit so your application might do some things that should only be done once more than once.


Yes, I know. But his template app let's people bundle their python sources into an ipk. The Python virtual machine can be installed separately.

I'm creating an (hybrid) application called "Python" that checks if you have Python in your SD Card, if not, it downloads the binary and copy it into the SD Card. So, the idea is to have only one app that keeps Python+PyGame+and so on updated on the device, and the other apps are small "template apps" with their own Python code. I doing this, because "normal" people will not log into SSH in order to run a python app, they will download it from the App Catalog, and click an icon.

eaceto wrote:
For App Catalog distribution, we would still need to generate a self-contained .ipk with the Python interpreter embedded. Otherwise people who accidentally delete the "python" folder from the internal memory (or even change some things in there) would have their application not working.

The "template app" is very basic when done it will check if Python is installed. If not, it will ask user if he/she wants to install it (by launching app catalog...)

thpthp wrote:
Right now, your main.c doesn't do anything that can't be done by a simple shell script - also, PDL_init() is already called by webos.init() in Python, and webos.quit() does a PDL_Quit so your application might do some things that should only be done once more than once.

Can you please post the code in a Git repository so that it's easy to check out and modify things, and also so that it's easier for people to contribute back changes?

Of course I will fix that, and upload everything to the Google Code project.

For all the users interested in this, keep an eye on:

http://thp.io/2011/webos/

The complete project will be uploaded to: http://code.google.com/p/python-for-webos/
Discussion group: http://groups.google.com/group/python-for-webos

I'll be back later.

Ezequiel

P.D.: For some reason I'm not receiving emails whem somebody post a reply, event hough I have checked "Notify me when a reply is posted"


Top
 Profile  
 
 Post subject: Re: Python Welcome?
PostPosted: Sun May 15, 2011 8:07 pm 

Joined: Thu Jan 13, 2011 3:41 pm
Posts: 12
Location: Buenos Aires, Argentina
The binaries of the Python VM (+PyGame), the project to install Python VM from the device (check if exists and download) [still incomplete], and a template project that runs Python code bundled in the IPK, are all at the source of the Python WebOS project at google code.

http://code.google.com/p/python-for-webos/

Everybody that wants to contribute, just email me with a google account and I will add you as member. (Thomas, you are already added as owner).

Bye,
Ezequiel


Top
 Profile  
 
 Post subject: Re: Python Welcome?
PostPosted: Mon May 30, 2011 9:47 pm 

Joined: Thu Jun 10, 2010 6:08 pm
Posts: 17
eaceto wrote:
People... start writing Python apps for WebOS =)
Exciting news indeed!

Big thanks to everyone involved in making this happen.


Top
 Profile  
 
 Post subject: Re: Python Welcome?
PostPosted: Thu Jun 02, 2011 1:50 am 

Joined: Thu Jan 13, 2011 3:41 pm
Posts: 12
Location: Buenos Aires, Argentina
The Python App for WebOS is "Ready for Review". I'm waiting HP to approve it (or not...but hope they do) and hopefully it will be available for everybody.

It includes Python 2.5, PyGame 1.9, and some WebOS specific functions. You can then create a python project, bundle all the "py" files into an ipk and send it with a simple C code that checks the VM and launches your project.

I will go on working in this in my free time, but anybody can join the project. You are all welcome.

Ezequiel


Top
 Profile  
 
Display posts from previous:  Sort by  
   [ 35 posts ]  Go to page 1, 2  Next


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron