Middlefield is a framework for building build tools. Since every build tool is different, middlefield is plugin-based.

Every plugin must be registered with gather in its setup.py.


The middlefield.COMMAND object collects dependencies and commands. It is an elcaminoreal.Commands.

Built-in functionality

Middlefield itself registers two important things:

  • executor is a dependency that maps to a seashore.Executor.
  • self-build is a command that will rebuild a middlefield pex – with the requested packages added (for plugins)

Self Build

The self-build commands builds a middlefield-based PEX with the requested plugins. This allows distributing a single file which knows which middlefield plugins to use


  • --requirements takes a requirements.txt file. This option can be given several times (or none)
  • --package specifies a PyPI package name. This option can be given several times (or none)
  • --output specifies the output file. The file will be executable. It is suggested that the name will be something similar to mf or mf.pex, for consistency.
  • --shebang specifies the shebang line the interpreter will use. Often, /usr/bin/env python3 is a good choice – but that depends on the way the Python interpreter is installed.