twine.commands.upload module#

Module containing the logic for twine upload.

twine.commands.upload.skip_upload(response: Response, skip_existing: bool, package: PackageFile) bool[source]#

Determine if a failed upload is an error or can be safely ignored.

Parameters:
  • response – The response from attempting to upload package to a repository.

  • skip_existing – If True, use the status and content of response to determine if the package already exists on the repository. If so, then a failed upload is safe to ignore.

  • package – The package that was being uploaded.

Returns:

True if a failed upload can be safely ignored, otherwise False.

twine.commands.upload._make_package(filename: str, signatures: Dict[str, str], upload_settings: Settings) PackageFile[source]#

Create and sign a package, based off of filename, signatures and settings.

twine.commands.upload.upload(upload_settings: Settings, dists: List[str]) None[source]#

Upload one or more distributions to a repository, and display the progress.

If a package already exists on the repository, most repositories will return an error response. However, if upload_settings.skip_existing is True, a message will be displayed and any remaining distributions will be uploaded.

For known repositories (like PyPI), the web URLs of successfully uploaded packages will be displayed.

Parameters:
  • upload_settings – The configured options related to uploading to a repository.

  • dists – The distribution files to upload to the repository. This can also include .asc files; the GPG signatures will be added to the corresponding uploads.

Raises:
twine.commands.upload.main(args: List[str]) None[source]#

Execute the upload command.

Parameters:

args – The command-line arguments.