Hacker News new | comments | show | ask | jobs | submit login
Kivy – Open-source Python library for rapid development of applications (kivy.org)
154 points by albertzeyer on Aug 15, 2014 | hide | past | web | favorite | 47 comments

I've tried it, but the resulted built size is huge. How could a Hello World application (built for android) took 15 minutes to build, and about 60MB in size ?? Why not those measurement been told in the main site to tell other to try and use ?

Others have noted that this should not happen, but just to comment on the specifics; the size of a plain APK like a Hello World should be just 6-7MB. Anything else is files in the project path that haven't been excluded (e.g. big images in the project directory) or dependencies that the python-for-android tools have been instructed to include. I don't know what went wrong for you, but that size is highly atypical, and if you're ever interested we can help debug it.

It's possible to reduce the size further, one of our devs has recently been experimenting about this in particular and I think has got down to 4MB without too much difficulty. The problem is that reducing it much further starts to mean being more careful about blacklisting stuff like modules in the python standard library, which can be hard to do automatically without breaking dependencies. It's highligted some potential optimisations in kivy's internals though, so maybe we can make it easier to leave out some non-essential kivy components.

Just to be clear about the build time thing, compiling python + project dependencies may take a few minutes (e.g. your 15 minute figure), but subsequent builds don't need to repeat this and will take just a few seconds.

The actual apk can be as small as 5-6mb, but yes it's too big. Ideally common files to all Kivy applications (the python runtime and libraries) would only exist once, but that's a problem people can't quite agree how to solve. https://github.com/kivy/python-for-android/issues/202

I'm pretty sure apps can have dependencies, so that looks like the best solution. Yes, users will be annoyed, but I think it's still better than various other "hacks".

QT has tried that on Android and it's an exceedingly poor solution. Almost no user will click to download additional files -- they've been (rightfully) conditioned to view this as a suspicious technique.

As long as you blacklist unneeded libraries on Kivy, you can get the size down to 5 - 10 MB. I personally don't believe this download size is such a problem for users (many native Java apps are upwards of 5 MB).

What is a problem is the start-up time and battery usage, both much harder problems to address. Because they require the Python interpreter, Kivy apps take significantly longer to start-up, and use significantly more battery power than Java apps. I have some hope that Micropython may eventually offer a solution to this for Python on Android, although porting Kivy to Micropython will be a major task.

I think startup time has good for very annoying, with android devices of 3 years go, to nearly forgettable, with more modern, high-end devices. I've witnessed nearly instant startups, with devices as the Note 2, not saying it's a solved problem, the cpu speed and even more the read/write speed of the internal storage will have a lot of impact especially on the first start (unpacking python and deps).

For battery usage, i'd love to see data for this, i think drain will come from the amount of action you put in your interface, as well as background processing you'll do, kivy itself, being opengl and cautious about what to update when changes happen, shouldn't add a lot of overhead on this.

I don't think porting to micropython is considered an option, usually, when we want more efficient code, the solution is to do less python, more C, we have a nice integration with Cython, and don't hesitate to go with it as soon as needed.

"has gone from" >_<.

I'm guessing this is because Kivy includes a Python interpreter and Python libraries in each APK?

The Python interpreter itself is only about 1.5-2 Mo. The issue is mainly related to the libraries.

I have a couple hymnal apps in the Play Store built with Kivy, and reviews suggest that performance is a problem for some people, especially scrolling through long views. I'm in the process of rewriting them using HTML and JavaScript in a WebView.

That being said, Kivy is really nice to work with; the documentation is good and it's a well thought-out library. I'd enjoy using it for future apps that don't happen to have long views to scroll through.

Did you use ListView, or did you roll your own ScrollView managed content? We are sorry about the state of ListView currently, and plan to redesign it soon, it's really not optimal currently, and not offering a very useful interface either, so maybe you could fix you issues just putting a GridLayout in a ScrollView and fill it as needed (i documented a way to do a publisher/consumer using threads on my blog, it's efficient for these kind of things).


Initially I used the ListView, but found performance problems on every device. I then rolled my own using a layout in a ScrollView, and it's better, but still troublesome. I'll compare what I've done to what you wrote about and see if I can improve matters.

I've always been confused about open-source projects that go big on marketing themselves.

Building a good community around open-source projects holds obvious advantages as you'd always need contributors to push the project through its future generations.

As far as I can see, Kivy is supported by a group of independent developers. Kivy (as a group) must have spent money in marketing the product, launching developer contests, publishing books on Kivy (I've seen a couple books on Kivy by O'reilly), and other stuff. I'm just curious to know in what other ways, apart from the need to grow the community around your project, does marketing your open-source project help? And is the money put into marketing the project contributed by the creators themselves?

> Kivy (as a group) must have spent money in marketing the product

I don't think kivy (as a group) does anything except recently the contest, and things like maintaining a g+ account, mailing list, posting on hn or reddit if something intersting happens etc. - were you thinking of anything in particular here?

> launching developer contests

This was funded entirely from sponsorship, you can see the list on the contest page (http://kivy.org/#contest).

> publishing books on Kivy (I've seen a couple books on Kivy by O'reilly)

Publishers commission books because they think they will make money, not because kivy pays them to - actually, I don't think any of the core developer team have been directly involved in kivy books.

> and other stuff

Honestly, not really - I can't think of any other expenses except small things like powering the website server.

> I've always been confused about open-source projects that go big on marketing themselves.

I don't think kivy is really big on marketing itself - if anything, maybe the opposite. I've wondered before if its relatively unknown status (compared to phonegap etc) is at least partly because we don't advertise much, though it may just as well be that more people are interested in html.

Things like the developer contest are great to build interest and get the word out that kivy exists, and as you said yourself have obvious advantages in maintaining and growing the community - if this is 'going big' on marketing, I don't think that term is very meaningful.

I confirm there was no money directly spent on promoting kivy. Most of our communication has been directly with the community, through help on irc/google-groups/SO and other places. We did start to improve communication on twitter/g+/facebook, but it's really on our own time, not paying any agency or specialist of these things.

For books, while we were contacted by a few publishers, none of the core-dev authored any, yet. We tried to give a hand, however, reviewing the books when we could, i personnaly reviewed O'Reilly's book, pointing out a few mistakes to the editor, and gave it a good review, as it was, in my opinion, a well written book with very good exemples and explanations. As it seems usual, i got a free book and a little payment for this (that i didn't expect at all when doing it, my motivation was that there was a need for good kivy books).

And i agree we should do more, if not on marketing, at least on communication (there are a few markets that kivy can fully or partially cover already, we don't want to limit these options, just help it grow where users want to use it), but users need to know about it, and to easily get a good understanding of what's possible to do with it. We have a lot of recurring questions about that, as well as people discovering us and asking why they didn't heard about us sooner.

I do think the community could be way bigger, but we need to adapt the tools we use to communicate, irc works very well up to the hundred of connected users we have, probably less at more, and waste a lot of energy in saying the same things over and over again (although the direct interaction with our users is highly appreciable), SO seems to make reuse of explanations much more common, and is sometime more effective than direct documentation.

Anyway, i'm getting away from the point, will cut it there. :)

What about a Google group? That is, basically a mailing list, but without the mails, for those (such as me) who get too much mail already. Google groups is the best form of community communication out there if you ask me.

... and, maybe a "community" link on the kivy page, to quickly find out how to get in touch with others in the community. Would help a lot I think.

We actually do have a google group (actually more than one) - https://groups.google.com/forum/#!forum/kivy-users is the most active, and works well. Maybe we need to make that clearer as well!

You are absolutely right, take a look at their expensive marketing at work. https://i.imgur.com/rZ6pQU5.png

Here's an application my co-worker built using Kivy. https://github.com/aigarius/photoriver

I found this in my logs from 2013 and it looks really nice now.

Another example app with Kivy + SQLite: Image Viewer and Organizer, https://github.com/gau-veldt/ImageOrg

This is also interesting: http://libnui.github.io/nui3/ I'm not exactly sure anymore about the relation. Is Kivy based on libnui?

Kivy looks very nice but NUI is a very different beast (I'm the author). The main difference being that even though NUI is a complete multi-plateform framework that uses OpenGL for rendering, it has a strictly C++ API.

If you want to see apps built with NUI I just released reChord: http://bit.ly/rechord And also some very nice music apps with NUI: http://intua.net/products/beatmaker2/ http://www.whitenoiseaudio.com/apps/genome-midi-sequencer/ http://www.whitenoiseaudio.com/apps/bleepbox/

In the GitHub description (https://github.com/kivy/kivy), it says about Kivy:

"Open source software library for creating NUI applications, running on Windows, Linux, MacOSX, Android and iOS"

I guess that is why I searched for NUI and I probably found your lib. I don't remember that I have heard that term "NUI" before.

I've been using the name for 13 years or so but a number of other libs started using the acronym unfortunately (New UI, Natural UI, etc.). I should have been more vocal and public about the lib from the beginning :-).

Some nice looking apps there: well done!

> ImageOrg

I see a few files, but no instructions. Isn't kivy supposed to be a GUI building tool?

Where is the exe or dmg file?

The user hasn't packaged this into a standalone executable (though this is possible with e.g. pyinstaller). You need to run the ImageOrg.py file with python.

No, kivy has no relation to libnui.

Messed with Kivy about 6 months ago, while I love what it is, it suffers from PyGame'ism. Yes you can write games and such, but the end result always just feels bloated and performance hungry. I ended up going with Corona (http://coronalabs.com/), and it is/was awesome for the game I was building.

I wrote a Kivy app for a multi-touch table a few years ago as my Masters project in CSE.

I appreciated being able to develop on my Mac, run it on the table using Windows, and even got it running on an iPad.

Getting the environment set up to deploy to iOS was complex (especially cross compiling non-standard Python libraries), but it has been a few years.

Is there any plotting library I can use with Kivy?, something of the likes of D3.js (http://github.com/mbostock/d3/wiki/Gallery)

matlibplot is one of the best and most extensive plotting libraries. You also have d3py that is a d3.js implementation in python. Do a google search for python graph or python plot and you will find plenty.

Anyone tried Kivy for game development? I'm interested in brushing up my Python and was thinking about making a game that could be OpenGL accelerated, and it seemed like a good match.

Yes, you can see examples of games done with kivy in the two contests (kivy.org/#contest), and there are also a few games on the market, it's also interesting to look at kovak's efforts on kivent.org, a 2D game engine built on top of kivy and cymunk, which seems like the way to go for games with a lot of actors.

Cool, thanks! I'll have a look at that. Does the kivent.org stuff support Tiled?

I don't think it does right now, but it should be pretty easy to add this kind of support.

There has been at least one user working on it, for kivy, so maybe it'll available soon, either as 3rd party package, or as a PR to either project (though it would probably make more sense on kivent).


I may try this on my daughter who has been asking to get into programming. I remember the buzz I got building simple visual apps in VB. This feels similar.

Anybody knows of any app built for iOS using Kivy ?

There's a (probably not exhaustive) list at https://github.com/kivy/kivy/wiki/List-of-Kivy-Projects#kivy... .

Would it be correct to say that Kivy is the Python equivalent for Ruby Shoes? In which aspect the one or the other is more powerful?

Can you write IOS and Android Apps with shoes?

They won't be native apps anyway but browser based apps, so as new Shoes is going to use Javascript (via Opal) and HTML as a rendering engine, then yes you can. Any other actual differences or points of strength worth noting?

Apart from the size issues mentioned below, how does this work on Android? Is it better than PhoneGap etc and closer to native apps?

It compiles the python interpreter for android/arm, then bundles this all together in an APK - along with much of the standard library and any extra modules the user wants. It also includes a java bootstrap app that interacts with the system, but does essentially nothing except initialise and display an opengl surface that kivy renders to - along with running the python interpreter on the user's kivy code.

This bootstrap is invisible to the user, you don't need to touch the java to use kivy. That said, kivy has some cool sister projects for using the normal java api - pyjnius for accessing java classes directly from python, and more recently plyer to provide a more pythonic wrapper to common things like vibration, sensors etc.

(The above is also mostly the same for the ios build process).

> Is it better than PhoneGap etc and closer to native apps?

I would say more that it is just different, with advantages and disadvantages of its own. It doesn't use native widgets (though it's possible to create and use them in some ways with pyjnius), so it isn't different in this sense.

I think for 2D related apps/games which do not require the native OS UI controls this is a good choice.

I never was able to run it on my computer unfortunatly(mackbook ,bootcamp,windows 7).

But it looks great.

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