<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en-us" xmlns="http://www.w3.org/2005/Atom"><title>Simon Willison's Weblog: lukasz-langa</title><link href="http://simonwillison.net/" rel="alternate"/><link href="http://simonwillison.net/tags/lukasz-langa.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>Black 22.1.0</title><link href="https://simonwillison.net/2022/Jan/30/black/#atom-tag" rel="alternate"/><published>2022-01-30T01:23:39+00:00</published><updated>2022-01-30T01:23:39+00:00</updated><id>https://simonwillison.net/2022/Jan/30/black/#atom-tag</id><summary type="html">
    
&lt;p&gt;&lt;strong&gt;&lt;a href="https://black.readthedocs.io/en/stable/change_log.html#id1"&gt;Black 22.1.0&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
Black, the uncompromising code formatter for Python, has had its first stable non-beta release after almost four years of releases. I adopted Black a few years ago for all of my projects and I wouldn’t release Python code without it now—the productivity boost I get from not spending even a second thinking about code formatting and indentation is huge.&lt;/p&gt;

&lt;p&gt;I know Django has been holding off on adopting it until a stable release was announced, so hopefully that will happen soon.

    &lt;p&gt;&lt;small&gt;&lt;/small&gt;Via &lt;a href="https://twitter.com/llanga/status/1487530230512295940"&gt;Łukasz Langa&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;


    &lt;p&gt;Tags: &lt;a href="https://simonwillison.net/tags/django"&gt;django&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/python"&gt;python&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/black"&gt;black&lt;/a&gt;&lt;/p&gt;



</summary><category term="django"/><category term="python"/><category term="lukasz-langa"/><category term="black"/></entry><entry><title>Where does all the effort go? Looking at Python core developer activity</title><link href="https://simonwillison.net/2021/Oct/18/python-core-developer-activity/#atom-tag" rel="alternate"/><published>2021-10-18T20:21:32+00:00</published><updated>2021-10-18T20:21:32+00:00</updated><id>https://simonwillison.net/2021/Oct/18/python-core-developer-activity/#atom-tag</id><summary type="html">
    
&lt;p&gt;&lt;strong&gt;&lt;a href="https://lukasz.langa.pl/f15a8851-af26-4e94-a4b1-c146c57c9d20/"&gt;Where does all the effort go? Looking at Python core developer activity&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
Łukasz Langa used Datasette to explore 28,780 pull requests made to the CPython GitHub repository, using some custom Python scripts (and sqlite-utils) to load in the data.

    &lt;p&gt;&lt;small&gt;&lt;/small&gt;Via &lt;a href="https://twitter.com/llanga/status/1450161479114797057"&gt;@llanga&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;


    &lt;p&gt;Tags: &lt;a href="https://simonwillison.net/tags/python"&gt;python&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/datasette"&gt;datasette&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/sqlite-utils"&gt;sqlite-utils&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/lukasz-langa"&gt;lukasz-langa&lt;/a&gt;&lt;/p&gt;



</summary><category term="python"/><category term="datasette"/><category term="sqlite-utils"/><category term="lukasz-langa"/></entry><entry><title>Black Onlline Demo</title><link href="https://simonwillison.net/2018/Apr/25/black-onlline-demo/#atom-tag" rel="alternate"/><published>2018-04-25T05:17:44+00:00</published><updated>2018-04-25T05:17:44+00:00</updated><id>https://simonwillison.net/2018/Apr/25/black-onlline-demo/#atom-tag</id><summary type="html">
    
&lt;p&gt;&lt;strong&gt;&lt;a href="https://black.now.sh/"&gt;Black Onlline Demo&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
Black is “the uncompromising Python code formatter” by Łukasz Langa—it reformats Python code to a very carefully thought out styleguide, and provides almost no options for how code should be formatted. It’s reminiscent of gofmt. José Padilla built a handy online tool for trying it out in your browser.

    &lt;p&gt;&lt;small&gt;&lt;/small&gt;Via &lt;a href="https://twitter.com/llanga/status/986381413455806464"&gt;@llanga&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;


    &lt;p&gt;Tags: &lt;a href="https://simonwillison.net/tags/python"&gt;python&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/black"&gt;black&lt;/a&gt;&lt;/p&gt;



</summary><category term="python"/><category term="lukasz-langa"/><category term="black"/></entry></feed>