#455: Gilded Python and Beyond
About the show
Sponsored by us! Support our work through:
Connect with the hosts
- Michael: @mkennedy@fosstodon.org / @mkennedy.codes (bsky)
- Brian: @brianokken@fosstodon.org / @brianokken.bsky.social
- Show: @pythonbytes@fosstodon.org / @pythonbytes.fm (bsky)
Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Monday at 10am PT. Older video versions available there too.
Finally, if you want an artisanal, hand-crafted digest of every week of the show notes in email form? Add your name and email to our friends of the show list, we'll never share it.
Michael #1: Cyclopts: A CLI library
- A CLI library that fixes 13 annoying issues in Typer
- Much of Cyclopts was inspired by the excellent Typer library.
- Despite its popularity, Typer has some traits that I (and others) find less than ideal. Part of this stems from Typer's age, with its first release in late 2019, soon after Python 3.8's release. Because of this, most of its API was initially designed around assigning proxy default values to function parameters. This made the decorated command functions difficult to use outside of Typer. With the introduction of <code>Annotated</code> in python3.9, type-hints were able to be directly annotated, allowing for the removal of these proxy defaults.
- The 13:
Brian #2: The future of Python web services looks GIL-free
- Giovanni Barillari
“Python 3.14 was released at the beginning of the month. This release was particularly interesting to me because of the improvements on the "free-threaded" variant of the interpreter.
Specifically, the two major changes when compared to the free-threaded variant of Python 3.13 are:
- Free-threaded support now reached phase II, meaning it's no longer considered experimental
- The implementation is now completed, meaning that the workarounds introduced in Python 3.13 to make code sound without the GIL are now gone, and the free-threaded implementation now uses the adaptive interpreter as the GIL enabled variant. These facts, plus additional optimizations make the performance penalty now way better, moving from a 35% penalty to a 5-10% difference.”
- Lots of benchmark data, both ASGI and WSGI
- Lots of great thoughts in the “Final Thoughts” section, including
- “On asynchronous protocols like ASGI, despite the fact the concurrency model doesn't change that much – we shift from one event loop per process, to one event loop per thread – just the fact we no longer need to scale memory allocations just to use more CPU is a massive improvement. ”
- “… for everybody out there coding a web application in Python: simplifying the concurrency paradigms and the deployment process of such applications is a good thing.”
- “… to me the future of Python web services looks GIL-free.”
Michael #3: Free-threaded GC
- The free-threaded build of Python uses a different garbage collector implementation than the default GIL-enabled build.
- The Default GC: In the standard CPython build, every object that supports garbage collection (like lists or dictionaries) is part of a per-interpreter, doubly-linked list. The list pointers are contained in a PyGC_Head structure.
- The Free-Threaded GC: Takes a different approach. It scraps the PyGC_Head structure and the linked list entirely. Instead, it allocates these objects from a special memory heap managed by the "mimalloc" library. This allows the GC to find and iterate over all collectible objects using mimalloc's data structures, without needing to link them together manually.
- The free-threaded GC does NOT support "generations”
- By marking all objects reachable from these known roots, we can identify a large set of objects that are definitely alive and exclude them from the more expensive cycle-finding part of the GC process.
- Overall speedup of the free-threaded GC collection is between 2 and 12 times faster than the 3.13 version.
Brian #4: Polite lazy imports for Python package maintainers
- Will McGugan commented on a LI post by Bob Belderbos regarding lazy importing
“I'm excited about this PEP.
I wrote a lazy loading mechanism for Textual's widgets. Without it, the entire widget library would be imported even if you needed just one widget. Having this as a core language feature would make me very happy.”
https://github.com/Textualize/textual/blob/main/src/textual/widgets/__init__.py
Well, I was excited about Will’s example for how to, essentially, allow users of your package to import only the part they need, when they need it.
- So I wrote up my thoughts and an explainer for how this works.
- Special thanks to Trey Hunner’s Every dunder method in Python, which I referenced to understand the difference between
__getattr__()and__getattribute__().
Extras
Brian:
- Started writing a book on Test Driven Development.
- Should have an announcement in a week or so.
- I want to give folks access while I’m writing it, so I’ll be opening it up for early access as soon as I have 2-3 chapters ready to review. Sign up for the pythontest newsletter if you’d like to be informed right away when it’s ready. Or stay tuned here.
Michael:
- New course!!! Agentic AI Programming for Python
- I’ll be on Vanishing Gradients as a guest talking book + ai for data scientists
- OpenAI launches ChatGPT Atlas
- https://github.com/jamesabel/ismain by James Abel
- Pets in PyCharm
Joke: You're absolutely right
Episode Transcript
Collapse transcript
00:00
00:05
00:10
00:11
00:13
00:17
00:20
00:26
00:29
00:32
00:38
00:41
00:45
00:47
00:50
00:57
01:00
01:04
01:10
01:14
01:18
01:19
01:28
01:36
01:39
01:44
01:47
01:51
01:53
01:55
02:00
02:02
02:04
02:09
02:13
02:16
02:20
02:23
02:26
02:27
02:29
02:33
02:37
02:39
02:40
02:43
02:44
02:46
02:48
02:49
02:51
02:55
02:57
03:02
03:04
03:08
03:12
03:15
03:16
03:19
03:23
03:25
03:27
03:31
03:37
03:40
03:44
03:48
03:55
04:02
04:05
04:09
04:12
04:20
04:23
04:25
04:26
04:30
04:33
04:39
04:44
04:49
04:52
04:58
05:00
05:05
05:08
05:09
05:14
05:18
05:20
05:21
05:24
05:26
05:31
05:33
05:39
05:43
05:47
05:53
05:57
05:59
06:01
06:02
06:04
06:06
06:17
06:27
06:31
06:32
06:33
06:34
06:35
06:40 Oh, did you?
06:41 Checking out.
06:41
06:42
06:44
06:50
06:53
06:56
06:59 Oh, man.
07:00
07:01
07:04
07:08
07:09
07:11
07:17
07:22
07:32
07:33
07:37
07:40
07:42
07:43
07:46
07:47
07:48
07:49
07:50
07:51
07:53
07:57
08:00
08:04
08:05
08:09
08:11
08:16
08:18
08:21
08:29
08:36
08:42
08:44
08:49
08:52
08:58
08:59
09:00
09:04
09:06
09:07
09:10
09:19
09:25
09:30
09:36
09:42
09:49
09:56
10:05
10:13
10:19
10:27
10:35
10:40
10:47
10:51
10:54
11:00
11:06
11:07 We did. You did.
11:09
11:13
11:17
11:31
11:35
11:37
11:38
11:49
11:56
12:00
12:08
12:13
12:20
12:25
12:27
12:30
12:33
12:34
12:35
12:36
12:40
12:44
12:47
12:52
12:54
12:58
13:02
13:03
13:05
13:08
13:08
13:10
13:16
13:19
13:23
13:26
13:28
13:33
13:37
13:43
13:47
13:51
13:53
13:57
14:00
14:04
14:08 - Yeah.
14:08
14:10
14:11
14:14
14:17
14:23
14:26
14:31
14:39
14:44
14:49
14:57
15:04
15:09
15:15
15:20
15:25
15:29
15:34
15:36
15:42
15:44
15:45
15:49
15:54
15:57
15:59
16:01
16:05
16:10
16:16
16:19
16:22
16:27
16:32
16:37
16:39
16:41
16:41
16:45
16:47
16:52
16:54
16:56
17:04
17:06
17:09
17:13
17:17
17:20
17:23
17:28
17:33
17:36
17:39
17:43
17:45
17:50
17:52
17:54
17:55
17:56
18:02
18:08
18:13
18:19 than the 3.13 version wow that's pretty yeah that's pretty wild right yeah yeah so depending on how
18:25
18:27
18:30
18:32
18:35
18:37
18:39
18:41
18:43
18:46
18:46
18:48
18:51
18:52
18:53
18:58
19:01
19:07
19:14
19:15
19:16
19:20
19:21
19:23
19:28
19:33
19:33
19:37
19:40
19:44
19:47
19:56
20:03
20:08
20:13
20:18
20:25
20:30
20:37
20:41
20:49
20:55
20:57
21:00
21:02
21:08
21:15
21:17
21:18
21:19
21:20
21:24
21:27
21:31
21:35 Oh, okay.
21:36
21:36
21:39
21:40
21:41
21:42
21:49
21:53
21:54
21:54 It just is.
21:55
22:00
22:02
22:03
22:04
22:05
22:09
22:13
22:16
22:17
22:19
22:24
22:28
22:34 That's how you get around the GIL.
22:35
22:36
22:43
22:47
22:53
22:56
22:57
22:58
22:59
23:01
23:02
23:04
23:05
23:09
23:14
23:19
23:22
23:26
23:34
23:37
23:38
23:45
23:55
23:58
24:00
24:01
24:04
24:10
24:17
24:26
24:33
24:40
24:42
24:43
24:44
24:45
24:49
24:58
25:02
25:04
25:06
25:09
25:10
25:15
25:21
25:25
25:27
25:32
25:40
25:46
25:50
25:56
26:00
26:04
26:11
26:13
26:16
26:18
26:19
26:20
26:28 Very nice.
26:28
26:35
26:40
26:45
26:53
27:00
27:08
27:12
27:18
27:23
27:28
27:30
27:31
27:32
27:33
27:34
27:34
27:36
27:37
27:38
27:39
27:40
27:40
27:47
27:53
27:57
28:01
28:06
28:07
28:11
28:16
28:22
28:24
28:25
28:29
28:34
28:38
28:41
28:46
28:48
28:52
28:56
28:59
29:01
29:03
29:07
29:09
29:12
29:13
29:15
29:20
29:24
29:25
29:28
29:32
29:39
29:41
29:43
29:45
29:47
29:49
29:50
29:52
29:53
30:00
30:02
30:03
30:05
30:07
30:08
30:10
30:13
30:17 Cool.
30:18
30:24
30:28
30:31
30:34
30:38
30:46
30:47
30:52
30:56
30:59
31:03
31:07 You don't have to do any, you don't have to, but you know, like how do you get it to give
31:10
31:11
31:15
31:16
31:20
31:24
31:25
31:27
31:30
31:31
31:31
31:37
31:40
31:44
31:47
31:50
31:52
31:53
31:54
31:57
31:58
32:05
32:06
32:08
32:09
32:10
32:11
32:12
32:13
32:15
32:18
32:19
32:21
32:23
32:25
32:32
32:37
32:42
32:43
32:45
32:47
32:50
32:54
32:55
33:01
33:07
33:10
33:11
33:15
33:20
33:22
33:23 Yeah.
33:24 Or what I would rather see is if isn't main, here's what I would like to see, but
33:28
33:30
33:36 me, and then when it's done parsing the file, then it runs it because even this,
33:42
33:46
33:47
33:50
33:51
33:53
33:57
34:01
34:06
34:10
34:12
34:12
34:16
34:20
34:22
34:26
34:30
34:33
34:35
34:38
34:38
34:39
34:40
34:41
34:42
34:43
34:47
34:53
34:57
34:57
35:00
35:03
35:03
35:04
35:05
35:07
35:10
35:11
35:13
35:14
35:19
35:23
35:26
35:27
35:29
35:35
35:36
35:37
35:38
35:43
35:44
35:46
35:47
35:50 And I was going to get one of the cheaper ones.
35:53
35:57
35:58
36:04
36:05
36:06
36:07
36:13
36:17
36:18
36:22
36:26
36:30
36:32
36:36
36:36
36:37
36:39
36:41
36:47
36:48
36:48
36:50
36:50
36:52
36:54
36:55
36:55
37:01
37:05
37:08
37:08
37:11
37:12
37:12
37:13
37:13
37:17
37:18
37:20
37:21
37:23
37:25
37:28
37:32 Oh, dear.
37:33
37:35
37:38
37:42
37:48
37:55
38:00
38:10
38:15
38:17
38:18
38:19
38:20
38:22
38:25
38:31
38:33
38:34
38:36
38:36
38:39
38:40
38:43
38:45
38:47
38:47
38:49
38:50



