PyLondinium 2019 Notes2019-06-19
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.
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.
Ł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:
- PyPy - the JIT Python compiler written in Python. This is at risk at the moment since it’s a large Python 2 codebase that needs updating to Python 3. It’s also a high effort way of creating a new implementation - they put in a lot of effort reproducing CPython quirks and bugs.
- MicroPython - a kickstarter-funded subset of Python optimized to run on microcontrollers and other constrained environments. I’ve used it myself on a BBC micro:bit I got at PyCon UK, and it works astoundingly well.
- mypyc - a new one to me, this compiles mypy-annotated, statically typed Python modules into CPython C extensions. This restricts the Python language to enable compilation.
Do We Have a Diversity Problem in Python Community? - Cheuk Ting Ho
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:
- Improve accessibility concerns such as providing child care
- Increase the variety of topics to appeal to a broader audience, such as Python for education
- Go beyond the Django Girls workshop
…and for the community in general:
- To have more females in leadership/contributor positions
- To promote the use of Python in other academic fields
She’s running a diversity survey which takes just 5 minutes to fill out!
Build your Python Extensions with Rust! - Paul Ganssle
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 PR’s 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
Daniel covered how the Python Software Foundation makes CPython “inside the kitchen.” He had some very fun analogies to a kitchen:
- Python 2.7 is frozen for preservation, but will soon go stale
- Python 3.8 is in the oven
- The release manager is the “Chef de Cuisine”
- Core developers are the “station chefs”
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 (
- PEP 211 proposed the
@operator in July 2000, but was rejected
- PEP 225 proposed elementwise operators in September 2000, and was also rejected
- PEP 465 proposed
@again for matrix multiplication in February 2014, and was accepted.
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 :)
Thanks for reading my notes, hope you learnt something new too!
Are your Django project's tests slow? Read Speed Up Your Django Tests now!
One summary email a week, no spam, I pinky promise.
© 2020 All rights reserved.