Command-Line & Dev Tools

argcomplete

The invisible helper that lets you hit Tab in a terminal and have it just know what you meant.

Install it: pip install argcomplete

What does it do?

Argcomplete adds tab-completion to Python command-line programs that use the standard argparse library, so instead of guessing flag names, you type part of a command, hit Tab, and see valid completions pop up. It’s the terminal equivalent of a search bar suggesting the rest of your sentence as you type. Under the hood it intercepts your shell’s completion request, asks the Python program what options are valid right now, and feeds those back instantly. It works with bash, zsh, and a few other shells, quietly wiring itself into how you already work.

See it in action

This sets up a command-line program so that, once installed, pressing the Tab key in the terminal will suggest its available options automatically.

import argparse
import argcomplete

parser = argparse.ArgumentParser()
parser.add_argument("--name")
argcomplete.autocomplete(parser)
args = parser.parse_args()
print(args.name)

Why would a non-developer care?

Small conveniences compound. Every time a command-line tool saves you from typing a full flag name correctly from memory, you’re a little less likely to fat-finger a command and a little more likely to actually explore what a tool can do.

Real-world examples

Command-line tools distributed through package managers often ship argcomplete support so users don’t need to memorize every flag. Without it, command-line software feels noticeably clunkier, forcing people to run —help repeatedly just to remember an option’s exact spelling.

Who uses it

Developers building Python command-line tools with argparse who want their tool to feel as polished as tools written in languages with completion built in natively.

How it compares to alternatives

It’s narrower in scope than Click or Typer, which bake completion in themselves; argcomplete exists specifically to retrofit that same convenience onto the older, more manual argparse library.

New to Python and want to actually try libraries like this yourself?

Find a beginner-friendly course

Related libraries