Skip to content

Task runner

Make[file]

Makefile

Makefile is a tool which controls the generation of executables and other non-source files of a program from the program's source files.

We can use it to run some commands concisely:

run_doc_server:
    mkdocs serve

run_local_gunicorn:
    gunicorn package.app.main:app --worker-class uvicorn.workers.UvicornWorker

Task[file]

Taskfile

Task is a task runner / build tool that aims to be simpler and easier to use than, for example, GNU Make.

version: '3'

tasks:
  run:
    cmds:
      - streamlit run home.py
  build:
    cmds:
      - bash docker_build.sh

Poetry scripts

Poetry scripts

The scripts section of the pyproject.toml file allows you to define commands that can be executed with poetry run.

[tool.poetry.scripts]
my_package_cli = 'my_package.console:run'

Duty

Duty

pawamoy/duty is a simple task runner. Which is inspired by Invoke.

Typer

Typer

tiangolo/typer is a library for building CLI applications that users will love using and developers will love creating. Based on Python 3.6+ type hints.

$ python main.py --help

 Usage: main.py [OPTIONS] COMMAND [ARGS]...

╭─ Options ─────────────────────────────────────────╮
│ --install-completion          Install completion  │
│                               for the current     │
│                               shell.              │
│ --show-completion             Show completion for │
│                               the current shell,  │
│                               to copy it or       │
│                               customize the       │
│                               installation.       │
│ --help                        Show this message   │
│                               and exit.           │
╰───────────────────────────────────────────────────╯
╭─ Commands ────────────────────────────────────────╮
│ goodbye                                           │
│ hello                                             │
╰───────────────────────────────────────────────────╯

// When you create a package you get  auto-completion  for free, installed with --install-completion

// You have 2 subcommands (the 2 functions): goodbye and hello

Just

Just

casey/just is a handy way to save and run project-specific commands.