#Cappa

Timothée Mazzucotelli :python:pawamoy@fosstodon.org
2025-02-09

Also, use #Cappa 😛 Cappa leaves your functions/dataclasses (commands) intact.

cappa.readthedocs.io/en/latest

Timothée Mazzucotelli :python:pawamoy@fosstodon.org
2024-11-04

Rewriting an argparse-based CLI with #Cappa. It's much cleaner:

- less verbose
- better contained (single module instead of using submodules for subcommands)
- better typed (dataclasses!)
- as reusable, or more reusable in other CLIs (classes instead of functions that modify an argparse parser)
- much easier to use programmatically (no need to call `main` or build an `argparse.Namespace` manually)
- better documented
- better output (rich!)

github.com/DanCardin/cappa

Timothée Mazzucotelli :python:pawamoy@fosstodon.org
2024-07-29

@dancardin I'm now recommending #Cappa in my docs: mkdocstrings.github.io/griffe/ (just a quick mention at the end of the section) 😄

Timothée Mazzucotelli :python:pawamoy@fosstodon.org
2023-10-29

#Cappa is awesome. @dancardin does a fantastic job on this project.

Command descriptions can be written in Markdown and are rendered with #Rich, so code blocks are syntax highlighted, and you can even add links. Amazing CLI experience.

Look at this beauty:

Screenshot of the help text of a CLI command. It has "usage" and "options" sections with nice formatting and colors, and the help text is rendered from Markdown using Rich, so code blocks are syntax highlighted, and even links are supported.
Timothée Mazzucotelli :python:pawamoy@fosstodon.org
2023-10-22

What a rabbit hole. Even though #Cappa uses #Rich internally, forcing colors with `FORCE_COLOR=1` did not work.

After a super painful investigation, turns out my #Python code imports a module from #Copier which uses `colorama.init()`.

Changing that to `colorama.just_fix_windows_console()` fixed it, but the output still had an extra reset sequence at the end.

Turns out Copier imports #Plumbum colors module, which registers a function to reset styles at exit.

Don't run things at import time!

Timothée Mazzucotelli :python:pawamoy@fosstodon.org
2023-10-20

I started sponsoring @dancardin (@DanCardin@programming.dev?) for their great work on #Cappa, a super elegant declarative CLI argument parser for Python: github.com/DanCardin/cappa. It makes all the right choices, allowing users to build good, reusable CLIs for their libraries, with #Rich support!

Timothée Mazzucotelli :python:pawamoy@fosstodon.org
2023-10-17

#Cappa puts the finger on what I dislike about #Click: cappa.readthedocs.io/en/latest. I'll try Cappa right now in a new project.

I was also strongly tempted by #arguably (github.com/treykeown/arguably), but Cappa's use of `Annotated` instead of docstrings makes it super attractive given my recent work on supporting PEP 727 (from @tiangolo) with a #Griffe extension.

2022-12-14

Scanning some cool Triassic stuff with the #CAPPA team this week in #riograndedosul #brazil #palaeontology #paleontologia #triássico #paleontology #evolution

Client Info

Server: https://mastodon.social
Version: 2025.07
Repository: https://github.com/cyevgeniy/lmst