🌐
Python Packaging
packaging.python.org β€Ί en β€Ί latest β€Ί guides β€Ί creating-command-line-tools
Creating and packaging command-line tools - Python Packaging User Guide
The command-line interface is built with typer, an easy-to-use CLI parser based on Python type hints. It provides auto-completion and nicely styled command-line help out of the box. Another option would be argparse, a command-line parser which is included in Python’s standard library.
🌐
Plain English
python.plainenglish.io β€Ί the-hidden-art-of-building-cli-tools-in-python-9ffee4779555
The Hidden Art of Building CLI Tools in Python | by Kainat Nafees | Python in Plain English
October 21, 2025 - It was like building my own mini version of Linux utilities β€” all in Python. Once the functionality worked, I wanted it to look nice. I added colors using the rich library.
Discussions

Create a CLI Tool with Python: From Zero to Hero
any reason you are still using setup.py? More on reddit.com
🌐 r/programming
2
6
September 18, 2025
How to create CLI with python
Neither. Just use argparse. Read the docs. More on reddit.com
🌐 r/learnpython
15
10
March 29, 2026
How to create a CLI in Python that can be installed with PIP? - Stack Overflow
As the title suggests, I'm trying to make a python script accessible from the command line. I've found libraries like click and argv that make it easy to access arguments passed from the command li... More on stackoverflow.com
🌐 stackoverflow.com
I wrote a guide to creating and distributing CLI tools in Python and thought it might be appreciated here!
I wrote this over 2 years ago and forgot to share it here. It went mostly ignored on r/Python . I go over how to do argument parsing, how to use PyPI for distribution, how to get pretty colours in the terminal, etc. Let me know if anything is unclear or you have any feedback! More on reddit.com
🌐 r/commandline
9
60
May 3, 2023
🌐
Medium
medium.com β€Ί @shamir.stav_83310 β€Ί lets-create-a-cli-with-python-part-1-ae4fe9e0258b
Let’s Create A CLI With Python β€” Part 1 | by Stav Shamir | Medium
April 11, 2019 - A few more words on what to expect before we start β€” we will be using python 3.7 with the lovely python click library for building CLIs. I will be using python type annotations (because I find them useful), but you don’t have to understand them to follow this series and may ignore them if you like. In this post we will focus on building the skeleton for our CLI with click, and in the following posts we will implement the functions, learn how to distribute the CLI (in a somewhat less conventional way), and finally add auto-completion.
🌐
Medium
medium.com β€Ί nerd-for-tech β€Ί how-to-build-and-distribute-a-cli-tool-with-python-537ae41d9d78
How to - build and distribute a CLI Tool with Python | by Anish Krishnaswamy | Medium
February 25, 2022 - Let us install the tool in this virtual env now. The command for that is python setup.py develop . This would’ve installed the CLI tool to the virtual environment venv . We can verify by typing which cooltool and it should output the location ...
🌐
Episyche
episyche.com β€Ί blog β€Ί how-to-build-a-cli-tool-using-python
How to build a CLI Tool using Python ?<!-- --> | Episyche blog
October 17, 2022 - Python has a built-in module for developing CLI tools, Argparse is the default python module for creating command lines programs. It provides all the features you need to build a simple CLI.
🌐
DEV Community
dev.to β€Ί kanakos01 β€Ί create-a-cli-application-with-python-1j37
Create a CLI application with Python - DEV Community
February 9, 2025 - from setuptools import setup setup( ... you create a setup.py you are ready to build the package. Now, there are 2 options - pip install . - This builds the CLI tool....
🌐
Simon Willison
simonwillison.net β€Ί 2023 β€Ί Sep β€Ί 30 β€Ί cli-tools-python
Things I’ve learned about building CLI tools in Python
September 30, 2023 - Here are some notes on what I’ve learned about designing and implementing CLI tools in Python so far. I build enough CLI apps that I developed my own Cookiecutter template for starting new ones.
🌐
Medium
medium.com β€Ί @mittasid β€Ί ️-how-to-build-a-cli-tool-using-python-761b0ab62f29
πŸ› οΈ How to Build a CLI Tool Using Python | by Siddharth Mitta | Medium
July 16, 2025 - By the end, you’ll be able to create tools that accept user input, run commands, and display helpful outputβ€”all from your terminal. Python is an excellent choice for writing CLI tools because:
Find elsewhere
🌐
Medium
medium.com β€Ί @flymingotech β€Ί building-cli-tools-with-python-a-practical-guide-6c35656597ad
Building CLI Tools with Python: A Practical Guide | by FlymingoTech | Medium
September 10, 2025 - Make it installable β€” Package your CLI so others can use it easily. Write tests β€” Use pytest to test commands and edge cases. Follow naming conventions β€” Short, memorable names work best (git, pip, calc). Building CLI tools with Python is an incredibly rewarding skill.
🌐
Reddit
reddit.com β€Ί r/programming β€Ί create a cli tool with python: from zero to hero
r/programming on Reddit: Create a CLI Tool with Python: From Zero to Hero
September 18, 2025 -

Hey folks,

I just published a deep-dive guide on building command-line tools in Python

In the post, I cover:

  • Why Python is great for CLI development

  • Setting up the environment (with click + rich)

  • Building a real-world file organizer CLI

  • Adding advanced features (config, logging, progress bars)

  • Packaging & making the tool installable (setup.py)

  • Testing with pytest

  • Best practices for error handling, UX, and deployment

If you’ve ever wanted to build your own CLI tools to automate repetitive tasks or just learn how to make polished developer tools, this might help.

🌐
Aaronuurman
aaronuurman.com β€Ί creating-cli-tool-in-python-part-1
Creating CLI tool in Python - part 1
This file is an entry point to the CLI tool. ... This is a setup file needed for setuptool to make this project installable. In this file, I defined a package name, version, the python modules that should be installed, dependencies that setuptool needs to install and entry points.
🌐
Reddit
reddit.com β€Ί r/learnpython β€Ί how to create cli with python
r/learnpython on Reddit: How to create CLI with python
March 29, 2026 -

I want to make a CLI program in python but I dont know how to do it. I heard a bunch of ways to do a CLI program like use typer or fire but I dont know which is the better option. So I am here to look for an answer of which is the best option to build this type of program in python (It doesn't have to be one of the examples I mentioned)

Top answer
1 of 5
29

Use console_scripts to hook to a specific Python method (not a whole executable), setup.py file:

from setuptools import setup
setup(
    ...
    entry_points = {
        'console_scripts': ['mybinary=mymodule.command_line:cli'],
    },
    name='mymodule',
    ...
)

the command_line.py script would be:

import mymodule

def cli():
    print("Hello world!")

and the project directory would look like this:

myproject/
    mymodule/
        __init__.py
        command_line.py
        ...
    setup.py

Setuptools will generate a standalone script β€˜shim’ which imports your module and calls the registered function.

That shim allows you to call mybinary directly and ensures it's correctly invoked by python. It provides platform-specific shims (i.e., on Windows it generates a .exe).

See packaging documentation for more details.

2 of 5
15

You can do this with setuptools

an example of a nice setup.py (say your package requires pandas and numpy):

import setuptools
setuptools.setup(
    name='myscript',
    version='1.0',
    scripts=['./scripts/myscript'],
    author='Me',
    description='This runs my script which is great.',
    packages=['lib.myscript'],
    install_requires=[
        'setuptools',
        'pandas >= 0.22.0',
        'numpy >= 1.16.0'
    ],
    python_requires='>=3.5'
)

Your directory should be setup as follows:

[dkennetz package]$ ls
lib scripts setup.py

inside lib would be:

[dkennetz package]$ ls lib
myscript

inside of myscript would be:

[dkennetz package]$ ls lib/myscript
__main__.py
__init__.py
helper_module1.py
helper_module2.py

main would be used to call your function and do whatever you want to do.

inside scripts would be:

[dkennetz package]$ ls scripts
myscript

and the contents of myscript would be:

#!/usr/bin/env bash

if [[ ! $@ ]]; then
    python3 -m myscript -h
else
    python3 -m myscript $@
fi

then to run you do: python setup.py install

which will install your program and all of the dependencies you included in install_requires=[] in your setup.py and install myscript as a command-line module:

[dkennetz ~]$ myscript
🌐
Uncodemy
uncodemy.com β€Ί blog β€Ί build-your-first-cli-tool-using-python
Build Your First CLI Tool Using Python
The CLI tools, unlike graphical applications, are very good at automation, scripting, and processing routine operations with input given in commands. Python is a good language to use to make tools that are CLI mainly due to its readability, large standard library, and high amount of third party libraries that focus on CLI development.
🌐
CodeSamplez
codesamplez.com β€Ί home β€Ί how to create a python cli tool: step-by-step guide
How to Create a Python CLI Tool: Step-by-Step Guide - CodeSamplez.com
July 24, 2025 - Pro TipπŸ’‘: Learn more in-depth about setting up python local development environment. Python has several libraries for building CLI tools.
🌐
DEV Community
dev.to β€Ί masterdevsabith β€Ί how-to-create-a-cli-tool-in-python-2f52
How to create a CLI tool in Python - DEV Community
August 28, 2025 - seta-timer/ β”œβ”€β”€ pyproject.toml # project metadata + CLI entry point β”œβ”€β”€ README.md # optional └── seta/ # your package code β”œβ”€β”€ __init__.py └── __main__.py # where the typer app lives Β· the __init__.py is empty and is for there for python to treat it as an importable package. In __main__.py we write the functions. So what should we write in pyproject.toml ? Its role is to define how the project is built, packaged, and its metadata. ... [build-system] requires = ["setuptools", "wheel"] build-backend = "setuptools.build_meta" [project] name = "seta" version = "0.1.0" dependencies = ["typer", "plyer"] [project.scripts] seta = "seta.__main__:main"
🌐
InventiveHQ
inventivehq.com β€Ί home β€Ί blog β€Ί python β€Ί how to create cli utilities with python
How to Create CLI Utilities with Python
July 18, 2026 - To build a command-line utility in Python, define your arguments with a parser, wire them to a function, and expose that function as an installable command. The fastest path uses the built-in argparse module (no installation needed) for simple ...
Address: 2305 Historic Decatur Rd, Suite 100, 92106, San Diego
🌐
Plain English
python.plainenglish.io β€Ί how-to-build-your-first-python-cli-tool-step-by-step-f6ef6718c32e
How to Build Your First Python CLI Tool β€” Step by Step | by Abdur Rahman | Python in Plain English
August 8, 2025 - Enter: the CLI tool. I’m convinced that every Python developer β€” beginner or seasoned β€” should build at least one command-line interface (CLI) tool. It’s like a rite of passage. Plus, it gives you a sense of power. Imagine typing a command into your terminal and watching it do something useful.
🌐
Medium
medium.com β€Ί @noransaber685 β€Ί simple-guide-to-creating-a-command-line-interface-cli-in-python-c2de7b8f5e05
Simple Guide to Creating a Command-Line Interface (CLI) in Python | by Noran Saber Abdelfattah | Medium
February 3, 2024 - A CLI allows you to communicate with your computer by typing text commands. You enter a command, and the computer responds accordingly. Here’s how you can create your own CLI: In Python, you can use the cmd module to build your CLI.