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
- Host: GitHub
- URL: https://github.com/julian-nash/runr
- Owner: Julian-Nash
- Created: 2019-04-19T01:05:47.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2019-04-19T11:38:28.000Z (about 6 years ago)
- Last Synced: 2025-01-24T14:18:07.471Z (5 months ago)
- Language: Python
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
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.cssMinifying CSS
--------------------
src: app/static/css/style.css
dst: app/static/css/style.min.cssMinifying JavaScript
--------------------
src: app/static/js/app.js
dst: app/static/js/app.min.jsRunner report
--------------------
Tasks complete: 3
Tasks failed: 0
Time elapsed: 0.2013 s
```