explaingit

pyinvoke/invoke

4,748PythonAudience · developerComplexity · 2/5Setup · easy

TLDR

Python library for defining automation tasks as plain Python functions and running them from the command line, a Makefile replacement that keeps your build scripts in the same language as your project.

Mindmap

mindmap
  root((Invoke))
    What it does
      Define tasks
      Run shell commands
      CLI from Python
    Key concepts
      Task functions
      Task namespace
      Shell subprocess
    Tech stack
      Python
      PyPI package
    Use cases
      Replace Makefile
      Automate builds
      Team CLI scripts
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Replace a Makefile with Python task functions that run tests, build the project, and deploy, callable with one short terminal command.

USE CASE 2

Wrap shell commands your team runs frequently into named tasks anyone can call without remembering the exact flags.

USE CASE 3

Organize a project's automation scripts into one Python file instead of scattered shell scripts with inconsistent behavior.

Tech stack

PythonPyPI

Getting it running

Difficulty · easy Time to first run · 5min

In plain English

Invoke is a Python library for running shell commands and organizing automation scripts into named tasks that you can call from the command line. The idea is similar to tools like Make or Rake, which let developers define steps such as "run tests" or "build the project" and trigger them with a short command. Invoke brings that same pattern into Python, so you write your tasks as plain Python functions rather than using a separate configuration language with its own syntax rules. The project draws inspiration from earlier tools including Fabric 1.x, a Python library originally built for deploying software to remote servers. Invoke focuses on the local side: running shell-oriented subprocesses and grouping executable Python code into a clean command-line interface. The goal is to let a team keep their automation in the same language as the rest of their project, alongside the source code, rather than in a separate file format. Once you define tasks in a Python file, Invoke exposes them as commands anyone on the team can run from a terminal. This removes the need for a Makefile while staying entirely within Python. The project is published on PyPI and can be installed with a standard Python package manager. It has a project website with introductory documentation and example code, plus a separate versioned API reference site for detailed technical documentation. The README is intentionally short and points to those external resources for the full feature walkthrough. The codebase is tested through CircleCI and code coverage is measured via Codecov. The project maintainer maintains a public roadmap on a personal site.

Copy-paste prompts

Prompt 1
Using Invoke, write a tasks.py file that defines three tasks: one that runs pytest, one that builds a Docker image, and one called release that runs both in sequence. Show me how to call each from the terminal.
Prompt 2
I want to replace my Makefile with Invoke. Show me how to convert a Makefile target that sets an environment variable and runs a shell command into an Invoke task function with the same behavior.
Prompt 3
Using Invoke, how do I create a task that accepts a command-line argument, runs a shell command using that argument, and streams the output to the terminal in real time rather than waiting for the command to finish?
Open on GitHub → Explain another repo

← pyinvoke on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.