<div dir="ltr"><div>Hi Guido,</div><div><br></div>I'll glady stop arguing about Kivy vs Toga. The only reason I brought it up at all is because I keep hearing arguments that seem to dispute that getting a libPython build working *is* the first step. You've now put that argument to bed, so I agree - lets move on.<div><div><br></div><div>For what it's worth, I've got a reasonable handle on how to compile libPython for mobile at this point - what I don't have is a good handle on is the intricacies of Python's build system, and in particular, how to drive Autoconf to support cross-platform builds. </div><div><br></div><div>I've almost worked out the patches to the Python 2.7.1 source tree to generate an iOS-compatible libPython. Once I've got that working, I'm planning to merge those changes up to the tip of 2.7 and 3.X, and submit those patches for inclusion in the source tree. However, at the moment, I'm hitting problems with cross-platform execution in the libinstall target; I'm happy to share what I have so far with anyone interested in collaborating.</div><div><br></div><div>Yours,</div><div>Russ Magee %-)</div><div><br></div><div><div><div class="gmail_extra"><div class="gmail_quote">On Thu, Jan 29, 2015 at 12:31 PM, Guido van Rossum <span dir="ltr"><<a href="mailto:guido@python.org" target="_blank">guido@python.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Can we stop arguing about Kivy vs Toga and focus on the one thing that they have in common, the need for a working Python 3 port on Android and iOS (for a start)? This is apparently mostly a matter of solving a lot of small things with the build system, dependencies, improved config files, and getting stuff integrated upstream so it can be built out of the box, right? After that the layers 2-4 stuff can compete, but everybody wins when layer 1 is dealt with (even imperfectly). It's pretty sad that nobody apparently knows how to reproduce the build steps, and everybody just copies the one Python 2.7.{1,2} binary that someone built out of sheer willpower.<br></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Wed, Jan 28, 2015 at 8:04 PM, Russell Keith-Magee <span dir="ltr"><<a href="mailto:russell@keith-magee.com" target="_blank">russell@keith-magee.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr"><br><div class="gmail_extra">Hi Bill,</div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jan 29, 2015 at 10:41 AM, Bill Janssen <span dir="ltr"><<a href="mailto:janssen@parc.com" target="_blank">janssen@parc.com</a>></span> wrote:<span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>Russell Keith-Magee <<a href="mailto:russell@keith-magee.com" target="_blank">russell@keith-magee.com</a>> wrote:<br></span><span><br>
>  b) I don't like the Kivy build tools. They're a lot more complex than they<br>
> need to be.<br>
<br>
</span>I didn't find it troublesome, but of course this wasn't my first rodeo.<br>
I'd certainly agree it's not a push-button solution.  So, what would a<br>
less complex system be like?<span><br></span></blockquote><div><br></div></span><div>A less complex system is what Toga does. </div><div><br></div><div> 1. You use cookiecutter to generate a stub project. This gives you the full source tree for a project you can load into XCode (iOS), or build with ant (Android), including a "hello world" __main__.py</div><div><br></div><div> 2. You download the pre-compiled Python.framework for iOS, or libPython for Android, and copy it into a libs directory</div><div><br></div><div> 3. You start writing Python code, replacing the __main__.py with your own logic.</div><div><br></div><div> 4. You compile and deploy your project using XCode/ant.</div><div><br></div><div>Compare this with Kivy - My experience was spending a couple of days getting the Kivy build process to actually work - trying to find versions of the Android NDK that aren't being distributed any more (but are the only hard coded options in the build system), working out that the provided code doesn't work with the most recent versions of Cython, and sourcing libraries for all sorts of dependencies, so that I could compile SDL and a bunch of OpenGL stuff - none of which I needed. It took me a couple of days to get to "hello world" - and all because of something that could have been shipped as a pre-compiled binary.</div><span><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>
> I'm going to guess the Kivy people are all Linux users, because<br>
> they don't appear to have worked out that binary compatibility is a thing.<br>
<br>
</span>Sorry -- why is that a Linux thing?<br></blockquote><div><br></div></span><div>If I want to distribute an app for OS/X or Windows, I give you an executable, and It Just Works (tm). Source *might* be provided as an option in the interest of being open source, but it's not how you distribute anything in practice. The "Linux way" for distribution is to distribute source, and tell you to compile it yourself. Distributing binaries is an afterthought, because ABI compatibility makes building and distributing binaries painful. Most projects don't have the infrastructure to distribute binaries for multiple platforms, so unless you can get the OS to provide a recent binary for you, you compile from source.</div><div><br></div><div>I see reflections of that bias here. Even though ABI compatibility exists for both iOS and Android as platforms, Kivy chooses to distribute as source.</div><span><div> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>
> You don't need to have every user compile Python and the rest of the Kivy<br>
> stack - you can just ship a binary library, and it will work on every phone<br>
> with the same hardware (I know, because Toga does this. The Toga<br>
> bootstrapping process is "clone this repo, and copy this file". You could<br>
> reduce this to "clone this repo" if you were happy putting binary artefacts<br>
> into version control.)<br>
<br>
</span>Sure.<br>
<span><br>
>  c) Kivy's build tools are Python 2.7.1 only on iOS, and 2.7.2 on Android;<br>
<br>
</span>I believe the mobile platform packaging tools are still stuck at 2.7.<br>
Kivy 1.8+ will run on Python 3 on desktop, though.</blockquote><div><br></div></span><div>Yes - but in practice, the absence of Python 3 on Mobile means that Kivy on Mobile is Python 2 only, and an old version at that. </div><span><div> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>
> and if you build them on OSX, when you're on the device, they report<br>
> sys.platform as "darwin".<br>
<br>
</span>Seems like a bug; I imagine you're suggesting that the Kivy build<br>
process should patch that file to return "android"?  Although I never<br>
know what to look at to get that platform info correctly -- this is a<br>
larger Python issue.<br></blockquote><div><br></div></span><div>Yes, it's a bug (or at least a missing feature). The build system patches that Kivy use doesn't introduce anything for targeted builds (i.e., using an x86 platform to compile ARM64 binaries - which is what you're doing when you compile for mobile), and doesn't provide a platform definition for mobile. </div><span><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
And kivy.utils.platform seems to return the proper thing.<span><br></span></blockquote><div><br></div></span><div>So... instead of they've introduced their own way to get access to information that Python already has a standard way of providing. </div><span><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>
> Going back to my post<br>
<br>
</span>For those of you following along at home, here's Jeff's list (I had to<br>
go and look it up).</blockquote><div> </div></span><div>Jeff?</div><span><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>
>  1. A library build of Python<br>
>  2. Templates to stub out a working Python project<br>
>  3. Libraries to do bridge between native language environments and Python<br>
>  (for me, that's Rubicon)<br>
>  4. Libraries for utilising native system services (for me, that's Toga)<br>
<br>
</span><span>> - I agree with Kivy on layer 1, and I was able to use<br>
> their build tools to bootstrap my own. However, I have very different<br>
> opinions on layers 2-4.<br>
<br>
</span>Just to outline the Kivy approach to 2-4: Kivy doesn't really do 2 -- it<br>
provides examples, and you're supposed to extrapolate from them.  I<br>
guess that's a form of template.  For #3, there's Kivy's "pyjnius" (to<br>
access Java via JNI) (<a href="https://github.com/kivy/pyobjus" target="_blank">https://github.com/kivy/pyobjus</a>) and "pyobjus" (to<br>
access Objective-C via runtime reflection)<br>
(<a href="https://github.com/kivy/pyjnius" target="_blank">https://github.com/kivy/pyjnius</a>).  For #4, as I said, there's "plyer"<br>
(<a href="https://github.com/kivy/plyer" target="_blank">https://github.com/kivy/plyer</a>).</blockquote><div><br></div></span><div>I'd also include most of Kivy in #4 as well, because that's how they're tackling the widget issue.<br></div><span><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">We can have a separate discussion sometime about Django vs. Tornado :-).<br></blockquote><div><br></div></span><div>So - a monkey knife-fight at dawn, then :-)</div><div><br></div><div>Yours,</div><div>Russ Magee %-) </div></div></div></div>
<br></div></div><span class="">_______________________________________________<br>
Mobile-sig mailing list<br>
<a href="mailto:Mobile-sig@python.org" target="_blank">Mobile-sig@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/mobile-sig" target="_blank">https://mail.python.org/mailman/listinfo/mobile-sig</a><br>
<br></span></blockquote></div><span class="HOEnZb"><font color="#888888"><br><br clear="all"><br>-- <br><div>--Guido van Rossum (<a href="http://python.org/~guido" target="_blank">python.org/~guido</a>)</div>
</font></span></div>
</blockquote></div><br></div></div></div></div></div>