From b7ce6343dcb3732dd8f98e0710b3a38f217348fc Mon Sep 17 00:00:00 2001 From: Jakob Odersky Date: Wed, 4 Dec 2024 10:20:50 +0100 Subject: [PATCH] Move exports to pythonlib package object --- pythonlib/src/mill/pythonlib/PublishModule.scala | 16 ++++------------ pythonlib/src/mill/pythonlib/package.scala | 14 ++++++++++++++ 2 files changed, 18 insertions(+), 12 deletions(-) create mode 100644 pythonlib/src/mill/pythonlib/package.scala diff --git a/pythonlib/src/mill/pythonlib/PublishModule.scala b/pythonlib/src/mill/pythonlib/PublishModule.scala index 245ea7eb86b..e66db70d00b 100644 --- a/pythonlib/src/mill/pythonlib/PublishModule.scala +++ b/pythonlib/src/mill/pythonlib/PublishModule.scala @@ -1,21 +1,13 @@ package mill.pythonlib import mill.api.Result -import mill._ +import mill.{PathRef, Task, T, Command} /** * A python module which also defines how to build and publish source distributions and wheels. */ trait PublishModule extends PythonModule { - // export these to make using them in subclasses possible without an import - type License = scalalib.publish.License - val License = scalalib.publish.License - type PublishMeta = PublishModule.PublishMeta - val PublishMeta = PublishModule.PublishMeta - type Developer = PublishModule.Developer - val Developer = PublishModule.Developer - override def moduleDeps: Seq[PublishModule] = super.moduleDeps.map { case m: PublishModule => m case other => @@ -34,7 +26,7 @@ trait PublishModule extends PythonModule { * This is roughly equivalent to what you'd find in the general section of a `pyproject.toml` file * https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#about-your-project. */ - def publishMeta: T[PublishMeta] + def publishMeta: T[PublishModule.PublishMeta] /** * The artifact version that this module would be published as. @@ -207,7 +199,7 @@ trait PublishModule extends PythonModule { * defined in this module. * * You can configure this command by setting any environment variables - * understood by `twine`, prefixed with `Mill_`. For example, to change the + * understood by `twine`, prefixed with `MILL_`. For example, to change the * repository URL: * * ``` @@ -255,7 +247,7 @@ object PublishModule { name: String, description: String, requiresPython: String, - license: scalalib.publish.License, + license: mill.scalalib.publish.License, authors: Seq[Developer], keywords: Seq[String] = Seq(), classifiers: Seq[String] = Seq(), diff --git a/pythonlib/src/mill/pythonlib/package.scala b/pythonlib/src/mill/pythonlib/package.scala new file mode 100644 index 00000000000..7f728da8111 --- /dev/null +++ b/pythonlib/src/mill/pythonlib/package.scala @@ -0,0 +1,14 @@ +package mill + +package object pythonlib { + + // These types are commonly used in python modules. Export them to make using + // them possible without an import. + type License = mill.scalalib.publish.License + val License = mill.scalalib.publish.License + type PublishMeta = PublishModule.PublishMeta + val PublishMeta = PublishModule.PublishMeta + type Developer = PublishModule.Developer + val Developer = PublishModule.Developer + +}