For folks looking for a good modern profiling tool for Python codebases: my current favourite is Scalene [0], which allows profiling CPU/GPU and memory usage in a performant way. The author gave a talk about it on last PyCon US [1].
[0]: https://github.com/plasma-umass/scalene [1]: https://www.youtube.com/watch?v=nrQPqy3YY5A