API Reference

Invoke

A Python task execution and command-line library for managing shell-oriented automation tasks.

Official Documentation ↗
CompatibilityThis documentation covers version v2.2. Check the official docs for the latest API surface.

Installation

pippip install invoke

Methods

Invoke turns functions into CLI tasks with argument parsing and a context for running commands.

Key Features

  • Task decorator and namespace collection
  • Context run and sudo helpers
  • Config-driven task defaults

Usage Notes

Pin a version and check the official docs for the API surface you depend on before upgrading.

Errors

The official API reference declares the following error types:

API reference evidence

Fetched from official sources on 2026-11-08T16:03:08.4363995+08:00 via WebFetch 官方 API 页面(context / tasks / exceptions).

FAQ

How do I list tasks?
Run inv --list to show all discovered tasks and their arguments.
How do I set default arguments?
Use the task decorator options or an invoke.yaml config so tasks read defaults from configuration.
How is Invoke different from Fabric?
Invoke runs local commands; Fabric extends it to remote hosts over SSH, sharing the task model.