Skip to main content

The next generation of Python's Argparse.

Project description

yapx

The next generation of Python's Argparse.

Links
Code Repo https://www.github.com/fresh2dev/yapx
Mirror Repo https://www.f2dv.com/r/yapx
Documentation https://www.f2dv.com/r/yapx
Changelog https://www.f2dv.com/r/yapx/changelog
License https://www.f2dv.com/r/yapx/license
Funding https://www.f2dv.com/fund

GitHub release (latest SemVer) GitHub Release Date License GitHub Repo stars GitHub issues GitHub pull requests PyPI - Downloads Docker Pulls Changelog 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/r/yapx/page/overview

Read more about yapx @ https://www.f2dv.com/r/yapx

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/projects

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.3.tar.gz (54.3 kB view hashes)

Uploaded Source

Built Distribution

yapx-0.2.3-py3-none-any.whl (50.7 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