vaticle / bazel-distribution

Bazel rules for assembling and deploying software distributions (see @vaticle for usage example)
https://bazel.build
Apache License 2.0
155 stars 53 forks source link

Fix pip deployment and extend deploy rule doc strings with usage #373

Closed flyingsilverfin closed 1 year ago

flyingsilverfin commented 1 year ago

What is the goal of this PR?

The deploy_pip rule was modified by #368 to allow deploying wheels and targz packages to repositories provided by a pypirc file. However, this broke this repository's consistent design: every deploy_* rule provides all possible repositories to upload to (eg. using snapshot or release), then selects which one to deploy to at run time using arguments.

This PR revert some changes to the deploy_pip rule to make it conform to this consistent design. We also fix some bugs during the upload process.

Finally, we extend the doc strings for each of the deploy rules to indicate how to select the repository to deploy to.

deploy_pip changes

The deploy_pip rule is changed to take multiple different destination repositories to upload to. These are provided, as before, using the existing snapshot or release attributes. The additional attribute of pypirc_repository (renamed from pypi_profile) is made available in the same way, rather than with an exclusive-or logic.

Now we declare deploy_pip targets like this:

deploy_pip(
  name = "some-deploy-pip",
  snapshot = "https://... snapshot ...",
  release = "https:// ... release ...",
  pypirc_repository = "some-repository-name"
)

The pypirc_repository attribute refers the name of a repository declared in a pyripc file. This configuration file is an external file normally exists in a standard location such as $HOME/.pypirc.

After this change, deployment looks like this:

bazel run //:some-deploy-pip -- [pypirc|snapshot|release]

All deployment rules in this repository should continue to support declaring multiple target repositories in this manner, for the time being.

What are the changes implemented in this PR?

vaticle-bot commented 1 year ago

PR Review Checklist

Do not edit the content of this comment. The PR reviewer should simply update this comment by ticking each review item below, as they get completed.


Trivial Change

Code

Architecture