Skip to content

translate/makeyfile

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

78 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

makeyfile

A minimal runner that allows you to specify shell commands, python code, or a sequence containing commands/code.

Inspired by the fact that people end up using Make to specify build/test/run scripts for projects, despites its limited capabilities.

Build Status Test Coverage

Install

$ pip install makeyfile

For development install

$ pip install -e [email protected]:translate/makeyfile#egg=makeyfile
$ pip install makeyfile[test]

Configuration

makeyfile looks for a .Makeyfile.json in the current directory.

In this configuration file you can specify python callable code, shell commands, or sequences that may contain any other python/shell/sequences.

Example configuration:

{
    "sequence": {
        "command-sequence0": [
            "shell-command0",
            "shell-command1"
        ],
        "command-sequence1": [
            "command-sequence0",
            "python-command1",
            "shell-command0"
        ],
    },
    "python": {
        "python-command0": "some.module0.callable_code",
        "python-command1": "some.module1.callable_code"
    },
    "shell": {
        "shell-command0": "./runsomething",
        "shell-command1": "run-something-else --with flags"
    }
}

You can also specify shell and python paths. These are appended to $PYTHONPATH and $PATH before any scripts or code are run.

For example if you have some python code in a folder called scripts (scripts/module0.py in the following example) and some executables in a folder ./some/custom/bin, the following config will allow you to call them.

{
    "scripts": ["./scripts"],
    "paths": ["./some/custom/.bin"],
    "python": {
        "python-command0": "module0.callable_code"
    },
    "shell": {
        "shell-command0": "run-something"
    }
}

Usage

Once configured you can call any of your sequences/code/commands using the makey command.

$ makey command-sequence0
$ makey python-command0
$ makey shell-command0

Passing args

For python commands, all args specified when calling makey are passed through to the python callable as argv.

$ makey python-command0 foo bar # python code receives ["foo", "bar"]

For shell commands, calling args are appended to the specified command.

$ makey shell-command0 foo bar # shell command is called with ``foo bar`` appended

For sequences, you cannot specify any additional command line args at runtime.

About

Python command runner

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages