<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en-us" xmlns="http://www.w3.org/2005/Atom"><title>Simon Willison's Weblog: beeware</title><link href="http://simonwillison.net/" rel="alternate"/><link href="http://simonwillison.net/tags/beeware.atom" rel="self"/><id>http://simonwillison.net/</id><updated>2024-10-07T19:36:52+00:00</updated><author><name>Simon Willison</name></author><entry><title>What's New In Python 3.13</title><link href="https://simonwillison.net/2024/Oct/7/whats-new-in-python-313/#atom-tag" rel="alternate"/><published>2024-10-07T19:36:52+00:00</published><updated>2024-10-07T19:36:52+00:00</updated><id>https://simonwillison.net/2024/Oct/7/whats-new-in-python-313/#atom-tag</id><summary type="html">
    
&lt;p&gt;&lt;strong&gt;&lt;a href="https://docs.python.org/3/whatsnew/3.13.html"&gt;What&amp;#x27;s New In Python 3.13&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
It's Python 3.13 release day today. The big signature features  are a &lt;a href="https://docs.python.org/3.13/whatsnew/3.13.html#whatsnew313-better-interactive-interpreter"&gt;better REPL&lt;/a&gt; with improved error messages, an option to &lt;a href="https://docs.python.org/3.13/whatsnew/3.13.html#free-threaded-cpython"&gt;run Python without the GIL&lt;/a&gt; and the beginnings of &lt;a href="https://docs.python.org/3.13/whatsnew/3.13.html#an-experimental-just-in-time-jit-compiler"&gt;the new JIT&lt;/a&gt;. Here are some of the smaller highlights I spotted while perusing the release notes.&lt;/p&gt;
&lt;p&gt;iOS and Android are both now &lt;a href="https://docs.python.org/3.13/whatsnew/3.13.html#support-for-mobile-platforms"&gt;Tier 3 supported platforms&lt;/a&gt;, thanks to the efforts of Russell Keith-Magee and the &lt;a href="https://beeware.org/"&gt;Beeware&lt;/a&gt; project. Tier 3 &lt;a href="https://peps.python.org/pep-0011/#tier-3"&gt;means&lt;/a&gt; "must have a reliable buildbot" but "failures on these platforms do not block a release". This is still a really big deal for Python as a mobile development platform.&lt;/p&gt;
&lt;p&gt;There's a whole bunch of smaller stuff relevant to SQLite.&lt;/p&gt;
&lt;p&gt;Python's &lt;a href="https://docs.python.org/3.13/library/dbm.html"&gt;dbm module&lt;/a&gt; has long provided a disk-backed key-value store against multiple different backends. 3.13 introduces a new backend based on SQLite, and makes it the default.&lt;/p&gt;
&lt;div class="highlight highlight-text-python-console"&gt;&lt;pre&gt;&amp;gt;&amp;gt;&amp;gt; &lt;span class="pl-k"&gt;import&lt;/span&gt; dbm
&amp;gt;&amp;gt;&amp;gt; db &lt;span class="pl-k"&gt;=&lt;/span&gt; dbm.open(&lt;span class="pl-s"&gt;&lt;span class="pl-pds"&gt;"&lt;/span&gt;/tmp/hi&lt;span class="pl-pds"&gt;"&lt;/span&gt;&lt;/span&gt;, &lt;span class="pl-s"&gt;&lt;span class="pl-pds"&gt;"&lt;/span&gt;c&lt;span class="pl-pds"&gt;"&lt;/span&gt;&lt;/span&gt;)
&amp;gt;&amp;gt;&amp;gt; db[&lt;span class="pl-s"&gt;&lt;span class="pl-pds"&gt;"&lt;/span&gt;hi&lt;span class="pl-pds"&gt;"&lt;/span&gt;&lt;/span&gt;] &lt;span class="pl-k"&gt;=&lt;/span&gt; &lt;span class="pl-c1"&gt;1&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The &lt;code&gt;"c"&lt;/code&gt; option means "Open database for reading and writing, creating it if it doesn’t exist".&lt;/p&gt;
&lt;p&gt;After running the above, &lt;code&gt;/tmp/hi&lt;/code&gt; was a SQLite database containing the following data:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;sqlite3 /tmp/hi .dump
PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
CREATE TABLE Dict (
    key BLOB UNIQUE NOT NULL,
    value BLOB NOT NULL
  );
INSERT INTO Dict VALUES(X'6869',X'31');
COMMIT;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The &lt;code&gt;dbm.open()&lt;/code&gt; function can detect which type of storage is being referenced. I found the implementation for that in the &lt;a href="https://github.com/python/cpython/blob/v3.13.0/Lib/dbm/__init__.py#L98-L189"&gt;whichdb(filename)&lt;/a&gt; function.&lt;/p&gt;
&lt;p&gt;I was hopeful that this change would mean Python 3.13 deployments would be guaranteed to ship with a more recent SQLite... but it turns out 3.15.2 is &lt;a href="https://www.sqlite.org/changes.html#version_3_15_2"&gt;from November 2016&lt;/a&gt; so still quite old:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;SQLite 3.15.2 or newer is required to build the &lt;a href="https://docs.python.org/3.13/library/sqlite3.html#module-sqlite3" title="sqlite3: A DB-API 2.0 implementation using SQLite 3.x."&gt;&lt;code&gt;sqlite3&lt;/code&gt;&lt;/a&gt; extension module. (Contributed by Erlend Aasland in &lt;a href="https://github.com/python/cpython/issues/105875"&gt;gh-105875&lt;/a&gt;.)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The &lt;code&gt;conn.iterdump()&lt;/code&gt; SQLite method now accepts an optional &lt;code&gt;filter=&lt;/code&gt; keyword argument taking a LIKE pattern for the tables that you want to dump. I found &lt;a href="https://github.com/python/cpython/commit/1a10437a14b13100bdf41cbdab819c33258deb65#diff-445686d2c16ed3989d2adeac33729d1b06765dcf315f117fe8668be101b1e269R35"&gt;the implementation for that here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;And one last change which caught my eye because I could imagine having code that might need to be updated to reflect the new behaviour:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;a href="https://docs.python.org/3.13/library/pathlib.html#pathlib.Path.glob" title="pathlib.Path.glob"&gt;&lt;code&gt;pathlib.Path.glob()&lt;/code&gt;&lt;/a&gt; and &lt;a href="https://docs.python.org/3.13/library/pathlib.html#pathlib.Path.rglob" title="pathlib.Path.rglob"&gt;&lt;code&gt;rglob()&lt;/code&gt;&lt;/a&gt; now return both files and directories if a pattern that ends with "&lt;code&gt;**&lt;/code&gt;" is given, rather than directories only. Add a trailing slash to keep the previous behavior and only match directories.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;With the release of Python 3.13, Python 3.8 is &lt;a href="https://discuss.python.org/t/python-3-8-is-now-officially-eol/66983"&gt;officially end-of-life&lt;/a&gt;. Łukasz Langa:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;If you're still a user of Python 3.8, I don't blame you, it's a lovely version. But it's time to move on to newer, greater things. Whether it's typing generics in built-in collections, pattern matching, &lt;code&gt;except*&lt;/code&gt;, low-impact monitoring, or a new pink REPL, I'm sure you'll find your favorite new feature in one of the versions we still support. So upgrade today!&lt;/p&gt;
&lt;/blockquote&gt;


    &lt;p&gt;Tags: &lt;a href="https://simonwillison.net/tags/android"&gt;android&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/mobile"&gt;mobile&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/python"&gt;python&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/russell-keith-magee"&gt;russell-keith-magee&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/sqlite"&gt;sqlite&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/ios"&gt;ios&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/lukasz-langa"&gt;lukasz-langa&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/beeware"&gt;beeware&lt;/a&gt;&lt;/p&gt;



</summary><category term="android"/><category term="mobile"/><category term="python"/><category term="russell-keith-magee"/><category term="sqlite"/><category term="ios"/><category term="lukasz-langa"/><category term="beeware"/></entry><entry><title>Russell Keith-Magee: Build a cross-platform app with BeeWare</title><link href="https://simonwillison.net/2024/Jul/1/build-a-cross-platform-app-with-beeware/#atom-tag" rel="alternate"/><published>2024-07-01T22:49:13+00:00</published><updated>2024-07-01T22:49:13+00:00</updated><id>https://simonwillison.net/2024/Jul/1/build-a-cross-platform-app-with-beeware/#atom-tag</id><summary type="html">
    
&lt;p&gt;&lt;strong&gt;&lt;a href="https://www.youtube.com/watch?v=New2JLvWxiE&amp;amp;list=PL2Uw4_HvXqvYhjub9bw4uDAmNtprgAvlJ"&gt;Russell Keith-Magee: Build a cross-platform app with BeeWare&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
The session videos from PyCon US 2024 have started &lt;a href="https://www.youtube.com/playlist?list=PL2Uw4_HvXqvYhjub9bw4uDAmNtprgAvlJ"&gt;showing up on YouTube&lt;/a&gt;. So far just for the tutorials, which gave me a chance to catch up on the BeeWare project with this tutorial run by Russell Keith-Magee.&lt;/p&gt;
&lt;p&gt;Here are the &lt;a href="https://pycon-assets.s3.amazonaws.com/2024/media/presentation_slides/41/2024-05-08T23%3A38%3A41.030747/Build_a_cross_platform_GUI_app_with_Be_NscyZ66.pdf"&gt;accompanying slides (PDF)&lt;/a&gt;, or you can work through the &lt;a href="https://docs.beeware.org/en/latest/tutorial/tutorial-0.html"&gt;official tutorial&lt;/a&gt; in the BeeWare documentation.&lt;/p&gt;
&lt;p&gt;The tutorial did a great job of clarifying the difference between &lt;a href="https://briefcase.readthedocs.io/"&gt;Briefcase&lt;/a&gt; and &lt;a href="https://toga.readthedocs.io/"&gt;Toga&lt;/a&gt;, the two key components of the BeeWare ecosystem - each of which can be used independently of the other.&lt;/p&gt;
&lt;p&gt;Briefcase solves packaging and installation: it allows a Python project to be packaged as a native application across macOS, Windows, iOS, Android and various flavours of Linux.&lt;/p&gt;
&lt;p&gt;Toga is a toolkit for building cross-platform GUI applications in Python. A UI built using Toga will render with native widgets across all of those supported platforms, and experimental new modes also allow Toga apps to run as SPA web applications and as Rich-powered terminal tools (via &lt;a href="https://pypi.org/project/toga-textual/"&gt;toga-textual&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;Russell is excellent at both designing and presenting tutorial-style workshops, and I made a bunch of mental notes on the structure of this one which I hope to apply to my own in the future.


    &lt;p&gt;Tags: &lt;a href="https://simonwillison.net/tags/python"&gt;python&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/russell-keith-magee"&gt;russell-keith-magee&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/beeware"&gt;beeware&lt;/a&gt;&lt;/p&gt;



</summary><category term="python"/><category term="russell-keith-magee"/><category term="beeware"/></entry><entry><title>PEP 738 – Adding Android as a supported platform</title><link href="https://simonwillison.net/2024/Apr/1/pep-738/#atom-tag" rel="alternate"/><published>2024-04-01T23:57:28+00:00</published><updated>2024-04-01T23:57:28+00:00</updated><id>https://simonwillison.net/2024/Apr/1/pep-738/#atom-tag</id><summary type="html">
    
&lt;p&gt;&lt;strong&gt;&lt;a href="https://peps.python.org/pep-0738/"&gt;PEP 738 – Adding Android as a supported platform&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
The BeeWare project got PEP 730—Adding iOS as a supported platform—accepted by the Python Steering Council in December, now it’s Android’s turn. Both iOS and Android will be supported platforms for CPython 3.13.&lt;/p&gt;

&lt;p&gt;It’s been possible to run custom compiled Python builds on those platforms for years, but official support means that they’ll be included in Python’s own CI and release process.

    &lt;p&gt;&lt;small&gt;&lt;/small&gt;Via &lt;a href="https://beeware.org/news/buzz/march-2024-status-update/"&gt;BeeWare March 2024 Status Update&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;


    &lt;p&gt;Tags: &lt;a href="https://simonwillison.net/tags/android"&gt;android&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/python"&gt;python&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/ios"&gt;ios&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/beeware"&gt;beeware&lt;/a&gt;&lt;/p&gt;



</summary><category term="android"/><category term="python"/><category term="ios"/><category term="beeware"/></entry></feed>