Skip to main content

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

GitHub release (latest SemVer) GitHub Release Date License GitHub issues GitHub pull requests GitHub Repo stars PyPI - Downloads Docker Pulls Docs Website Coverage Website Funding

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 types
  • yapx[shtab]: enables shell-completion
  • yapx[rich]: enables prettier help and error messages
  • yapx[tui]: enables experimental TUI support
  • yapx[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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yapx-0.2.1.tar.gz (54.1 kB view hashes)

Uploaded Source

Built Distribution

yapx-0.2.1-py3-none-any.whl (50.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page