Skip to content

Commit

Permalink
Move exports to pythonlib package object
Browse files Browse the repository at this point in the history
  • Loading branch information
jodersky committed Dec 4, 2024
1 parent bcc6227 commit b7ce634
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
16 changes: 4 additions & 12 deletions pythonlib/src/mill/pythonlib/PublishModule.scala
Original file line number Diff line number Diff line change
@@ -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 =>
Expand All @@ -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.
Expand Down Expand Up @@ -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:
*
* ```
Expand Down Expand Up @@ -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(),
Expand Down
14 changes: 14 additions & 0 deletions pythonlib/src/mill/pythonlib/package.scala
Original file line number Diff line number Diff line change
@@ -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

}

0 comments on commit b7ce634

Please sign in to comment.