Skip to content

Commit

Permalink
Remove publishAll task, since pypi does not support staging
Browse files Browse the repository at this point in the history
  • Loading branch information
jodersky committed Dec 3, 2024
1 parent 64ed59c commit 2961dbb
Showing 1 changed file with 1 addition and 38 deletions.
39 changes: 1 addition & 38 deletions pythonlib/src/mill/pythonlib/PublishModule.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package mill.pythonlib

import mill.api.Result
import mill._
import mill.define.ExternalModule

/**
* A python module which also defines how to build and publish source distributions and wheels.
Expand Down Expand Up @@ -237,7 +236,7 @@ trait PublishModule extends PythonModule {

}

object PublishModule extends ExternalModule with PythonModule with TaskModule {
object PublishModule {

/**
* Static metadata about a project.
Expand Down Expand Up @@ -267,40 +266,4 @@ object PublishModule extends ExternalModule with PythonModule with TaskModule {
implicit val rw: upickle.default.ReadWriter[Developer] = upickle.default.macroRW
}

lazy val millDiscover: mill.define.Discover = mill.define.Discover[this.type]

override def pythonToolDeps = Seq("twine")

def defaultCommandName() = "publishAll"

def publishRepositoryUrl = "https://test.pypi.org/legacy/"

import mill.main.Tasks

def publishAll(
publishArtifacts: Tasks[Seq[PathRef]] = Tasks.resolveMainDefault("__.publishArtifacts"),
repositoryUrl: String = null
): Command[Unit] = Task.Command {
val env = collection.mutable.Map.empty[String, String]
for (username <- Task.env.get("MILL_TWINE_USERNAME")) {
env += "TWINE_USERNAME" -> username
}
for (password <- Task.env.get("MILL_TWINE_PASSWORD")) {
env += "TWINE_PASSWORD" -> password
}
env ++= Task.env
runner().run(
(
// format: off
"-m", "twine",
"upload",
"--non-interactive",
"--repository-url", Option(repositoryUrl).getOrElse(this.publishRepositoryUrl),
Task.sequence(publishArtifacts.value)().flatten.map(_.path)
// format: on
),
env = env.toMap
)
}

}

0 comments on commit 2961dbb

Please sign in to comment.