A simple task runner.
Inspired by Invoke.
Duty requires Python 3.6 or above.
To install Python 3.6, I recommend using pyenv
.
# install pyenv
git clone https://github.com/pyenv/pyenv ~/.pyenv
# setup pyenv (you should also put these three lines in .bashrc or similar)
export PATH="${HOME}/.pyenv/bin:${PATH}"
export PYENV_ROOT="${HOME}/.pyenv"
eval "$(pyenv init -)"
# install Python 3.6
pyenv install 3.6.12
# make it available globally
pyenv global system 3.6.12
With pip
:
python3.6 -m pip install duty
With pipx
:
python3.6 -m pip install --user pipx
pipx install --python python3.6 duty
Create a duties.py
file at the root of your repository.
from duty import duty
@duty
def docs(ctx):
ctx.run("mkdocs build", title="Building documentation")
You can now use the command line tool to run it:
duty docs
See the Usage section in the documentation for more examples.