Search code examples
pythondistutilsdistributepypi

Delete files after upload to PyPi


I'm uploadig my package to PyPi with this command:

python setup.py sdist upload

This command generate some files and folders, is there any option to delete this files after upload?


Solution

  • The sdist command calls the build command which by default puts files in a build subdirectory. You probably want to keep that around (i.e. not care about it) to speed up future builds.

    sdist then puts the distribution files in a dist subdirectory by default. python setup.py sdist -d $TMP (or the %something% equivalent environment variable for Windows) can be used to put the file in a temporary directory instead, so that they’re wiped out at the next boot.

    If you really care about the build dir, try this: python setup.py build -b $TMP sdist -d $TMP. sdist should be clever enough to find the files created by build.

    distutils docs: http://docs.python.org/distutils

    command help: python setup.py build --help