Chaquopy version 1.4.0

Posted on

This version adds the following feature:

  • The Python standard library is now loaded from compiled .pyc files by default (see documentation). As a result, startup of a minimal app is now 20-30% faster with Python 2, and 50-60% faster with Python 3. (Python 3 startup is still slower than Python 2, but only by 15-20%.)

And fixes the following bugs:

  • sys.stdin now returns EOF rather than blocking. If you want to run some code which takes interactive text input, see below for the new console app template.
  • The write method of sys.stdout and sys.stderr now returns the character count.
  • Very long lines written to sys.stdout and sys.stderr are now split into slightly smaller fragments, to allow for the shorter Logcat message length limit in recent versions of Android.
  • Fix a multi-threading deadlock.

Other notes:

  • Apps built with an unlicensed copy of the SDK are now limited to a run-time of 5 minutes.
  • console app template is now available, providing a framework for running text-based Python programs in an Android app. The demo app has been rewritten to use this framework, giving the following improvements:
    • Code input in the REPL is now executed on a background thread.
    • The REPL can now be terminated by typing exit(), then restarted by pressing back and re-entering the activity.
    • Stderr is now shown in red.
    • Scrolling, rotation and state restoration are all more reliable.