DiscoverPython Bytes#455 Gilded Python and Beyond
#455 Gilded Python and Beyond

#455 Gilded Python and Beyond

Update: 2025-10-27
Share

Description

Topics covered in this episode:


Watch on YouTube


About the show



Sponsored by us! Support our work through:





Connect with the hosts





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





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



Comments 
00:00
00:00
x

0.5x

0.8x

1.0x

1.25x

1.5x

2.0x

3.0x

Sleep Timer

Off

End of Episode

5 Minutes

10 Minutes

15 Minutes

30 Minutes

45 Minutes

60 Minutes

120 Minutes

#455 Gilded Python and Beyond

#455 Gilded Python and Beyond

Michael Kennedy and Brian Okken