Build awesome Python CLIs with ease.
Project description
yapx
Build awesome Python CLIs with ease.
Links | |
---|---|
Code Repo | https://www.github.com/fresh2dev/yapx |
Mirror Repo | https://www.f2dv.com/code/r/yapx |
Documentation | https://www.f2dv.com/code/r/yapx/i |
Changelog | https://www.f2dv.com/code/r/yapx/i/changelog |
License | https://www.f2dv.com/code/r/yapx/i/license |
Funding | https://www.f2dv.com/fund |
Overview
Yapx is "yeah, another argparse extension" for building Python CLIs with the utmost simplicity.
It works by reading type hints of Python functions and dataclasses, and uses them to construct an argparse ArgumentParser
.
Yapx features:
- Support for subcommands
- Support for lists in various forms: (positional)
1 2 3
, (multiple)-x 1 -x 2 -x 3
, (multi-value)-x 1 2 3
, (comma-separated),-x 1, 2, 3
, (string)-x '[1, 2, 3]'
- Support for dictionaries / key-value mappings such as
--values one=1 two=2 three=3
- Support for optional booleans:
--flag
/--no-flag
- Support for feature flags:
--dev
/--test
/--prod
- Support for counting parameters:
-vvv
- Automatic "helpful" arguments:
--help
,--help-all
,--version
, etc. - Support for setting values from environment variables
Install
Yapx has no 3rd-party dependencies out-of-the-box:
pip install yapx
Extras are available to unlock additional functionality:
yapx[pydantic]
: enables support for additional typesyapx[shtab]
: enables shell-completionyapx[rich]
: enables prettier help and error messagesyapx[tui]
: enables experimental TUI supportyapx[extras]
: enables each of the above
Use
See notebooks of examples here:
https://www.f2dv.com/code/r/yapx/i/page/overview
Read more about yapx @ https://www.f2dv.com/code/r/yapx/i
Support
If this project delivers value to you, please provide feedback, code contributions, and/or funding.
See all of my projects @ https://www.f2dv.com/code/r
Brought to you by...
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.