Skip to content

Provide way to check whether an upload would fail without uploading #17520

@mauvilsa

Description

@mauvilsa

What's the problem this feature will solve?
In many CI pipelines python packages are built and uploaded to PyPI after a release and git tag has been created. There are reasons why people would want to do it this way, and PyPI should not impose an alternative. If PyPI rejects the upload, then the just created release is invalid. Also it is common that this happens in a main branch, where it is not good practice to change the history.

My proposal is to provide an official way to check whether an upload would be fails without uploading. With this CI pipelines can validate built packages against the actual PyPI server, before a release is created. Thus, avoiding in most cases these invalid releases.

Because this feature is lacking, there are projects which actually upload the packages. This seems to me like an undesired practice.

Describe the solution you'd like
I propose to extend the API in warehouse to allow validating a package without uploading. I think this should trigger the exact checks that an actual upload would do, requiring the same authentication, rejecting due to any of the reasons why an actual upload would. Surely there are many details I haven't configured and solution would need to be refined. But I think the general idea is there.

Additional context
I created this issue as suggested here pypa/twine#1152 (comment) by @woodruffw. I copy his thoughts here for reference, but looking at that issue can give more context.

You could open an issue on Warehouse to discuss this, but there are a handful of nontrivial dimensions to this: do "dry-run" uploads require the same auth as normal uploads? How does Warehouse notify people when a dry-run fails (not just a generic error code, but a structured, detailed message)? What guarantees do users have that their packages are not retained during the dry-run? And so forth -- I think these are all surmountable, but they need to be considered in sum.

I have seen #17261 related to a server to test uploads. I don't like much the idea about a separate server since there could be a version discrepancy with respect to the real PyPI. Also, if there is an official way to check, then dummy uploads by people can be avoided.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions