Python Trending Weekly
ISSUE 4

Python Trending Weekly #4 (2023-05-31)

2023-05-31 Season 1

TL;DR

A special edition recaps the 2023 Python Language Summit, where Mark Shannon and Guido van Rossum laid out the C API's pain points and core devs hashed out the language's future.

Articles 8
🦄

Articles & Tutorials

× 8
01 Three Talks on the C API pyfound.blogspot.com

These are three talks about the C API. First, Mark Shannon and Guido van Rossum mentioned that the current C API is not friendly to third-party extensions, often breaking their functionality when upgrading versions. The conclusion of the talk is to collect a list of problems with the C API and then work out a solution.

Another talk was about HPy, a new API for writing Python extension modules. It aims to address some of the limitations and problems of the CPython C API. One of its advantages is that the extension modules written with it can run on different Python implementations, such as CPython and PyPy. However, the speaker's idea of having it officially recommended was not supported, partly because it is not mature enough and more importantly because, as Guido commented, the top-down approach does not work. HPy seems to be a pretty good solution to overcome the problems with the C API, but it is too early to say if it will replace the C API.

02 Making the Global Interpreter Lock Optional pyfound.blogspot.com

We have introduced the nogil project many times, such as an article shared in the second issue of the weekly. At this summit, Sam Gross, the author of nogil, introduced the progress made in the past year, provided satisfactory data on the performance of nogil, and also proposed a clearer roadmap. What everyone is most worried about is still the problem of compiling it into two distributions and the resulting debugging difficulties. (We discussed it in an article in February)

03 Towards Native Profiling for Python pyfound.blogspot.com

Joannah Nanjekye's talk introduced Scalene, a sampling-based Python profiler that can differentiate machine code from Python code in the report. Python extensions written in C, C++, or Rust are compiled to machine code, making them difficult to profile through sampling. Scalene solves some technical challenges and is among the most popular profiling tools for Python. The speaker tentatively proposed integrating Scalene's achievements into the standard library cProfile but received no response. Finally, the library was also compared to the perf profiler introduced in Python 3.12.

Sample-based Profiling
04 What is the stdlib for? pyfound.blogspot.com

The question posed by Brett Cannon was essentially: What role should the standard library play? In the early days of Python, the language prided itself on being "batteries included," with an extensive standard library. However, with the rise of third-party libraries and the ease of installing them via PyPI, many of the standard library modules are no longer as valuable. The consensus among the summit attendees was that the standard library should focus on helping users write better Python code. This means that the ongoing "stdlib slimming" efforts will continue, while new additions to the standard library in the future will be more judiciously considered.

05 Pattern Matching, __match__, and View Patterns pyfound.blogspot.com

Pattern matching syntax was a major feature in 3.10, but Sullivan argued that its capabilities are rather limited and thus proposed further directions for pattern matching. Attendees widely agreed that the pattern matching syntax should be enhanced, however, there is no consensus on whether a new magic method __match__ should be introduced or if another approach should be taken. The article includes many code samples and references on pattern matching, readers who are interested in this topic can check it out.

06 Python on Mobile: State of the Union pyfound.blogspot.com

Russell Keith-Magee introduced BeeWare, which aims to make it easy to run Python on mobile platforms such as Android and iOS. The project is backed by Anaconda, and the speaker appealed for "Tier-3" support from CPython. The talk covered support for CI test suites on mobile platforms, what value sys.platform should have on mobile, and how CPython binary artifacts should be published for mobile platforms. Python on mobile is something to watch!

07 Burnout is Real pyfound.blogspot.com

At the summit, Guido talked about open source burnout, strategies for dealing with burnout, and how to avoid burnout. In many cases, open source contributors work for the love of it. However, large open source projects often involve complex scenarios, trivial discussions, diverse interpersonal collaborations, and frequently conflicting viewpoints or ideas, all of which can easily lead to fatigue and burnout. (P.S. If you follow tech news, you will have seen the recent uproar in the Rust community over a core developer feud. The development of open source communities is a major challenge. Fortunately, this summit reflects that the Python community is developing healthily.)

Burnout is Real
08 Lightning Talks pyfound.blogspot.com

Three short lightning talks were presented, on the topics of: Let's support LLVM-BOLT as an official feature, Mechanism for implementing lazy import in Python, and Making modules callable (PEP-713 has been proposed).

These were all very interesting topics that were discussed at the summit this year.

Quite a few of these have already seen some progress (the event did happen a month ago after all), while some will likely take a longer time to land (looking at you, nogil and Python on phones).

As a bonus, here are two articles about the progress of the Fast CPython project: Faster CPython at PyCon, part one 、Faster CPython at PyCon, part two. Python 3.11 has already seen quite a few performance improvements, and future versions promise even more.

🎁 Python Trending Weekly 🎁 organizes its content into seasons, with every 30 issues forming a season. The highlights from the first season have been compiled for your convenience. You can access them online here (Chinese).

ESC
↑↓ select · ↵ open175 issues