{"id":22013185,"url":"https://github.com/fresh2dev/yapx","last_synced_at":"2025-05-06T21:44:28.615Z","repository":{"id":172650576,"uuid":"649561007","full_name":"fresh2dev/yapx","owner":"fresh2dev","description":"The next generation of Python's Argparse.","archived":false,"fork":false,"pushed_at":"2024-01-02T05:59:04.000Z","size":1027,"stargazers_count":8,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-26T19:48:53.628Z","etag":null,"topics":["cli","parser","python","tui"],"latest_commit_sha":null,"homepage":"https://www.f2dv.com/r/yapx","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fresh2dev.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null},"funding":{"custom":["https://www.f2dv.com/fund/"]}},"created_at":"2023-06-05T06:36:05.000Z","updated_at":"2024-11-13T09:59:42.000Z","dependencies_parsed_at":"2023-11-08T06:22:32.609Z","dependency_job_id":"637e304d-448a-4ad4-9514-3eb0c78ceda6","html_url":"https://github.com/fresh2dev/yapx","commit_stats":null,"previous_names":["fresh2dev/yapx"],"tags_count":29,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fresh2dev%2Fyapx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fresh2dev%2Fyapx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fresh2dev%2Fyapx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fresh2dev%2Fyapx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fresh2dev","download_url":"https://codeload.github.com/fresh2dev/yapx/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252776398,"owners_count":21802459,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","parser","python","tui"],"created_at":"2024-11-30T03:17:57.145Z","updated_at":"2025-05-06T21:44:28.589Z","avatar_url":"https://github.com/fresh2dev.png","language":"Python","funding_links":["https://www.f2dv.com/fund/"],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eYapx\u003c/h1\u003e\n\u003cp align=\"center\"\u003e\u003cem\u003eThe next generation of Python's Argparse.\u003c/em\u003e\u003c/p\u003e\n\u003ch2 align=\"center\"\u003e\n\u003ca href=\"https://www.f2dv.com/r/yapx/\" target=\"_blank\"\u003eDocumentation\u003c/a\u003e\n| \u003ca href=\"https://www.f2dv.com/s/yapx/\" target=\"_blank\"\u003eSlide Deck\u003c/a\u003e\n| \u003ca href=\"https://www.github.com/fresh2dev/yapx/\" target=\"_blank\"\u003eGit Repo\u003c/a\u003e\n\u003c/h2\u003e\n\n*Yapx* is \"Yeah, Another Argparse eXtension\", a Python library for creating tools with type-safe command-line interfaces (CLIs) -- and even textual user interfaces (TUIs) -- by analyzing type-hints of functions and dataclasses.\n\n\u003e Yeah, Another?\n\nI intended to publish this package as simply `apx`, but PyPi didn't allow it, so I tacked on the *y* to make \\*`yapx`\\*. The nomenclature \"*Yet Another*\" seems demeaning considering what this package is capable of.\n\n\nSo, *\u003cb\u003eYeah\u003c/b\u003e, Another Argparse eXtension* :punch:\n\n\nThink about the repetitive steps involved in creating a command-line application.\n\n1. Define function(s).\n2. Define the command-line interface; i.e., build the `ArgumentParser`.\n3. Parse arguments.\n4. Call the appropriate function(s).\n\nFor example:\n\n```python\nfrom argparse import ArgumentParser\n\n# 1. Define function(s).\ndef say_hello(name: str = 'World'):\n    print(f\"Hello {name}\")\n\n# 2. Define the command-line interface.\nparser = ArgumentParser()\nparser.add_argument(\"--name\", default=\"World\")\n\n# 3. Parse arguments.\nparsed_args = parser.parse_args()\n\n# 4. Call the appropriate function(s).\nsay_hello(name=parsed_args.name)\n```\n\nYapx combines these steps into one:\n\n```python\nimport yapx\n\ndef say_hello(name: str = 'World'):\n    print(f\"Hello {name}\")\n\nyapx.run(say_hello)\n```\n\nYapx is a superset of Python's native Argparse `ArgumentParser`, so you can make use of the high-level abstractions or do the low-level work you're familiar with. Either way, Yapx provides benefits including:\n\n- :lock: Type-casting and validation, with or without [*Pydantic*](https://docs.pydantic.dev).\n- :question: Automatic addition of \"*helpful*\" arguments, including `--help`, `--help-all`, `--version`, and most impressively `--tui`.\n- :heart: Prettier help and error messages.\n- :zap: Command-line autocompletion scripts.\n\nYapx is among several modern Python CLI frameworks, including [*Typer*](https://github.com/tiangolo/typer) and [*Fire*](https://github.com/google/python-fire). Distinguishing characteristics of Yapx include:\n\n- :package: No 3rd-party dependencies required (but can be opted into)\n- :lock: Type-safe argument validation\n- :spider_web: Infinitely-nested commands\n- :tv: Display your CLI as a TUI\n- :question: Handling of unknown arguments using `*args` and `**kwargs`\n- :bulb: Most intuitive\n- :sweat: Least documented\n\nI'd appreciate a more analytical comparison between Yapx and the array of Python CLI frameworks, but that's too ambitious of a goal right now :grimacing:\n\n\n## Install\n\n```\npip install 'yapx[extras]'\n```\n\nOr, to install without 3rd-party dependencies:\n\n```\npip install yapx\n```\n\n## Use\n\n\u003ca href=\"https://www.f2dv.com/s/yapx/\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://img.fresh2.dev/slides_placeholder.png\"\u003e\u003c/img\u003e\n\u003c/a\u003e\n\n---\n\n[![License](https://img.shields.io/github/license/fresh2dev/yapx?color=blue\u0026style=for-the-badge)](https://www.f2dv.com/r/yapx/license/)\n[![GitHub tag (with filter)](https://img.shields.io/github/v/tag/fresh2dev/yapx?filter=!*%5Ba-z%5D*\u0026style=for-the-badge\u0026label=Release\u0026color=blue)](https://www.f2dv.com/r/yapx/changelog/)\n[![GitHub last commit (branch)](https://img.shields.io/github/last-commit/fresh2dev/yapx/main?style=for-the-badge\u0026label=updated\u0026color=blue)](https://www.f2dv.com/r/yapx/changelog/)\n[![GitHub Repo stars](https://img.shields.io/github/stars/fresh2dev/yapx?color=blue\u0026style=for-the-badge)](https://star-history.com/#fresh2dev/yapx\u0026Date)\n\u003c!-- [![Funding](https://img.shields.io/badge/funding-%24%24%24-blue?style=for-the-badge)](https://www.f2dv.com/fund/) --\u003e\n\u003c!-- [![GitHub issues](https://img.shields.io/github/issues-raw/fresh2dev/yapx?color=blue\u0026style=for-the-badge)](https://www.github.com/fresh2dev/yapx/issues/) --\u003e\n\u003c!-- [![GitHub pull requests](https://img.shields.io/github/issues-pr-raw/fresh2dev/yapx?color=blue\u0026style=for-the-badge)](https://www.github.com/fresh2dev/yapx/pulls/) --\u003e\n\u003c!-- [![PyPI - Downloads](https://img.shields.io/pypi/dm/yapx?color=blue\u0026style=for-the-badge)](https://pypi.org/project/yapx/) --\u003e\n\u003c!-- [![Docker Pulls](https://img.shields.io/docker/pulls/fresh2dev/yapx?color=blue\u0026style=for-the-badge)](https://hub.docker.com/r/fresh2dev/yapx/) --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffresh2dev%2Fyapx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffresh2dev%2Fyapx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffresh2dev%2Fyapx/lists"}