PyLondinium 2019 Notes

The City formerly known as Londinium

PyLondinium ran for the second time last weekend. It’s a three day conference from Friday to Sunday, held in central London at the Bloomberg office.

Londinium is the ancient Roman name for London. That’s why the conference logo is a toga-touting bust with ouroboroi:

PyLondinium bust

And the conference motto is “Ophidia in Urbe” which I believe translates as “Snakes in the city.”

I went for my first time this year. I bought an early bird ticket ahead of time but could only attend on Sunday up until lunchtime. I still had a great time though!

Here are my notes on the talks I attended. I’ve added links to slides where I could find them. For videos, the PyLondinium Twitter account announced they’ll come out some time in July, so follow them for updates.

Keynote: Python 2020 - Łukasz Langa

The Sunday keynote was by Łukasz Langa, the creator of Black and Python 3.8 release manager. He spoke on where Python could be in 2020. The main point of his talk was that while Python is growing fast, it’s not winning ground in two big areas: the browser, and mobile. Browsers only include JavaScript, though Web Assembly is slowly changing that. On mobile, there’s no current of Python project that can match the performance of new mobile-specific languages such as Kotlin and Swift.

Łukasz called for more projects experimenting with Python for these platforms. He thinks this especially means trying restricted versions of the language because they are easier to optimize.

He also believes that a stronger division between language and reference implementation is important. I quote:

“If Python stays synonymous with CPython for too long, we’ll be in big trouble.”

He mentioned many dead/dying/defunct projects for alternative Python interpreters, including:

He also pointed at some living projects:

I took away that Python is in a pretty healthy place, but it’s not as universal as JavaScript. A few imaginative individuals trying new browser and mobile friendly versions of Python could fix this.

Do We Have a Diversity Problem in Python Community? - Cheuk Ting Ho

Slides

Cheuk presented some data on diversity in the Python community compared to others, specifically comparing PyLadies to R-Ladies. She covered some success stories in improving diversity, for example PyCon UK increased its female speaker share from 1% in 2011 to 40% in 2016.

Her recommendations to improve diversity at conferences were to:

…and for the community in general:

She’s running a diversity survey which takes just 5 minutes to fill out!

Build your Python Extensions with Rust! - Paul Ganssle

Slides

Paul walked through building a C extension that calculates the Sieve of Eratosthenes. He demonstrated the comparative speed in Python, C, and two ways in Rust.

The first way of building a Rust extension was with PyO3, a project that provides Rust bindings for the Python interpreter. It uses Rust’s decorator-like “procedural macros” to make regular Rust functions usable in Python.

The second way was with milksnake, a project by Sentry who have covered moving code hot spots from Python to Rust. With this way, the Rust code only exports a C ABI (Application Binary Interface), the “lingua franca” of inter-programming-language communication. This forces the Python code calling into Rust to do some memory management, since neither Rust nor CPython can manage it automatically.

Of the two approaches, it seemed to me that PyO3 would be the winner in most cases. The only shame with it is that it’s cutting edge so currently depends on the nightly Rust build.

Paul said he’s available to help review PRs to PyO3 because he’s excited about it - see his website for contact details.

Strongly Typed Python - Gintare Urbone

Gintare works at Thought Machine making smart contracts in Python. They’re using type hints and enjoy checking them with Mypy, but wanted extra guarantees with runtime checking. For example, Mypy doesn’t ensure that patches done with unittest.mock match the types, which could make the tests meaningless.

She walked through some examples. Because she wasn’t allowed to make her code from work open, she rebuilt her examples from scratch. They’re available for perusal in her Strongly Typed Python repo on GitHub, so I won’t walk through them here.

Worth checking out if you’re interested in writing highly reliable Python.

It’s a shame there isn’t a maintained open source project for this. Gintare mentioned enforce but this hasn’t had a commit in two years.

Inside the Kitchen - Daniel Moisset

Slides

Daniel covered how the Python Software Foundation makes CPython “inside the kitchen”. He had some very fun analogies to a kitchen:

The slides are worth reading through for a quick covering of how it’s all organized.

One story I found interesting was the history of the Matrix multiplication operator (@). In short:

The acceptance after 14 years was mostly due to the shift in Python towards more data science applications. The takeaway is, don’t give up - the utility of an idea is very context dependent :)

Fin

Thanks for reading my notes, hope you learnt something new too!

—Adam


Learn how to make your tests run quickly in my book Speed Up Your Django Tests.


Subscribe via RSS, Twitter, Mastodon, or email:

One summary email a week, no spam, I pinky promise.

Tags: