home ¦ Archives ¦ Atom ¦ RSS

cyclopts

Link parkin’: cyclopts

Cyclopts is a modern, easy-to-use command-line interface (CLI) framework that aims to provide an intuitive & efficient developer experience.

Why Cyclopts?

  • Intuitive API: Quickly write CLI applications using a terse, intuitive syntax.
  • Advanced Type Hinting: Full support of all builtin types and even user-specified (yes, including Pydantic, Dataclasses, and Attrs).
  • Rich Help Generation: Automatically generates beautiful help pages from docstrings and other contextual data.
  • Extendable: Easily customize converters, validators, token parsing, and application launching.

Being the CLI aficionado that I am, any newly discovered CLI toolkit is of interest. That being said, it’s nearly impossible to pry Click from my hands.

A Click feature I appreciate is that it’s not trying to be magical with functions or types. There can be a bit of magic in how it implements processing declared by option and argument decorators. However, it’s not trying to imply intent from the code or to make specifying the generated CLI as terse as possible. ‘Explicit is better than implicit’ is part of The Zen of Python, and Click is closer to explicit than many of its successors.

Here’s the intro to a comparison of Cyclopts vs. Typer.

Much of Cyclopts was inspired by the excellent Typer library. Despite its popularity, Typer has some traits that I (and others) find less than ideal. Part of this stems from Typer’s age, with its first release in late 2019, soon after Python 3.8’s release. Because of this, most of its API was initially designed around assigning proxy default values to function parameters. This made the decorated command functions difficult to use outside of Typer. With the introduction of Annotated in python3.9, type-hints were able to be directly annotated, allowing for the removal of these proxy defaults.

Additionally, Typer is built on top of Click. This makes it difficult for newcomers to figure out which elements are Typer-related and which elements are click-related. It’s also hard to tell whether the following criticisms stem from Typer, or the underlying Click. For better-or-worse, Cyclopts uses its own internal parsing strategy, gaining complete control over the process.

This section was originally written about Typer v0.9.0 (May 2023). Some criticisms have been addressed in later Typer versions; updates are noted in the respective sections below.

I find Typer palatable, know of a few admirable libraries that use it, and have put it in practice myself. Typically, though, I’ve always found Click up to anything I needed to get done, including some pretty gnarly CLI argument hacking.

Likely won’t be putting Cyclopts to the test, but it’s good to be as informed as possible.

Tipped off to Cyclopts by looking at the source code for the Talk Python CLI.

© 2008-2025 C. Ross Jam. Licensed under CC BY-NC-SA 4.0 Built using Pelican. Theme based upon Giulio Fidente’s original svbhack, and slightly modified by crossjam.