---
tags: seminar series
title: Rust and Python
---
:::danger
**General info**
- **Video connection details:**
- Zoom ID: 628 5203 7811
- Zoom password: rse
- Zoom invite link: https://uwasa.zoom.us/j/62852037811?pwd=bENaUGpjSkY2K3ByV0ZBdi9GaURDZz09
- **Contact:**
- **Date and time**: Tuesday 14th September 2021 13:00 CEST
- **This page:** https://hackmd.io/@nordic-rse/rust-python
:::
# Icebreaker
Are you writing Python and/or Rust (add an "o" at the end of the line)?
- Python: ooooooooo
- Rust: ooo
If yes, what do you like about Python?
- Clear, organized model and principles
- Unfussy
- Simple, clear, no unnecessary surprises
- Machine learning + scientific computing libraries
- Ease of use + modular: lots of existing functionality to import
- Extensibility
- Easy to use interactively through the REPL
- ...
What do you like about Rust?
- The cute crab logo :)
- Fussy ;)
- Safety
- Tooling (Cargo)
- Parallel libraries like Rayon
- Leaves me less shellshocked than C++
- I heard it's fast and safer than C++
- The speed. And the noise. And the noise of the speeeeeed!
---
## About the series
This is the second event in the Nordic RSE seminar series.
* Reminder about starting recording
* Find out about future events:
* Check https://nordic-rse.org/events/seminar-series/.
* Follow [@nordic_rse](https://twitter.com/nordic_rse) on Twitter for announcements
* Join the [Nordic RSE stream](https://coderefinery.zulipchat.com/#narrow/stream/213720-nordic-rse) of the CodeRefinery chat
* Suggest speakers:
* on the [Nordic RSE stream](https://coderefinery.zulipchat.com/#narrow/stream/213720-nordic-rse)
* by creating an issue on the [Nordic RSE website repository](https://github.com/nordic-rse/nordic-rse.github.io/issues)
## About the Nordic RSE
* Represents Research Software Engineers in the Nordics.
* Check out [nordic-rse.org](https://nordic-rse.org/) for other activities.
* Registering as an association this fall.
* To become a member, fill in the [membership form](https://forms.gle/qCVVRGXPi3Hq7inW6).
---
## Bio: Radovan Bast
- Computational chemist turned research software engineer
- University of Tromso, Nordic e-Infrastructure Collaboration, and Serit (Norway)
- Working on https://coderefinery.org/
- Otherwise working on:
- few small libraries for computational chemistry
- text analysis tools
- computational geometry
- optimizing codes
- trying to improve usability and documentation on Norwegian high-performance computing resources
- Spent few years writing Fortran, C, and C++
- These days using Python (quick prototyping) and Rust (for its robustness, correctness), also JavaScript (because I don't like hosting own web servers)
---
## Resources
- [Slides](https://cicero.xyz/v3/remark/0.14.0/github.com/bast/interfacing-rust-python/main/talk.md/)
- Example 1: https://github.com/bast/pyo3-example-distances
- Example 2: https://github.com/bast/pyo3-example-accounts
### Books/blogs/articles
- [Rust by Example](https://doc.rust-lang.org/rust-by-example/)
- [The Rust Programming Language](https://doc.rust-lang.org/book/)
- [The Rustonomicon](https://doc.rust-lang.org/nomicon/)
- [Rust Cookbook](https://rust-lang-nursery.github.io/rust-cookbook/)
- [Rust in Action](http://www.rustinaction.com/)
- [Programming Rust](https://www.oreilly.com/library/view/programming-rust-2nd/9781492052586/)
- [Why try Rust for scientific computing?](https://erambler.co.uk/blog/why-give-rust-a-try/)
- [Why scientists are turning to Rust](https://www.nature.com/articles/d41586-020-03382-2)
- [The Rust FFI Omnibus](http://jakegoulding.com/rust-ffi-omnibus/)
---
## Cool tools written in Rust
* https://github.com/benfred/py-spy (Bonus: pip installable Rust binary)
* https://github.com/getzola/zola
## Ask your questions here
* This is how I ask a question?
* Yes it is
* And this is another comment
* Everyone can ask and answer questions :)
* How about CUDA/HIP/...? Is it also too early for this?
* When in doubt: go through C interface.
* So what happened to s1 in that example? It's not garbage collected as there's no garbage collector?
* we can imagine that it got dropped (deallocated). more precisely, the ownership got moved so s1 is not pointing to that data anymore.
* What about publishing source packages to PyPI?
* Okay thanks
* What does the & mean in Rust?
* Reference to
* What does `cargo check` check?
* checks that all types match
* PyO3 seems to have ways to reflect/wrap Python types into Rust but is there a way to have reflected/wrapped Rust types in Python like PyBind11/Boost::Python?
* Yes I think you showed it. Thanks.
Thanks for the talk!
thanks!