Hacker News new | past | comments | ask | show | jobs | submit | freakboy3742's comments login

If you want a smaller target, VOC (http://pybee.org/voc) can generate a "Hello World" APK in about 1.6MB.

VOC is compiler that takes Python code, and output Java bytecode. This means you can use the Android native UI components, because your Python code becomes indistinguishable from code written in Java. Combine with Briefcase (http://pybee.org/briefcase), and you can get an Android app with one command; combine with Toga (http://pybee.org/toga), and you can get a cross platform app using native system components.

If you want to see this in action, here's a video: https://www.youtube.com/watch?v=RisCgSIWwLA

(Full disclosure - I'm the primary author of these tools)


AFAIK, Plyer will give you access to native APIs like accelerometers, but not to the native GUI layer.

An alternative approach is VOC (http://pybee.org/voc) - this is compiler that takes Python code, and output Java bytecode. This means you can use the Android native UI components, because your Python code becomes indistinguishable from code written in Java. Combine with Briefcase (http://pybee.org/briefcase), and you can get an Android app with one command; combine with Toga (http://pybee.org/toga), and you can get a cross platform app using native system components.

If you want to see this in action, here's a video: https://www.youtube.com/watch?v=RisCgSIWwLA

(Full disclosure - I'm the primary author of these tools)


Hey Freakboy, always good to see your coding projects. Keep up the good work!


The primary difficulty is that JNI is really limited on Android. It exists, but it's really slow, and there are some hard limits imposed at the kernel level.

An alternative approach is VOC (http://pybee.org/voc) - this is compiler that takes Python code, and output Java bytecode. This means you can use the Android native UI components, because your Python code becomes indistinguishable from code written in Java. Combine with Briefcase (http://pybee.org/briefcase), and you can get an Android app with one command; combine with Toga (http://pybee.org/toga), and you can get a cross platform app using native system components.

If you want to see this in action, here's a video: https://www.youtube.com/watch?v=RisCgSIWwLA

(Full disclosure - I'm the primary author of these tools)


It would be neat if VOC had an interpreter in addition to the compiler, kind of like Gambit Scheme does (and other Lisp implementations). That way you would have the benefits of compiling to Java bytecode (to easily interoperate with the API) while also being able to use the interpreter to modify the app while it's running, for easy development (i.e. live reloading).

Without it, my feeling is that you lose the benefits of Python's dynamic nature and still suffer the drawbacks - the compiled code is ten times slower than CPython, according to the FAQ. Given those tradeoffs I'd prefer Kotlin, even though Python is my favourite language.


Ah, I remember watching the PyCon talk on VOC, a lot of cool work.

No disrespect ot the work, but I'm always a bit worried about a thing that starts with "we're swapping out the Python interpreter for a compiler". For example, this doesn't include generator support, which is a big part of my Python usage.

"Just" having the CPython bridge is so tempting, because your python code will work (modulo C extensions), plus we get all the performance work too. I believe you tried this, of course.

For VOC, is there a guide to calling Java code from Python code? I see you have Toga, but being able to write my own abstractions without much work would be neat.


Good news on the generator front - VOC fully supports generators, lambdas, passing functions as arguments, and all sorts of things that Python allows but Java (the language) doesn't.

As for a guide to calling Java from Python - we don't have any good documentation for this (yet), but it's entirely possible. Here's a sample Android application. If you're familiar with the Android APIs, you should be able to see the syntax conventions in place. https://gist.github.com/freakboy3742/7beb22c587e57240610777a...


That is good news. Perhaps the website could be updated to reflect that, it might be putting people off.

"there are some language features (like generators and context managers) that still need to be implemented"


Oh, so you simply import java packages in the same way you import python packages? That's a pretty transparent mechanism. Thanks for the clarifications!

I suppose that this is more "Python (the language) for other systems" more than "Python (the environment) for other systems". Is any of the standard library supported given this import scenario?


The full standard library is a work in progress; at the moment, there's only a couple of key parts of sys, os, and the like. But Ouroboros (https://github.com/pybee/ouroboros) is a project to develop a full standard library that can be integrated into any Python implementation. Effectively, you can use all the bits of the standard library that are written in Python by just compiling them; the rest requires native integration (which is the work in progress).


I always get the feeling that if the Android team got to choose the NDK would never been a thing, rather it was an upper management decision that they had to offer some kind of support for C and C++.

Even nowadays with Android N, the NDK is kind of WIP.


We did Computer Vision work on Android before OpenCV ported to Android and the NDK was the only realistic way to achieve any real-time video/image analysis performance. Using the NDK was tedious and HR-expensive but we had no choice. So in that case, we were glad the NDK was an option.


I am also glad it is there, it is also where I spend most of my Android coding time.

My point is that the way Android team deals with NDK users seems like the NDK was imposed on the team, and they don't spend much developer time on it, looking from the set of open issues, outdated documentation where ndk-build is still used instead of cmake, integration with aar is still in progress, and set of available APIs.

https://code.google.com/p/android/issues/list?can=2&q=NDK&so...

I cannot deny they have done lots of progress, but there seems not to be much interest in having a comparable experience to the Java tooling.


The NDK is essential for a large numbers of apps - including games and real time media applications.


Are you aware that it only got introduced in Android 2.2 right?

And that as I mentioned it still is a work-in-progress, 2nd class developer experience (down to forcing JNI calls to C++ libraries on the device like e.g. Skia), compared with the Java based tooling on the Android SDK.

It doesn't seem to get the love an essential tool is supposed to get.


This is what I've been looking for!

So I can create apps in pure python without using Kivy or sdl?

It sounds awesome.


Erm... RTD does none of those things. There's a default site theme that is specific to RTD - they don't try to impersonate anyone. They don't "lift" anything unless the project owner has opened an account and requested that their documentation be hosted on RTD.

I'm at a complete loss how you've even come to the impression that RTD does the things you claim it does - because it does nothing of the sort.


Why you put Read The Docs in the same category? RTD doesn't host anything unless you specifically set up an account and say you want to use them. They don't troll the web looking for projects, and hosting their docs whether they want them to or not.


The Fellow's immediate reporting chain is to a subcommittee of the DSF. Effectively, they're "working" for the DSF (although as a contractor, not as an employee); that committee is responsible for working out if they're doing what they're supposed to do, whether the DSF is getting good value for money, and so on.

The technical board is there to provide decisions on technical issues, whether they come from the Fellows or from the general population. I'd be very surprised if the Fellows didn't regularly identify issues that needed the technical board to render a decision, but the technical board doesn't have any specific control over the fellow.


Thanks for the feedback! I cover some of the "why" in the docs, but I agree the homepage could do a better job of making the case for a new UI toolkit.

The short version:

* System native widgets, not themes

* Installable via "pip install" - no third party or binary dependencies

* Not just naïve wrappers around widgets - capture the underlying use case and provide an API wrapper.

* Genuinely Python native. This means exploiting language specific features (like generators and context managers)


"Python native" is an oxymoron, given the language's interpreted nature. "Python-idiomatic" would probably be a more correct choice of words. But that's just me.


I think that is typically called "pythonic".


wxPython has system native widgets in every platform. wxWidgets has system native widgets in every platform, and it is the only one I know that provides that.

May be you are thinking about some other toolkit that's not wxWidgets.


FYI, Toga uses Cassowary as well - natively through Apple's implementation on OSX and iOS, and via a Python implementation of the algorithm (http://pybee.org/cassowary/) for GTK and Windows.


Spotify's UI is many things, but it doesn't even begin to appear system native.


Nor is I even Qt! It's a web view.


The application is Qt.


Given that the project was announced publicly 1 week ago, I wouldn't expect to see it in Debian (testing or otherwise) for a little while.


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

Search: