Wrap your scripts around a cli.
Project description
# 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.
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
pyrunner-0.1.1.tar.gz
(2.9 kB
view hashes)
Built Distribution
Close
Hashes for pyrunner-0.1.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 70357618c2f18d3a1aa988b40f4bbb5dbf340b53b691fa7f17f97307e0ed96dd |
|
MD5 | 7ad2a57d3681cde5a3897fe2bed80e6c |
|
BLAKE2b-256 | cb3aad5a4466a62ea1326b302fa424913051bfbea45ac122c6b655b40a49e38a |