Search code examples
pythonpackagesetuptoolssdist

Output directories for python setup.py sdist bdist_wheel


When doing

python setup.py sdist bdist_wheel

it creates build, dist, packagename.egg-info directories. I'd like to have them out of the current folder.

I tried:

  • --dist-dir=../dist: works with sdist but packagename.egg-info is still there

  • --bdist-dir=../dist: for example:

       python setup.py sdist bdist_wheel --dist-dir=../dist  --bdist-dir=../dist2
    

    works and the final bdist package is in ../dist. But the current folder still gets new directories build, dist, packagename.egg-info, which I don't want.

Question: how to have everything (the output of sdist and bdist_wheel) outside of the current folder?

Of course I can write a script with mv, rm -r, etc. but I wanted to know if there exists a built-in solution.


Solution

  • I tried some time again with -d, --dist-dir, --bdist-dir but I found no way to do it in one-line.

    I'm afraid the shortest we could find (on Windows) is:

    python setup.py sdist bdist_wheel
    rmdir /s /q packagename.egg-info build ..\dist
    move dist ..