[Python] How to get rid of existing dist folder (or files in the folder) after building a...

Discussão em 'Python' iniciado por Stack, Outubro 5, 2024.

  1. Stack

    Stack Membro Participativo

    I'm working on a package for Python, and currently am manually building and uploading my package (to testpypi) each time I make a change. I'm using setuptools as my backend, and twine to upload the builds. Whenever I run python -m build, it generates a dist folder with the tar.gz and whl files. If I change the version of the build, I end up generating a files with a brand new version names, but the old files still persist:

    dist
    package-0.0.1-none-any-py3.whl
    package-0.0.1.tar.gz
    package-0.0.2-none-any-py3.whl
    package-0.0.2.tar.gz


    When I go and run twine upload dist/*, both the old and the new files get uploaded. And because the old files have the same name as the new files, it ends up being rejected for file name reuse. So I end up having to clean out the dist folder manually.

    I know there is a setup.py clean command, but I'm not too sure what it does, and it throws an error after I run it.

    Is there a way to avoid this? Do I just have to set up a bat file that automates the cleaning for me, or is there some configuration or command that I am missing?

    Continue reading...

Compartilhe esta Página