โŒจ๏ธ
โŒจ๏ธ Build CLI Tools with Larz ยท LARZ-801 ยท Session 5 of 5

Package & Ship Your CLI

A tool only helps others if they can install it. Packaging your CLI so it installs with pip and runs as a command turns your script into something the world can use.

โฑ 7 min read๐Ÿ“… Updated 2026-07-27๐Ÿ“Š Tables, charts & examples

You've built a capable, polished CLI. The final step is turning it from a script on your machine into something anyone can install and run with a single command. Packaging a Python CLI is straightforward once you know the pieces - a little configuration turns your tool into a proper installable command - and it's what makes your work genuinely shareable.

From script to installable command

A small amount of packaging config declares your tool and, crucially, an 'entry point' that maps a command name to your function.

# pyproject.toml
[project]
name = 'mytool'
version = '0.1.0'

[project.scripts]
mytool = 'mytool.cli:main'   # 'mytool' command -> your function

# then:  pip install .   ->   run:  mytool --help
PieceDoes
pyproject.tomlDeclares the package and its metadata
[project.scripts] entry pointMaps a command name to your function
pip installPuts the command on the user's PATH
Publish (PyPI)So anyone can pip install it

The entry point is the magic: it's what lets a user type your tool's name as a command anywhere, instead of running a script by path.

Share it with the world

Once packaged, you can share it privately (a git install) or publish it so anyone can install it by name.

๐ŸŽฏ
Zero dependencies makes shipping easy. Because larzcli, larztui and friends are pure-Python and dependency-free, your CLI stays light and installs cleanly - no compiling, no dependency conflicts for your users. Package it with a pyproject entry point, test that pip install puts the command on the PATH, write a short README with usage, and you have a real, shareable tool. Publishing to PyPI (or a private index) makes 'pip install mytool' work for anyone.

Ship it

  • Add packaging config - pyproject.toml with metadata.
  • Declare an entry point - maps the command name to your function.
  • pip install - the command lands on the PATH.
  • Document + publish - a README and PyPI make it usable by all.

๐ŸŽฏ Key takeaways

  • A tool only helps others if they can install it - packaging turns your script into a real command.
  • A pyproject entry point maps a command name to your function; pip install puts it on the PATH.
  • Zero-dependency tools install cleanly - no compiling or dependency conflicts for users.
  • Document with a README and publish (PyPI or private) so anyone can pip install it.

Frequently asked

What exactly is an 'entry point' and why do I need one?

An entry point is a small declaration in your packaging config that maps a command name to a function in your code - for example, telling the system that the command 'mytool' should run the main() function in mytool/cli.py. Without it, users would have to run your tool by locating and executing a script file directly (python path/to/script.py), which is clumsy and not how real tools work. With it, after pip install, your tool's name becomes a command available anywhere on the user's system, just like git or ls. It's the standard mechanism that turns a Python script into a proper installable command-line program, and it's just a couple of lines of config.

Do I have to publish to PyPI to share my CLI?

No - you have options depending on your audience. For yourself or a team, people can install directly from a git repository (pip install git+https://...) or from a local build, no public publishing needed. For a private organisation, a private package index works. Publishing to public PyPI is what makes 'pip install mytool' work for anyone in the world, so it's ideal for open-source tools you want widely used. The packaging (pyproject with an entry point) is the same regardless; publishing to PyPI is just the final step for public distribution. Start by making it pip-installable, and publish publicly if and when you want the reach.

๐ŸŽ“ Final session complete

You've finished the Build CLI Tools with Larz sessions

Now lock it in with the coursework.

Do the assignments โ†’

Related lessons

More in this course

Course home → · Browse all courses →