Rough steps for migration, with a lot of overlap possible between steps:
-
Increase test coverage.
-
Convert
__init__constructors to__new__constructors, because of a pyo3 limitation. -
Place a Rust superclass over every Python class.
-
Move instance variables from the Python constructor into the Rust class.
-
Convert individual methods of Python classes into Rust. When migrating a caller before a callee or when invoking a function that is overridden in a subclass, use pyo3 Python function invocation. Use
Boundpsuedo-receivers to access superclasses. -
Duplicate constant data from superclasses into subclasses.
-
Use
&selfmethod receivers. -
Replace polymorphic superclasses with traits.
-
Replace all pyo3 Python calls with Rust calls.