kuniga.me > Docs > Python Performance
We can determine which module is taking the most time to import by running a binary with the -X importtime flag:
-X importtime flag
pip install tuna python -X importtime tdigest/tdigest.py 2> /tmp/import.log tuna /tmp/import.log
Source: Revisiting Python: Modules.