docker compose run --rm -e DJANGO_SETTINGS_MODULE=canary.settings.test django \ bash -c "\ pip install py-spy && \ py-spy record -o flamegraph.svg --format speedscope -- \ pytest --nomigrations check_out"
Then view at speedscope.app