BarePythonModule

mill.pythonlib.BarePythonModule

A Python module whose source files live directly under moduleDir, without an additional src/ directory.

Source files keep their workspace-relative paths on PYTHONPATH. For example, foo/bar.py is importable as foo.bar. Sources owned by nested Python modules are excluded automatically.

Attributes

Source
BarePythonModule.scala
Graph
Supertypes
trait PythonModule
trait UvModule
trait Module
trait ModuleApi
trait Wrapper
class BaseClass
trait Cacher
trait Cacher
class Object
trait Matchable
class Any
Show all
Known subtypes
trait Bare

Members list

Type members

Inherited classlikes

trait PythonTests extends PythonModule

Attributes

Inherited from:
PythonModule
Source
PythonModule.scala
Supertypes
trait PythonModule
trait UvModule
trait Module
trait ModuleApi
trait Wrapper
class BaseClass
trait Cacher
trait Cacher
class Object
trait Matchable
class Any
Show all
object moduleInternal extends Internal

Miscellaneous machinery around traversing & querying the build hierarchy, that should not be needed by normal users of Mill

Miscellaneous machinery around traversing & querying the build hierarchy, that should not be needed by normal users of Mill

Attributes

Inherited from:
Module
Source
Module.scala
Supertypes
class Internal
class Object
trait Matchable
class Any

Value members

Concrete methods

def bareExcludedDirectoryNames: Set[String]

Directory names pruned while discovering bare Python sources.

Directory names pruned while discovering bare Python sources.

Attributes

Source
BarePythonModule.scala

The conventional main.py before it is copied into barePythonPath.

The conventional main.py before it is copied into barePythonPath.

Attributes

Source
BarePythonModule.scala

A filtered import tree that preserves each source file's path relative to the workspace root.

A filtered import tree that preserves each source file's path relative to the workspace root.

Attributes

Source
BarePythonModule.scala
def bareSourceExtensions: Set[String]

File extensions discovered as bare Python sources.

File extensions discovered as bare Python sources.

Attributes

Source
BarePythonModule.scala
override def localPythonPath: Simple[Seq[PathRef]]

The directories used to construct the PYTHONPATH for this module, used for execution, excluding upstream modules.

The directories used to construct the PYTHONPATH for this module, used for execution, excluding upstream modules.

This includes source directories, resources and other unmanaged directories.

Attributes

Definition Classes
Source
BarePythonModule.scala
override def mainScript: Simple[PathRef]

The python script to run. This file may not exist if this module is only a library.

The python script to run. This file may not exist if this module is only a library.

Attributes

Definition Classes
Source
BarePythonModule.scala
override def sources: Simple[Seq[PathRef]]

The paths where the source files for this Mill module live.

The paths where the source files for this Mill module live.

Standard PythonModules return source directories, while BarePythonModule returns individual files whose import names are based on their paths relative to the workspace root.

Attributes

Definition Classes
Source
BarePythonModule.scala

Inherited methods

def allRepositories: Task[Seq[Repository]]

The repositories used to resolve dependencies

The repositories used to resolve dependencies

Unlike repositoriesTask, this includes the Mill internal repositories, which allow to resolve Mill internal modules (usually brought in via JavaModule#coursierDependencyTask).

Beware that this needs to evaluate JavaModule#coursierProject of all module dependencies of the current module, which itself evaluates JavaModule#mvnDeps and related tasks. You shouldn't depend on this task from implementations of mvnDeps, which would introduce cycles between Mill tasks.

Attributes

Inherited from:
CoursierModule
Source
CoursierModule.scala

Bind a dependency (Dep) to the actual module context (e.g. the scala version and the platform suffix)

Bind a dependency (Dep) to the actual module context (e.g. the scala version and the platform suffix)

Attributes

Returns

The BoundDep

Inherited from:
CoursierModule
Source
CoursierModule.scala

Bundles the project into a self-contained native PEX SCIE executable.

Bundles the project into a self-contained native PEX SCIE executable.

Attributes

Inherited from:
PythonModule
Source
PythonModule.scala
def bundleOptions: Simple[Seq[String]]

Command-line options to pass as bundle configuration defined by the user.

Command-line options to pass as bundle configuration defined by the user.

Attributes

Inherited from:
PythonModule
Source
PythonModule.scala
def checkGradleModules: Simple[Boolean]

Whether to enable Gradle Module support when fetching dependencies

Whether to enable Gradle Module support when fetching dependencies

Attributes

Inherited from:
CoursierModule
Source
CoursierModule.scala
def console(): Command[Unit]

Opens up a Python console with your module and all dependencies present, for you to test and operate your code interactively.

Opens up a Python console with your module and all dependencies present, for you to test and operate your code interactively.

Attributes

Inherited from:
PythonModule
Source
PythonModule.scala
def coursierCacheCustomizer: Task[Option[FileCache[Task] => FileCache[Task]]]

Customize the coursier file cache.

Customize the coursier file cache.

This is rarely needed to be changed, but sometimes e.g. you want to load a coursier plugin. Doing so requires adding to coursier's classpath. To do this you could use the following:

 override def coursierCacheCustomizer = Task.Anon {
    Some( (fc: coursier.cache.FileCache[Task]) =>
      fc.withClassLoaders(Seq(classOf[coursier.cache.protocol.S3Handler].getClassLoader))
    )
 }

Attributes

Inherited from:
CoursierModule
Source
CoursierModule.scala

A CoursierModule.Resolver to resolve dependencies.

A CoursierModule.Resolver to resolve dependencies.

Can be used to resolve external dependencies, if you need to download an external tool from Maven or Ivy repositories, by calling CoursierModule.Resolver#classpath.

Attributes

Returns

CoursierModule.Resolver instance

Inherited from:
CoursierModule
Source
CoursierModule.scala
override def defaultTask(): String

The name of the default command, which will be automatically executed if the module name is provided at the Mill command line.

The name of the default command, which will be automatically executed if the module name is provided at the Mill command line.

Attributes

Definition Classes
Inherited from:
PythonModule
Source
PythonModule.scala
def forkEnv: Simple[Map[String, String]]

Any environment variables you want to pass to the forked Env

Any environment variables you want to pass to the forked Env

Attributes

Inherited from:
PythonModule
Source
PythonModule.scala

Folders containing source files that are generated rather than handwritten; these files can be generated in this task itself, or can refer to files generated from other tasks

Folders containing source files that are generated rather than handwritten; these files can be generated in this task itself, or can refer to files generated from other tasks

Attributes

Inherited from:
PythonModule
Source
PythonModule.scala
def indexes: Simple[Seq[String]]

Base URLs of Python package indexes to search, in priority order. The final URL is passed to uv as its lowest-priority default index.

Base URLs of Python package indexes to search, in priority order. The final URL is passed to uv as its lowest-priority default index.

Attributes

Inherited from:
UvModule
Source
UvModule.scala
def javaHome: Simple[Option[PathRef]]

Optional custom Java Home for the JvmWorker to use

Optional custom Java Home for the JvmWorker to use

If this value is None, then the JvmWorker uses the same Java used to run the current mill instance.

Attributes

Inherited from:
JavaHomeModule
Source
JavaHomeModule.scala
def jvmIndexVersion: Simple[String]

Attributes

Inherited from:
JavaHomeModule
Source
JavaHomeModule.scala
def jvmVersion: Simple[String]

Attributes

Inherited from:
JavaHomeModule
Source
JavaHomeModule.scala
def mapDependencies: Task[Dependency => Dependency]

Map dependencies before resolving them - use only if you know what you are doing. Override this to customize the set of dependencies.

Map dependencies before resolving them - use only if you know what you are doing. Override this to customize the set of dependencies.

Using this makes it harder to make sense of dependency resolutions and to reproduce those resolutions via the coursier command-line or from other build tools.

Attributes

Inherited from:
CoursierModule
Source
CoursierModule.scala

A CoursierModule.Resolver to resolve dependencies.

A CoursierModule.Resolver to resolve dependencies.

Unlike defaultResolver, this resolver can resolve Mill modules too (obtained via JavaModule.coursierDependencyTask).

Attributes

Returns

CoursierModule.Resolver instance

Inherited from:
CoursierModule
Source
CoursierModule.scala

Attributes

Inherited from:
BaseClass
Source
Module.scala

The direct dependencies of this module. This is meant to be overridden to add dependencies.

The direct dependencies of this module. This is meant to be overridden to add dependencies.

Attributes

Inherited from:
PythonModule
Source
PythonModule.scala
def moduleDir: Path

Attributes

Inherited from:
Module
Source
Module.scala

Attributes

Inherited from:
Module
Source
Module.scala

Attributes

Inherited from:
Module
Source
Module.scala
def pexTool: Simple[String]

The isolated PEX tool environment managed and cached by uv.

The isolated PEX tool environment managed and cached by uv.

Attributes

Inherited from:
PythonModule
Source
PythonModule.scala
def pythonDeps: Simple[Seq[String]]

Python dependencies to install. Each dependency uses the format accepted by uv pip install or a requirements.txt file.

Python dependencies to install. Each dependency uses the format accepted by uv pip install or a requirements.txt file.

Attributes

Inherited from:
UvModule
Source
UvModule.scala

An executable python interpreter. This interpreter is set up to run in a virtual environment which has been initialized to contain all libraries and tools needed by this module and its dependencies.

An executable python interpreter. This interpreter is set up to run in a virtual environment which has been initialized to contain all libraries and tools needed by this module and its dependencies.

Attributes

Inherited from:
PythonModule
Source
PythonModule.scala
def pythonOptions: Simple[Seq[String]]

Command-line options to pass to the Python Interpreter defined by the user.

Command-line options to pass to the Python Interpreter defined by the user.

Attributes

Inherited from:
PythonModule
Source
PythonModule.scala

Local, non-Mill Python projects to install as dependencies. Each directory should contain standard Python project metadata such as pyproject.toml. Use Task.Sources when overriding this so project contents participate in cache invalidation.

Local, non-Mill Python projects to install as dependencies. Each directory should contain standard Python project metadata such as pyproject.toml. Use Task.Sources when overriding this so project contents participate in cache invalidation.

Attributes

Inherited from:
UvModule
Source
UvModule.scala

Requirements files to install for this module.

Requirements files to install for this module.

Attributes

Inherited from:
UvModule
Source
UvModule.scala
def pythonToolDeps: Simple[Seq[String]]

Python dependencies used only as development tools, such as type checkers, linters, and bundlers.

Python dependencies used only as development tools, such as type checkers, linters, and bundlers.

Attributes

Inherited from:
UvModule
Source
UvModule.scala
def pythonVersion: Simple[String]

Python version request passed to uv when creating the virtual environment.

Python version request passed to uv when creating the virtual environment.

If you'd like to use a specific python version, override this task to point to a specific python executable.

Examples:

// use Mill's default modern Python version
def pythonVersion = T{ "3.12" }

// use a specific minor release
def pythonVersion = T{ "3.13" }

// use a specific executable file
def pythonVersion = T{ "/usr/bin/python3" }

Attributes

Inherited from:
PythonModule
Source
PythonModule.scala
def repositories: Simple[Seq[String]]

The repositories used to resolve dependencies with classpath(). This takes Coursier repository strings as input which are defined here:

The repositories used to resolve dependencies with classpath(). This takes Coursier repository strings as input which are defined here:

For example:

Attributes

Inherited from:
CoursierModule
Source
CoursierModule.scala
def repositoriesTask: Task[Seq[Repository]]

A more flexible version of repositories, that allows custom repositories that are not definable by Coursier repository strings. This is a relatively advanced feature, and for most situations overriding repositories should be sufficient

A more flexible version of repositories, that allows custom repositories that are not definable by Coursier repository strings. This is a relatively advanced feature, and for most situations overriding repositories should be sufficient

See allRepositories if you need to resolve Mill internal modules.

Attributes

Inherited from:
CoursierModule
Source
CoursierModule.scala
def resolutionCustomizer: Task[Option[Resolution => Resolution]]

Customize the coursier resolution process. This is rarely needed to changed, as the default try to provide a highly reproducible resolution process. But sometime, you need more control, e.g. you want to add some OS or JDK specific resolution properties which are sometimes used by Maven and therefore found in dependency artifact metadata. For example, the JavaFX artifacts are known to use OS specific properties. To fix resolution for JavaFX, you could override this task like the following:

Customize the coursier resolution process. This is rarely needed to changed, as the default try to provide a highly reproducible resolution process. But sometime, you need more control, e.g. you want to add some OS or JDK specific resolution properties which are sometimes used by Maven and therefore found in dependency artifact metadata. For example, the JavaFX artifacts are known to use OS specific properties. To fix resolution for JavaFX, you could override this task like the following:

   override def resolutionCustomizer = Task.Anon {
     Some( (r: coursier.core.Resolution) =>
       r.withOsInfo(coursier.core.Activation.Os.fromProperties(sys.props.toMap))
     )
   }

Attributes

Inherited from:
CoursierModule
Source
CoursierModule.scala
def resolutionParams: Task[ResolutionParams]

Resolution parameters, allowing to customize resolution internals

Resolution parameters, allowing to customize resolution internals

This rarely needs to be changed. This allows to disable the new way coursier handles BOMs since coursier 2.1.17 (used in Mill since 0.12.3) for example, with:

 def resolutionParams = super.resolutionParams()
   .withEnableDependencyOverrides(Some(false))

Note that versions forced with Dep#forceVersion() take over forced versions manually set in resolutionParams. The former should be favored to force versions in dependency resolution.

The Scala version set via ScalaModule#scalaVersion also takes over any Scala version provided via ResolutionParams#scalaVersionOpt.

The default configuration set in ResolutionParams#defaultConfiguration is ignored when Mill fetches dependencies to be passed to the compiler (equivalent to Maven "compile scope"). In that case, it forces the default configuration to be "compile". On the other hand, when fetching dependencies for runtime (equivalent to Maven "runtime scope"), the value in ResolutionParams#defaultConfiguration is used.

Attributes

Inherited from:
CoursierModule
Source
CoursierModule.scala
def resources: Simple[Seq[PathRef]]

The folders where the resource files for this module live.

The folders where the resource files for this module live.

Attributes

Inherited from:
PythonModule
Source
PythonModule.scala
def run(args: Args): Command[Unit]

Run the main python script of this module.

Run the main python script of this module.

Attributes

See also
Inherited from:
PythonModule
Source
PythonModule.scala
def runBackground(args: Args): Command[Unit]

Run the main python script of this module.

Run the main python script of this module.

Attributes

See also
Inherited from:
PythonModule
Source
PythonModule.scala

Attributes

Inherited from:
PythonModule
Source
PythonModule.scala
override def toString: String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns

a string representation of the object.

Definition Classes
Module -> Any
Inherited from:
Module
Source
Module.scala
def transitivePythonDeps: Simple[Seq[String]]

Python dependencies of this module and all upstream modules.

Python dependencies of this module and all upstream modules.

Attributes

Inherited from:
UvModule
Source
UvModule.scala

The transitive version of localPythonPath: this includes the directories of all upstream modules as well.

The transitive version of localPythonPath: this includes the directories of all upstream modules as well.

Attributes

Inherited from:
PythonModule
Source
PythonModule.scala

Local Python projects of this module and all upstream modules.

Local Python projects of this module and all upstream modules.

Attributes

Inherited from:
UvModule
Source
UvModule.scala

Requirements files of this module and all upstream modules.

Requirements files of this module and all upstream modules.

Attributes

Inherited from:
UvModule
Source
UvModule.scala

Direct wheels of this module and all upstream modules.

Direct wheels of this module and all upstream modules.

Attributes

Inherited from:
UvModule
Source
UvModule.scala
def tyTool: Simple[String]

The isolated ty tool environment managed and cached by uv.

The isolated ty tool environment managed and cached by uv.

Attributes

Inherited from:
PythonModule
Source
PythonModule.scala
def typeCheck: Simple[Unit]

Run a typechecker on this module.

Run a typechecker on this module.

Attributes

Inherited from:
PythonModule
Source
PythonModule.scala

Additional directories to include in the PYTHONPATH directly. These paths are "unmanaged": they'll be included as they are on disk.

Additional directories to include in the PYTHONPATH directly. These paths are "unmanaged": they'll be included as they are on disk.

Attributes

Inherited from:
PythonModule
Source
PythonModule.scala

Python wheels to install directly. Local wheels should be declared here so their signatures participate in Mill cache invalidation.

Python wheels to install directly. Local wheels should be declared here so their signatures participate in Mill cache invalidation.

Attributes

Inherited from:
UvModule
Source
UvModule.scala
def useShortJvmPath(jvmVersion: String): Boolean

Attributes

Inherited from:
JavaHomeModule
Source
JavaHomeModule.scala
def uvChecksumUrl: Simple[String]

URL of the SHA-256 checksum for uvDownloadUrl.

URL of the SHA-256 checksum for uvDownloadUrl.

Attributes

Inherited from:
UvModule
Source
UvModule.scala
def uvDownloadUrl: Simple[String]

URL of the platform-specific uv archive Mill downloads.

URL of the platform-specific uv archive Mill downloads.

Attributes

Inherited from:
UvModule
Source
UvModule.scala

The uv executable used by this module. Mill downloads it once into the shared Coursier archive cache, verifies its SHA-256 checksum, and reuses it across builds.

The uv executable used by this module. Mill downloads it once into the shared Coursier archive cache, verifies its SHA-256 checksum, and reuses it across builds.

Attributes

Inherited from:
UvModule
Source
UvModule.scala
def uvIndexArgs: Simple[Seq[String]]

uv arguments that preserve the priority order declared by indexes.

uv arguments that preserve the priority order declared by indexes.

Attributes

Inherited from:
UvModule
Source
UvModule.scala

Arguments passed to uv pip install when preparing the environment.

Arguments passed to uv pip install when preparing the environment.

This is an escape hatch. Prefer overriding the higher-level dependency, local-project, wheel, requirements-file, or index tasks.

Attributes

Inherited from:
UvModule
Source
UvModule.scala

A runner for invoking uv with the module environment.

A runner for invoking uv with the module environment.

Attributes

Inherited from:
PythonModule
Source
PythonModule.scala
def uvVersion: Simple[String]

The uv version Mill downloads and uses.

The uv version Mill downloads and uses.

Attributes

Inherited from:
UvModule
Source
UvModule.scala

Attributes

Inherited from:
PythonModule
Source
PythonModule.scala

Attributes

Inherited from:
PythonModule
Source
PythonModule.scala

Deprecated and Inherited methods

def jvmId: Simple[String]

Attributes

Deprecated
Please use `jvmVersion` instead
Inherited from:
JavaHomeModule
Source
JavaHomeModule.scala