An open API service indexing awesome lists of open source software.

https://github.com/julian-nash/runr

Modular Python task runner CLI
https://github.com/julian-nash/runr

Last synced: 3 months ago
JSON representation

Modular Python task runner CLI

Awesome Lists containing this project

README

        

## Python modular task runner CLI

Usage:

```sh
python runr.py --help
```

```sh
Usage: runr.py [OPTIONS]

Options:
-c, --compile [scss] Compile SCSS to CSS
-m, --minify [css|js|all] Minify files
-f, --black TEXT Run Black Python linter
-b, --bandit TEXT Run Bandit security linter
--help Show this message and exit.
```

### Example usage

Compile SCSS to CSS:

```sh
python runr.py -c scss
```

Minify CSS:

```sh
python runr.py -m css
```

Minify JavaScript:

```sh
python runr.py -m js
```

Minify all:

```sh
python runr.py -m all
```

Format with Black:

```sh
python runr.py -f .
```

Security lint with Bandit:

```sh
python runr.py -b my_app
```

### Requirements

```sh
pip install click rcssmin rjsmin libsass black bandit
```

### Dependencies

| Package | Description | Reference |
| --- | --- | --- |
| click | Command line tool | https://github.com/pallets/click |
| rcssmin | CSS minifier | https://github.com/ndparker/rcssmin |
| rjsmin | JavaScript minifier | https://github.com/ndparker/rjsmin |
| libsass | SCSS to CSS compiler | https://github.com/sass/libsass-python |
| black | Python code formatter | https://github.com/ambv/black |
| bandit | Python security linter | https://github.com/PyCQA/bandit |

### Extending

- Add a class method to the `Runner class`
- Add a new `click.option` to the `runr` function
- Call the new method from the `runr` function

### More examples

Compile SCSS and minify all files:

```sh
python runr.py --compile scss --minify all
```

Output:

```pycon
Runner started
--------------------

Compiling SCSS to CSS
--------------------
src: app/static/scss/style.scss
dst: app/static/css/style.css

Minifying CSS
--------------------
src: app/static/css/style.css
dst: app/static/css/style.min.css

Minifying JavaScript
--------------------
src: app/static/js/app.js
dst: app/static/js/app.min.js

Runner report
--------------------
Tasks complete: 3
Tasks failed: 0
Time elapsed: 0.2013 s
```