How to upload new versions of project to PyPI with twine?

后端 未结 5 375
鱼传尺愫
鱼传尺愫 2021-02-03 18:27

I\'ve uploaded my Python package to PyPI. But now I made new version of my package and need to upload it. I tried to make same progress which I did when upload the package first

相关标签:
5条回答
  • 2021-02-03 18:53

    You need to change the version number.

    0 讨论(0)
  • 2021-02-03 19:00

    Can get that error for following reasons:

    • Didn't change your version in setup.py
    • didn't remove your previous dist file

    Solution:

    • Change the version number in setup.py.
    • Run setup file again. python setup.py bdist_wheel.
    • Upload only that dist file or run twine (if using). twine upload --skip-existing dist/*

    As mentioned by @dustin, dist file of same name cannot be uploaded again.

    0 讨论(0)
  • 2021-02-03 19:01

    Make sure your dist directory is empty before running

    python setup.py sdist
    
    0 讨论(0)
  • 2021-02-03 19:09

    PyPI does not allow for the reuse of distribution filenames (project name + version number + distribution type).

    This ensures that a given distribution for a given release for a given project will always resolve to the same file, and cannot be surreptitiously changed one day by the projects maintainer or a malicious party (it can only be removed).

    You will need to change the version number to one that you haven't previously uploaded to PyPI.

    You didn't mention how you're uploading the distribution, but if you're using twine, it's also possible you're attempting to re-upload a previously uploaded distribution. To resolve this, you can do:

    $ twine upload --skip-existing dist/*
    
    0 讨论(0)
  • 2021-02-03 19:14

    The error seems to stem from the command:

    twine upload --repository-url https://test.pypi.org/legacy/ dist/*
    reusing the previous package version.
    

    To fix this, try this:

    twine upload --skip-existing --repository-url https://test.pypi.org/legacy/ 
    dist/*
    
    0 讨论(0)
提交回复
热议问题