single-speaker

Dom Weldon

United Kingdom

Dom Weldon is a Principal Software Engineer at decisionLab, a London-based mathematical modelling consultancy with expertise in machine learning, simulation, optimization and visualization. Dom's team specialize in taking models from data scientists and turning them into production ready tools. Current clients include the Royal Navy, Siemens and various UK public bodies.

Dom came to decisionLab from his PhD studies in Computational Geography at King's College London, his initial degree was in Natural Sciences at the University of Cambridge, and holds a master's in the historical and cultural geography of the Cold War United States. Outside of work, Dom is interested in languages and travelling, and holds a voluntary statutory appointment on a board monitoring the welfare and dignity of prisoners in a challenging North London jail.

Oxidizing MyPy: Typed Python, Rust and Rust-in-Python. Talk

Anglický jazyk

Python is a very readable, dynamically typed, interpreted, object oriented general purpose programming language that’s easy to learn, but offers almost unlimited power and flexibility to build almost whatever you want. However, as you go deeper into Python, some of the very features that made you fall in love with the language may start to limit what you can do: dynamic typing can make bugs hard to spot, large codebases can create a sea of objects, and the global interpreter lock (GIL) starts to impose a hard limit on performance.

Meanwhile, Rust - a relatively new compiled systems programming language - is statically (and safely) typed, and offers and ""fearless"" concurrency without the limitations of the GIL; indeed, idiomatic Rust code runs at comparable speeds to C/C++. However, despite having a brilliant community, Rust is acknowledged as presenting a steep learning curve, and with so much Python being used in data science, academia, industry and beyond, switching entirely to Rust simply isn’t a sensible option for most teams.

At decisionLab, a mathematical modelling and data science consultancy based in central London, we wanted to improve our Python code quality and maintainability as much as possible, whilst also making use of the speed improvements that Rust could offer for some of our most performance critical algorithms.

So, we embraced typed Python, whilst also exploring Rust. So far, the effects on our code have been excellent. Not only did we spot bugs and improve our documentation using typed Python, but we were also able to use high level tools which leverage typed Python to build APIs and interfaces to our code and accelerate development. Best of all, using Rust from within our Python code was much easier than expected.

This talk will give a brief overview of typed Python, and how and why you would want to use it, alongside an overview of some excellent high-level tools that let your typed code fly. I'll also give an introduction to Rust the language, and the two major Rust-Python bindings: PyO3 and Rust-Python. We’ll then explore an example of how to write a Rust module and use it in Python.

Hopefully, I'll convince you that you don't need to be a computer science genius to work with a systems programming language, and that using Rust in your code doesn't require a complete re-write, but that you can actually start to swap-and-switch your code into Rust class by class, function by function.

At the same time, I'll reflect on the roles of Rust, Python and code generally in solving business problems. My aim in this talk is to show that Rust and Python are not enemies or competitors, but rather that they are different tools with different uses, and that when they are used in combination, great things can happen! In doing so, I'll offer my take on what I think the future of Rust is in Python.