Skip to main content

Incredibly simple YAML-based task runner.

Project description

Incredibly simple YAML-based tool for [STRIKEOUT:removing foreign contaminants] running tasks.

Screenshot

Screenshot

Installation

pip3 install mo

Running Tests

Just to demonstrate how much M-O will improve your life:

Before

git clone https://github.com/thomasleese/mo.git
pyvenv venv
pip install -r requirements.txt
pip install -e .
python setup.py test

After

git clone https://github.com/thomasleese/mo.git
python3 -m mo test

The `M-O configuration file <https://github.com/thomasleese/mo/blob/master/mo.yaml#L19>`__ for this repository defines a test task which does the commands above.

Configuration

M-O is configured using a YAML file, typically called mo.yaml.

Tasks

An example task might be:

tasks:
  hello:
    description: Say hello.
    command: echo hello

Tasks can also depend on each other, like this:

tasks:
  hello:
    description: Say hello.
    command: echo hello

  bye:
    description: Say bye.
    command: echo bye
    after:
      - hello

Variables

Each task command can contain variables using the Jinja2 template language. First you declare the variables you want available:

variables:
  greeting:
    description: The greeting.
    default: hello

Next you can use the variable in your tasks:

tasks:
  greet:
    description: Say a greeting.
    command: echo {{ greeting }}

To change the greeting, you would invoke M-O like this:

mo greet -v greeting=howdy

Usage

To run a task, it’s a simple as running:

mo hello

To get a list of all available tasks, you can just run:

mo

Every M-O configuration file comes with a built-in help task which can be used to find out more information about other tasks:

mo help hello

I/O

One unique feature of M-O is that it supports a number of different input/output schemes, two at the moment.

  • human is the default scheme and it displays colourful, well-formatted output through standard out.

  • json is an alternative scheme which sends JSON objects via standard output containing all the information required to display a suitable output to the user. The idea behind the json scheme is that IDEs and other tools will be able to easily integrate M-O support into their software without having to understand mo.yaml files.

To change the scheme M-O uses, you can use the --io flag.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mo-0.1.0.tar.gz (5.8 kB view hashes)

Uploaded Source

Built Distribution

mo-0.1.0-py2.py3-none-any.whl (8.6 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page