Writing Python extensions in Rust
10-21, 15:30–17:00 (Europe/Stockholm), Workshops

Live Stream: https://youtu.be/BgzIaEzXEBU

Many times we have to write Python extensions, particularly in C. To do various system operations, or doing calculations in a faster manner. But, writing safe C code is always difficult, even for an experienced developer. This is where writing Python extensions in Rust is becoming more popular among developers where people think about speed and security at the same time. In this workshop we will learn about how to create a Python module using Rust. No previous Rust experience is required.

If you are using latest cryptography in any of your project (which you most probably already do), you are using one of the most powerful and trusted Python module where a part is written in Rust.

In this workshop we will go through a given git repository (no prior Rust knowledge is required) and start building a Python extension module step by step.


  • Initial module creation
  • single function
  • functions with arguments
  • Help documentation
  • Functions to read files
  • Exception generation
  • Dictionaries, lists
  • Creating your own class
  • A module with some real life work done in Rust

We will follow prewritten code for most of the sessions, I will ask you to modify those as exercises during the session.

Kushal Das is a CPython core developer and also a director at the Python Software Foundation. He also part of the Tor Project Core team. One of the maintainer of SecureDrop, and author of various other Free Software tools. He founded Linux Users' Group of Durgapur back in 2004 with a goal of helping people to become upstream contributors. He regularly blogs at https://kushaldas.in