optimize auto-lib detection and remove .py