define_09_aws¶
Setup automation for AWS services.
- class pywf_internal_proprietary.define_09_aws.PyWfAws[source]¶
Namespace class for AWS setup automation.
- poetry_source_add_codeartifact(codeartifact_repository_endpoint: str, real_run: bool = True, verbose: bool = True)[source]¶
Run:
poetry source add --secondary ${source_name} "https://${domain_name}-${aws_account_id}.d.codeartifact.${aws_region}.amazonaws.com/pypi/${repository_name}/simple/"
- poetry_authorization(codeartifact_authorization_token: str, real_run: bool = True, verbose: bool = True)[source]¶
Set environment variables to allow Poetry to authenticate with CodeArtifact. It also set the credential to the Poetry config.
- uv_authorization(codeartifact_authorization_token: str, real_run: bool = True, verbose: bool = True)[source]¶
Set environment variables to allow uv to authenticate with CodeArtifact.
- pip_authorization(real_run: bool = True, verbose: bool = True)[source]¶
Run:
aws codeartifact login --tool pip --domain ${domain_name} --domain-owner ${aws_account_id} --repository ${repo_name} --profile ${aws_profile}
Note
This command will set the default index to AWS CodeArtifact and stop using the public PyPI. It will not be able to install a package that doesn’t exist in AWS CodeArtifact.
The community raises an issue https://github.com/aws/aws-cli/issues/5409 and it is not fixed yet. You may want to set the
extra-index-urlinstead. This function implements our own solution to set theextra-index-urlto the AWS CodeArtifact repository.Reference:
- twine_authorization(real_run: bool = True, verbose: bool = True)[source]¶
Run
aws codeartifact login --tool twine --domain ${domain_name} --domain-owner ${aws_account_id} --repository ${repo_name} --profile ${aws_profile}
Reference:
- twine_upload(real_run: bool = True, verbose: bool = True)[source]¶
Upload Python package to CodeArtifact.
Run
twine upload dist/* --repository codeartifact
- publish_to_codeartifact(real_run: bool = True, verbose: bool = True)[source]¶
Publish your Python package to AWS CodeArtifact
- remove_from_codeartifact(real_run: bool = True, verbose: bool = True)[source]¶
Remove a specific version of your Python package release AWS CodeArtifact.
Warning
I suggest don’t do this unless you have to. If you re-publish your package with the same version, then you may need to invalid the poetry cache before doing poetry lock.