Skip to content

Packaging tutorial: publishing to TestPyPI #844

@amercader

Description

@amercader

OS version

Ubuntu

Python version

3.12

Pip version

24.3.1

Guide link

https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/#

Problem description

Following the guide to set up GitHub Actions to automatically publish to PyPI, it also helps you set up pushing to TestPyPI:

And it’ll publish any push to TestPyPI which is useful for providing test builds to your alpha users as well as making sure that your release pipeline remains healthy!

Following these steps results on errors when pushing to test.pypi.org after the fist push, because on each subsequent push the version number and the package name are the same:

Uploading distributions to https://test.pypi.org/legacy/
Uploading ckan-2.12.0a0-py3-none-any.whl
WARNING  Error during upload. Retry with the --verbose option for more details. 
ERROR    HTTPError: 400 Bad Request from https://test.pypi.org/legacy/          
         File already exists ('ckan-2.12.0a0-py3-none-any.whl', with blake2_256 
         hash                                                                   
         '4a1a7a284be43e71a1492bc9aa756f19256adba83e76d05f6d7d45f3142b9341').   
         See https://test.pypi.org/help/#file-name-reuse for more information.  

If the action is meant to run on each push is reasonable to expect that the package version won't be changed every time and so it should have something like the commit ref or a timestamp appended.

Should this be addressed in the guide or is expected that users handle it at the application or GitHub actions level?

Error message

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions