Search code examples
pythonpython-3.xsetuptools

Why is setuptools so slow


I have a one python library but and it is in wheel 40 MB. But, it takes more then 12 hours to make the wheel file.

setuptools get stuck here:

copying server\views\generic\edit.py -> build\lib\server\views\generic
copying server\views\generic\list.py -> build\lib\server\views\generic
copying server\views\generic\__init__.py -> build\lib\server\views\generic
creating build\lib\server\views\templates
copying server\views\templates\__init__.py -> build\lib\server\views\templates

here it is stuck for most of the time but it still uses my processor.

I was just curious why it takes so long to make the Wheel file to post it on pypi.


Solution

  • When you go to build a package your could to

    clean the cache:

    find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf
    

    Clean dist and build:

    rm -rf dist/
    rm -rf build/
    

    In your setup.py add only the package that you need or exclude that you don't need:

    packages=find_namespace_packages(exclude=("test", "doc", "dist", "build"))