Module gcip.addons.python.jobs.deploy
Classes
class TwineUpload (*, twine_repository_url: Optional[str] = None, twine_username_env_var: Optional[str] = 'TWINE_USERNAME', twine_password_env_var: Optional[str] = 'TWINE_PASSWORD', jobName: dataclasses.InitVar[str] = 'twine', jobStage: dataclasses.InitVar[str] = 'deploy')
-
Runs:
pip3 install --upgrade twine python3 -m twine upload --non-interactive --disable-progress-bar dist/*
- Requires artifacts from a build job under
dist/
(e.g. frombdist_wheel()
)
This subclass of
Job
will configure following defaults for the superclass:- name: twine
- stage: deploy
Args
twine_repository_url
:str
- The URL to the PyPI repository the python artifacts will be deployed to. Defaults
to
None
, which means the package is published tohttps://pypi.org
. twine_username_env_var
:Optional[str]
- The name of the environment variable, which contains the username value.
DO NOT PROVIDE THE USERNAME VALUE ITSELF! This would be a security issue! Defaults to
TWINE_USERNAME
. twine_password_env_var
:Optional[str]
- The name of the environment variable, which contains the password.
DO NOT PROVIDE THE LOGIN VALUE ITSELF! This would be a security issue! Defaults to
TWINE_PASSWORD
.
Expand source code
@dataclass(kw_only=True) class TwineUpload(Job): """ Runs: ``` pip3 install --upgrade twine python3 -m twine upload --non-interactive --disable-progress-bar dist/* ``` * Requires artifacts from a build job under `dist/` (e.g. from `bdist_wheel()`) This subclass of `Job` will configure following defaults for the superclass: * name: twine * stage: deploy Args: twine_repository_url (str): The URL to the PyPI repository the python artifacts will be deployed to. Defaults to `None`, which means the package is published to `https://pypi.org`. twine_username_env_var (Optional[str]): The name of the environment variable, which contains the username value. **DO NOT PROVIDE THE USERNAME VALUE ITSELF!** This would be a security issue! Defaults to `TWINE_USERNAME`. twine_password_env_var (Optional[str]): The name of the environment variable, which contains the password. **DO NOT PROVIDE THE LOGIN VALUE ITSELF!** This would be a security issue! Defaults to `TWINE_PASSWORD`. """ twine_repository_url: Optional[str] = None twine_username_env_var: Optional[str] = "TWINE_USERNAME" twine_password_env_var: Optional[str] = "TWINE_PASSWORD" jobName: InitVar[str] = "twine" jobStage: InitVar[str] = "deploy" def __post_init__(self, jobName: str, jobStage: str) -> None: super().__init__(script="", name=jobName, stage=jobStage) def render(self) -> Dict[str, Any]: self.add_variables( TWINE_USERNAME=f"${self.twine_username_env_var}", TWINE_PASSWORD=f"${self.twine_password_env_var}", ) if self.twine_repository_url: self.add_variables(TWINE_REPOSITORY_URL=self.twine_repository_url) self._scripts = [ "pip3 install --upgrade twine", "python3 -m twine upload --non-interactive --disable-progress-bar dist/*", ] return super().render()
Ancestors
Class variables
var jobName : dataclasses.InitVar[str]
var jobStage : dataclasses.InitVar[str]
var twine_password_env_var : Optional[str]
var twine_repository_url : Optional[str]
var twine_username_env_var : Optional[str]
Inherited members
Job
:add_dependencies
add_needs
add_tags
add_variables
allow_failure
append_rules
append_scripts
artifacts
cache
dependencies
environment
image
name
needs
prepend_rules
prepend_scripts
render
resource_group
retry
rules
scripts
set_allow_failure
set_artifacts
set_cache
set_dependencies
set_environment
set_image
set_needs
set_resource_group
set_retry
set_tags
set_timeout
set_when
stage
tags
timeout
variables
when
- Requires artifacts from a build job under