Metadata-Version: 2.1
Name: pyrunner
Version: 0.1.2
Summary: Wrap your scripts around a cli.
Home-page: https://github.com/cdancette/pyrunner
Author: Corentin Dancette
Author-email: contact@cdancette.fr
License: MIT
Platform: UNKNOWN
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Requires-Python: >=3.6.0
Description-Content-Type: text/markdown


# pyrunner
Python task runner, that wraps a script

Features
- Write a `.running` token that prevents the task from being ran multiple times.
- Write a `.done` token at the end of the task, so that it is not ran twice.

## Installation

`pip install git+https://github.com/cdancette/pyrunner.git`

## CLI usage

You can use it as a cli, like this : 

```bash
pyrunner <tokens-folder> <command>
```

For example

```bash
pyrunner .tokens/ touch file.txt
```

Will create a file call file.txt.

Another example : 

```bash
pyrunner .tokens/ bash -c "date > date.txt"
```
This command will save the current date in the file `date.txt`. 
If you run it again it will not run.

## Python example

You can also use your command arguments to determine the tokens folder (and avoid duplicating it as an argument).
For this, you need to wrap your script in a python class.

A basic task that creates a file

```python
from pyrunner import Task

class TouchTask(Task):

    def command(self):
        return "touch"

    def experiment_folder(self, args):
        return "." # return current folder

if __name__ == "__main__":
    TouchTask().run()
```

More complex examples are in the examples/ directory.


