msgspec-click
Generate Click options from msgspec types
What it is and what it does
msgspec-click bridges two Python libraries: msgspec (a fast serialization library with type validation) and click (a command-line interface framework). It lets you define CLI options as msgspec types—typically dataclasses or structs—and automatically generates click decorators from those definitions, eliminating repetitive option declarations.
The package is designed for developers who want type-safe CLI applications without manually wiring up each argument and option. Instead of writing click decorators by hand, you define your CLI interface as a msgspec type and let the library generate the boilerplate. It supports Python 3.8 through 3.12 on both CPython and PyPy.
Use it for:
- Build a CLI tool where all arguments and options are defined once as a msgspec type, then auto-converted to click decorators.
- Create type-validated command-line interfaces that catch invalid input at parse time using msgspec's validation.
- Reduce boilerplate in multi-command CLI applications by deriving click option groups from structured type definitions.
- Prototype CLI tools quickly by defining the interface as Python types rather than writing click decorator chains.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Generates Click command-line options automatically from msgspec type definitions, reducing boilerplate when building CLI applications with structured type validation.
Yes, if you are already using both click and msgspec and want to reduce CLI boilerplate—the install is frictionless and there are no known vulnerabilities. However, proceed cautiously: the project is dormant (last release 689 days ago), has minimal adoption (74957 monthly downloads, rank 14763), and the license metadata is unclear. Use it for new projects only if you are comfortable maintaining a fork or accepting no upstream updates.
Install
msgspec-click on PyPI
pip
pip install msgspec-clickuv
uv add msgspec-clickpoetry
poetry add msgspec-clickInstalling msgspec-click
Before you install
Low friction install with only two runtime dependencies (click and msgspec). Dormant maintenance status—last release was 689 days ago, so expect no active bug fixes or feature development.
License in practice
License treatment is unclear in the metadata. Verify the actual license terms before relying on this package in production.
Quickstart
pip install msgspec-click
from msgspec import Struct
import click
from msgspec_click import create_command
class Options(Struct):
name: str
count: int = 1
cmd = create_command(Options)
if __name__ == '__main__':
cmd()
Requires Python 3.8 or later; both click and msgspec must be installed as runtime dependencies.
Verify before relying
- Actual license file or SPDX identifier not present in metadata despite MIT reference in description
- Whether dormancy signals end-of-life or stable maintenance mode
- Real-world stability and usage patterns given low adoption metrics
Package facts
| License | not declared (unclear) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — click, msgspec |
| Maintenance | dormant — 689 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 74,957/month — #14,763 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: msgspec_click-0.2.1-py3-none-any.whl
Keywords: click, msgspec
Tags
More Application Frameworks packages
FastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
textualTextual is a Python framework for building…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
mcpBuild and connect to Model Context Protocol…
permissive · top 1,000 on PyPI
WerkzeugWerkzeug is a WSGI utility library providing…
permissive · top 1,000 on PyPI
hatch-vcsA Hatch plugin that automatically determines…
permissive · top 1,000 on PyPI
ddadda is a command-line tool for developing on…
permissive · top 15,000 on PyPI
find-exeFinds executables on the system matching…
unclear · top 15,000 on PyPI
inquirer3Builds interactive command-line prompts with…
permissive · top 15,000 on PyPI
msgspec-mmsgspec-m is a fast serialization and…
permissive · top 15,000 on PyPI
userpathModifies a user's PATH environment variable by…
permissive · top 1,000 on PyPI
hatchHatch is a modern Python project manager that…
permissive · top 1,000 on PyPI
msgspecmsgspec encodes and decodes JSON, MessagePack,…
permissive · top 1,000 on PyPI
click-option-groupAdds option groups to Click CLI applications,…
permissive · top 1,000 on PyPI
dep-syncSynchronizes Python environments by managing…
unclear · top 15,000 on PyPI