semantic_release.repository module

Helper for using Twine to upload to an artifact repository.

class semantic_release.repository.ArtifactRepo(dist_path: dataclasses.InitVar[Path], repository_name: str = 'pypi', repository_url: Optional[str] = None, username: Optional[str] = None, password: Optional[str] = None)[source]

Bases: object

Object that manages the configuration and execution of upload using Twine.

This object needs only one shared argument to be instantiated.

dist_path: dataclasses.InitVar[Path]
dists: List[str]
password: Optional[str] = None
repository_name: str = 'pypi'
repository_url: Optional[str] = None
upload(noop: bool, verbose: bool, skip_existing: bool, **additional_kwargs) bool[source]

Upload artifact to repository using Twine.

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

Parameters
  • noop – Do not apply any changes..

  • verbose – Show verbose output for Twine.

  • skip_existing – Continue uploading files if one already exists. (May not work, check your repository for support.)

Raises

ImproperConfigurationError – The upload failed due to a configuration error.

:returns True if successful, False otherwise.

static upload_enabled() bool[source]

Check if artifact repository upload is enabled

:returns True if upload is enabled, False otherwise.

username: Optional[str] = None
semantic_release.repository.get_env_var(name: str) Optional[str][source]

Resolve variable name from config and return matching environment variable

Parameters

name – Variable name to retrieve from environment

:returns Value of environment variable or None if not set.