[{"data":1,"prerenderedAt":2429},["ShallowReactive",2],{"page-\u002Fmodern-python-cli-frameworks-architecture\u002Fplugin-architectures-for-extensible-clis\u002Fversioning-a-plugin-api\u002F":3,"content-directory":1881},{"id":4,"title":5,"body":6,"date":1866,"description":1867,"difficulty":1868,"draft":1869,"extension":1870,"meta":1871,"navigation":100,"path":1872,"seo":1873,"stem":1874,"tags":1875,"updated":1866,"__hash__":1880},"content\u002Fmodern-python-cli-frameworks-architecture\u002Fplugin-architectures-for-extensible-clis\u002Fversioning-a-plugin-api\u002Findex.md","Versioning a Plugin API for a Python CLI",{"type":7,"value":8,"toc":1848},"minimark",[9,24,29,55,59,66,70,463,483,487,490,493,503,507,510,613,616,1176,1183,1198,1202,1205,1208,1242,1346,1350,1390,1394,1397,1736,1747,1751,1754,1758,1766,1769,1773,1784,1788,1799,1803,1811,1815,1844],[10,11,12,13,17,18,23],"p",{},"The moment other people write plugins for your CLI, every internal refactor becomes a potential breaking change for code you have never seen. A plugin that imported ",[14,15,16],"code",{},"mytool.core.settings.Settings"," stops working when you move that class. A hook that gained a required argument crashes every plugin that implemented the old signature. Users see \"mytool broke after upgrading\", file the bug against you, and the plugin author finds out last. The way out is to treat the plugin interface as an API in its own right: a small, explicit surface that plugins may depend on, a version number for that surface separate from the CLI's own version, a compatibility check when plugins load, and a deprecation process for changing it. This guide builds all four. It belongs to the ",[19,20,22],"a",{"href":21},"\u002Fmodern-python-cli-frameworks-architecture\u002Fplugin-architectures-for-extensible-clis\u002F","plugin architectures for extensible CLIs topic",".",[25,26,28],"h2",{"id":27},"prerequisites","Prerequisites",[30,31,32,45],"ul",{},[33,34,35,36,40,41,23],"li",{},"A CLI with a plugin mechanism — entry-point commands as in ",[19,37,39],{"href":38},"\u002Fmodern-python-cli-frameworks-architecture\u002Fplugin-architectures-for-extensible-clis\u002Fdiscovering-plugins-with-entry-points\u002F","discovering plugins with entry points",", or hooks as in ",[19,42,44],{"href":43},"\u002Fmodern-python-cli-frameworks-architecture\u002Fplugin-architectures-for-extensible-clis\u002Fhook-based-plugins-with-pluggy\u002F","hook-based plugins with pluggy",[33,46,47,50,51,54],{},[14,48,49],{},"packaging"," for version specifiers (",[14,52,53],{},"uv add packaging",").",[25,56,58],{"id":57},"decide-what-plugins-may-touch","Decide what plugins may touch",[10,60,61,62,65],{},"Plugins will import whatever they can reach. If the only way to get the current settings is ",[14,63,64],{},"from mytool.core.settings import Settings",", that import becomes a de facto API. So give plugins a front door, and make everything else explicitly internal:",[67,68],"inline-diagram",{"name":69},"pv-surface",[71,72,77],"pre",{"className":73,"code":74,"language":75,"meta":76,"style":76},"language-python shiki shiki-themes github-light github-dark","# src\u002Fmytool\u002Fplugin_api.py\n\"\"\"The public API for mytool plugins. Everything else in mytool is internal.\n\nStability: anything exported here follows the plugin API version below.\n\"\"\"\nfrom __future__ import annotations\n\nfrom dataclasses import dataclass\nfrom typing import Protocol\n\nfrom mytool.hookspecs import hookimpl\n\nPLUGIN_API_VERSION = \"2.1\"\n\n__all__ = [\"PLUGIN_API_VERSION\", \"hookimpl\", \"Context\", \"Target\", \"Reporter\"]\n\n\n@dataclass(frozen=True)\nclass Target:\n    \"\"\"A deploy target, as plugins see it.\"\"\"\n    name: str\n    url: str\n    environment: str\n\n\nclass Reporter(Protocol):\n    def info(self, message: str) -> None: ...\n    def warn(self, message: str) -> None: ...\n\n\n@dataclass(frozen=True)\nclass Context:\n    \"\"\"What the host passes to hooks. Fields may be added in minor versions.\"\"\"\n    targets: tuple[Target, ...]\n    reporter: Reporter\n    dry_run: bool = False\n","python","",[14,78,79,88,95,102,108,114,132,137,151,164,169,182,187,199,204,242,247,252,275,287,293,302,310,318,323,328,344,371,391,396,401,416,426,432,443,449],{"__ignoreMap":76},[80,81,84],"span",{"class":82,"line":83},"line",1,[80,85,87],{"class":86},"sJ8bj","# src\u002Fmytool\u002Fplugin_api.py\n",[80,89,91],{"class":82,"line":90},2,[80,92,94],{"class":93},"sZZnC","\"\"\"The public API for mytool plugins. Everything else in mytool is internal.\n",[80,96,98],{"class":82,"line":97},3,[80,99,101],{"emptyLinePlaceholder":100},true,"\n",[80,103,105],{"class":82,"line":104},4,[80,106,107],{"class":93},"Stability: anything exported here follows the plugin API version below.\n",[80,109,111],{"class":82,"line":110},5,[80,112,113],{"class":93},"\"\"\"\n",[80,115,117,121,125,128],{"class":82,"line":116},6,[80,118,120],{"class":119},"szBVR","from",[80,122,124],{"class":123},"sj4cs"," __future__",[80,126,127],{"class":119}," import",[80,129,131],{"class":130},"sVt8B"," annotations\n",[80,133,135],{"class":82,"line":134},7,[80,136,101],{"emptyLinePlaceholder":100},[80,138,140,142,145,148],{"class":82,"line":139},8,[80,141,120],{"class":119},[80,143,144],{"class":130}," dataclasses ",[80,146,147],{"class":119},"import",[80,149,150],{"class":130}," dataclass\n",[80,152,154,156,159,161],{"class":82,"line":153},9,[80,155,120],{"class":119},[80,157,158],{"class":130}," typing ",[80,160,147],{"class":119},[80,162,163],{"class":130}," Protocol\n",[80,165,167],{"class":82,"line":166},10,[80,168,101],{"emptyLinePlaceholder":100},[80,170,172,174,177,179],{"class":82,"line":171},11,[80,173,120],{"class":119},[80,175,176],{"class":130}," mytool.hookspecs ",[80,178,147],{"class":119},[80,180,181],{"class":130}," hookimpl\n",[80,183,185],{"class":82,"line":184},12,[80,186,101],{"emptyLinePlaceholder":100},[80,188,190,193,196],{"class":82,"line":189},13,[80,191,192],{"class":123},"PLUGIN_API_VERSION",[80,194,195],{"class":119}," =",[80,197,198],{"class":93}," \"2.1\"\n",[80,200,202],{"class":82,"line":201},14,[80,203,101],{"emptyLinePlaceholder":100},[80,205,207,210,212,215,218,221,224,226,229,231,234,236,239],{"class":82,"line":206},15,[80,208,209],{"class":123},"__all__",[80,211,195],{"class":119},[80,213,214],{"class":130}," [",[80,216,217],{"class":93},"\"PLUGIN_API_VERSION\"",[80,219,220],{"class":130},", ",[80,222,223],{"class":93},"\"hookimpl\"",[80,225,220],{"class":130},[80,227,228],{"class":93},"\"Context\"",[80,230,220],{"class":130},[80,232,233],{"class":93},"\"Target\"",[80,235,220],{"class":130},[80,237,238],{"class":93},"\"Reporter\"",[80,240,241],{"class":130},"]\n",[80,243,245],{"class":82,"line":244},16,[80,246,101],{"emptyLinePlaceholder":100},[80,248,250],{"class":82,"line":249},17,[80,251,101],{"emptyLinePlaceholder":100},[80,253,255,259,262,266,269,272],{"class":82,"line":254},18,[80,256,258],{"class":257},"sScJk","@dataclass",[80,260,261],{"class":130},"(",[80,263,265],{"class":264},"s4XuR","frozen",[80,267,268],{"class":119},"=",[80,270,271],{"class":123},"True",[80,273,274],{"class":130},")\n",[80,276,278,281,284],{"class":82,"line":277},19,[80,279,280],{"class":119},"class",[80,282,283],{"class":257}," Target",[80,285,286],{"class":130},":\n",[80,288,290],{"class":82,"line":289},20,[80,291,292],{"class":93},"    \"\"\"A deploy target, as plugins see it.\"\"\"\n",[80,294,296,299],{"class":82,"line":295},21,[80,297,298],{"class":130},"    name: ",[80,300,301],{"class":123},"str\n",[80,303,305,308],{"class":82,"line":304},22,[80,306,307],{"class":130},"    url: ",[80,309,301],{"class":123},[80,311,313,316],{"class":82,"line":312},23,[80,314,315],{"class":130},"    environment: ",[80,317,301],{"class":123},[80,319,321],{"class":82,"line":320},24,[80,322,101],{"emptyLinePlaceholder":100},[80,324,326],{"class":82,"line":325},25,[80,327,101],{"emptyLinePlaceholder":100},[80,329,331,333,336,338,341],{"class":82,"line":330},26,[80,332,280],{"class":119},[80,334,335],{"class":257}," Reporter",[80,337,261],{"class":130},[80,339,340],{"class":257},"Protocol",[80,342,343],{"class":130},"):\n",[80,345,347,350,353,356,359,362,365,368],{"class":82,"line":346},27,[80,348,349],{"class":119},"    def",[80,351,352],{"class":257}," info",[80,354,355],{"class":130},"(self, message: ",[80,357,358],{"class":123},"str",[80,360,361],{"class":130},") -> ",[80,363,364],{"class":123},"None",[80,366,367],{"class":130},": ",[80,369,370],{"class":123},"...\n",[80,372,374,376,379,381,383,385,387,389],{"class":82,"line":373},28,[80,375,349],{"class":119},[80,377,378],{"class":257}," warn",[80,380,355],{"class":130},[80,382,358],{"class":123},[80,384,361],{"class":130},[80,386,364],{"class":123},[80,388,367],{"class":130},[80,390,370],{"class":123},[80,392,394],{"class":82,"line":393},29,[80,395,101],{"emptyLinePlaceholder":100},[80,397,399],{"class":82,"line":398},30,[80,400,101],{"emptyLinePlaceholder":100},[80,402,404,406,408,410,412,414],{"class":82,"line":403},31,[80,405,258],{"class":257},[80,407,261],{"class":130},[80,409,265],{"class":264},[80,411,268],{"class":119},[80,413,271],{"class":123},[80,415,274],{"class":130},[80,417,419,421,424],{"class":82,"line":418},32,[80,420,280],{"class":119},[80,422,423],{"class":257}," Context",[80,425,286],{"class":130},[80,427,429],{"class":82,"line":428},33,[80,430,431],{"class":93},"    \"\"\"What the host passes to hooks. Fields may be added in minor versions.\"\"\"\n",[80,433,435,438,441],{"class":82,"line":434},34,[80,436,437],{"class":130},"    targets: tuple[Target, ",[80,439,440],{"class":123},"...",[80,442,241],{"class":130},[80,444,446],{"class":82,"line":445},35,[80,447,448],{"class":130},"    reporter: Reporter\n",[80,450,452,455,458,460],{"class":82,"line":451},36,[80,453,454],{"class":130},"    dry_run: ",[80,456,457],{"class":123},"bool",[80,459,195],{"class":119},[80,461,462],{"class":123}," False\n",[10,464,465,466,470,471,474,475,478,479,482],{},"The module is small on purpose. It exposes ",[467,468,469],"strong",{},"data types"," plugins receive (frozen dataclasses, so plugins cannot mutate host state), ",[467,472,473],{},"protocols"," for services the host provides, the ",[14,476,477],{},"hookimpl"," marker, and the version constant. Internal classes are converted into these public types at the boundary, so the internal ",[14,480,481],{},"Settings"," can be refactored freely.",[25,484,486],{"id":485},"give-the-plugin-api-its-own-version","Give the plugin API its own version",[10,488,489],{},"The CLI's version tracks everything users see; the plugin API version tracks only what plugin authors see. Keeping them separate means a CLI 4.0 that changes command names need not break plugins, and a plugin API 3.0 can happen in a CLI minor release if necessary. Changes to the plugin API follow semantic versioning on their own terms:",[67,491],{"name":492},"pv-change-matrix",[10,494,495,496,499,500,23],{},"Adding a hook, adding an optional argument to a hook, or adding a field to a dataclass the host passes in are all ",[467,497,498],{},"minor"," — existing plugins keep working. pluggy makes the hook case especially safe, because implementations may accept any subset of a hook's arguments. Removing or renaming anything, changing what a return value means, or making a new argument mandatory are ",[467,501,502],{},"major",[25,504,506],{"id":505},"the-recipe-checking-compatibility-at-load-time","The recipe: checking compatibility at load time",[10,508,509],{},"Each plugin declares the plugin API range it was written for — as a module attribute next to its entry point target:",[71,511,513],{"className":73,"code":512,"language":75,"meta":76,"style":76},"# mytool_aws\u002Fplugin.py  (in the plugin package)\nfrom mytool.plugin_api import Context, hookimpl\n\nREQUIRES_PLUGIN_API = \">=2.0,\u003C3\"\n\n\n@hookimpl\ndef mytool_before_deploy(context: Context) -> None:\n    for t in context.targets:\n        context.reporter.info(f\"checking AWS credentials for {t.name}\")\n",[14,514,515,520,532,536,546,550,554,559,574,588],{"__ignoreMap":76},[80,516,517],{"class":82,"line":83},[80,518,519],{"class":86},"# mytool_aws\u002Fplugin.py  (in the plugin package)\n",[80,521,522,524,527,529],{"class":82,"line":90},[80,523,120],{"class":119},[80,525,526],{"class":130}," mytool.plugin_api ",[80,528,147],{"class":119},[80,530,531],{"class":130}," Context, hookimpl\n",[80,533,534],{"class":82,"line":97},[80,535,101],{"emptyLinePlaceholder":100},[80,537,538,541,543],{"class":82,"line":104},[80,539,540],{"class":123},"REQUIRES_PLUGIN_API",[80,542,195],{"class":119},[80,544,545],{"class":93}," \">=2.0,\u003C3\"\n",[80,547,548],{"class":82,"line":110},[80,549,101],{"emptyLinePlaceholder":100},[80,551,552],{"class":82,"line":116},[80,553,101],{"emptyLinePlaceholder":100},[80,555,556],{"class":82,"line":134},[80,557,558],{"class":257},"@hookimpl\n",[80,560,561,564,567,570,572],{"class":82,"line":139},[80,562,563],{"class":119},"def",[80,565,566],{"class":257}," mytool_before_deploy",[80,568,569],{"class":130},"(context: Context) -> ",[80,571,364],{"class":123},[80,573,286],{"class":130},[80,575,576,579,582,585],{"class":82,"line":153},[80,577,578],{"class":119},"    for",[80,580,581],{"class":130}," t ",[80,583,584],{"class":119},"in",[80,586,587],{"class":130}," context.targets:\n",[80,589,590,593,596,599,602,605,608,611],{"class":82,"line":166},[80,591,592],{"class":130},"        context.reporter.info(",[80,594,595],{"class":119},"f",[80,597,598],{"class":93},"\"checking AWS credentials for ",[80,600,601],{"class":123},"{",[80,603,604],{"class":130},"t.name",[80,606,607],{"class":123},"}",[80,609,610],{"class":93},"\"",[80,612,274],{"class":130},[10,614,615],{},"The host checks that declaration before registering the plugin:",[71,617,619],{"className":73,"code":618,"language":75,"meta":76,"style":76},"# src\u002Fmytool\u002Fplugin_loader.py\nfrom __future__ import annotations\n\nfrom dataclasses import dataclass\nfrom importlib.metadata import entry_points\nfrom types import ModuleType\n\nfrom packaging.specifiers import InvalidSpecifier, SpecifierSet\nfrom packaging.version import Version\n\nfrom mytool.plugin_api import PLUGIN_API_VERSION\n\nGROUP = \"mytool\"\n\n\n@dataclass\nclass Rejected:\n    name: str\n    dist: str\n    reason: str\n\n\ndef compatible(module: ModuleType) -> str | None:\n    \"\"\"Return None if compatible, else the reason it is not.\"\"\"\n    spec_text = getattr(module, \"REQUIRES_PLUGIN_API\", None)\n    if spec_text is None:\n        return \"does not declare REQUIRES_PLUGIN_API\"\n    try:\n        spec = SpecifierSet(spec_text)\n    except InvalidSpecifier:\n        return f\"invalid REQUIRES_PLUGIN_API {spec_text!r}\"\n    if Version(PLUGIN_API_VERSION) not in spec:\n        return f\"needs plugin API {spec_text}, this mytool provides {PLUGIN_API_VERSION}\"\n    return None\n\n\ndef load_compatible(pm) -> list[Rejected]:\n    rejected: list[Rejected] = []\n    for ep in sorted(entry_points(group=GROUP), key=lambda e: e.name):\n        dist = f\"{ep.dist.name} {ep.dist.version}\" if ep.dist else \"?\"\n        try:\n            module = ep.load()\n        except Exception as exc:\n            rejected.append(Rejected(ep.name, dist, f\"failed to import: {exc}\"))\n            continue\n        reason = compatible(module)\n        if reason:\n            rejected.append(Rejected(ep.name, dist, reason))\n        else:\n            pm.register(module, name=ep.name)\n    return rejected\n",[14,620,621,626,636,640,650,662,674,678,690,702,706,717,721,731,735,739,744,753,759,766,773,777,781,801,806,828,843,851,858,868,876,899,920,943,951,955,959,970,981,1016,1057,1065,1076,1091,1114,1120,1131,1140,1146,1154,1168],{"__ignoreMap":76},[80,622,623],{"class":82,"line":83},[80,624,625],{"class":86},"# src\u002Fmytool\u002Fplugin_loader.py\n",[80,627,628,630,632,634],{"class":82,"line":90},[80,629,120],{"class":119},[80,631,124],{"class":123},[80,633,127],{"class":119},[80,635,131],{"class":130},[80,637,638],{"class":82,"line":97},[80,639,101],{"emptyLinePlaceholder":100},[80,641,642,644,646,648],{"class":82,"line":104},[80,643,120],{"class":119},[80,645,144],{"class":130},[80,647,147],{"class":119},[80,649,150],{"class":130},[80,651,652,654,657,659],{"class":82,"line":110},[80,653,120],{"class":119},[80,655,656],{"class":130}," importlib.metadata ",[80,658,147],{"class":119},[80,660,661],{"class":130}," entry_points\n",[80,663,664,666,669,671],{"class":82,"line":116},[80,665,120],{"class":119},[80,667,668],{"class":130}," types ",[80,670,147],{"class":119},[80,672,673],{"class":130}," ModuleType\n",[80,675,676],{"class":82,"line":134},[80,677,101],{"emptyLinePlaceholder":100},[80,679,680,682,685,687],{"class":82,"line":139},[80,681,120],{"class":119},[80,683,684],{"class":130}," packaging.specifiers ",[80,686,147],{"class":119},[80,688,689],{"class":130}," InvalidSpecifier, SpecifierSet\n",[80,691,692,694,697,699],{"class":82,"line":153},[80,693,120],{"class":119},[80,695,696],{"class":130}," packaging.version ",[80,698,147],{"class":119},[80,700,701],{"class":130}," Version\n",[80,703,704],{"class":82,"line":166},[80,705,101],{"emptyLinePlaceholder":100},[80,707,708,710,712,714],{"class":82,"line":171},[80,709,120],{"class":119},[80,711,526],{"class":130},[80,713,147],{"class":119},[80,715,716],{"class":123}," PLUGIN_API_VERSION\n",[80,718,719],{"class":82,"line":184},[80,720,101],{"emptyLinePlaceholder":100},[80,722,723,726,728],{"class":82,"line":189},[80,724,725],{"class":123},"GROUP",[80,727,195],{"class":119},[80,729,730],{"class":93}," \"mytool\"\n",[80,732,733],{"class":82,"line":201},[80,734,101],{"emptyLinePlaceholder":100},[80,736,737],{"class":82,"line":206},[80,738,101],{"emptyLinePlaceholder":100},[80,740,741],{"class":82,"line":244},[80,742,743],{"class":257},"@dataclass\n",[80,745,746,748,751],{"class":82,"line":249},[80,747,280],{"class":119},[80,749,750],{"class":257}," Rejected",[80,752,286],{"class":130},[80,754,755,757],{"class":82,"line":254},[80,756,298],{"class":130},[80,758,301],{"class":123},[80,760,761,764],{"class":82,"line":277},[80,762,763],{"class":130},"    dist: ",[80,765,301],{"class":123},[80,767,768,771],{"class":82,"line":289},[80,769,770],{"class":130},"    reason: ",[80,772,301],{"class":123},[80,774,775],{"class":82,"line":295},[80,776,101],{"emptyLinePlaceholder":100},[80,778,779],{"class":82,"line":304},[80,780,101],{"emptyLinePlaceholder":100},[80,782,783,785,788,791,793,796,799],{"class":82,"line":312},[80,784,563],{"class":119},[80,786,787],{"class":257}," compatible",[80,789,790],{"class":130},"(module: ModuleType) -> ",[80,792,358],{"class":123},[80,794,795],{"class":119}," |",[80,797,798],{"class":123}," None",[80,800,286],{"class":130},[80,802,803],{"class":82,"line":320},[80,804,805],{"class":93},"    \"\"\"Return None if compatible, else the reason it is not.\"\"\"\n",[80,807,808,811,813,816,819,822,824,826],{"class":82,"line":325},[80,809,810],{"class":130},"    spec_text ",[80,812,268],{"class":119},[80,814,815],{"class":123}," getattr",[80,817,818],{"class":130},"(module, ",[80,820,821],{"class":93},"\"REQUIRES_PLUGIN_API\"",[80,823,220],{"class":130},[80,825,364],{"class":123},[80,827,274],{"class":130},[80,829,830,833,836,839,841],{"class":82,"line":330},[80,831,832],{"class":119},"    if",[80,834,835],{"class":130}," spec_text ",[80,837,838],{"class":119},"is",[80,840,798],{"class":123},[80,842,286],{"class":130},[80,844,845,848],{"class":82,"line":346},[80,846,847],{"class":119},"        return",[80,849,850],{"class":93}," \"does not declare REQUIRES_PLUGIN_API\"\n",[80,852,853,856],{"class":82,"line":373},[80,854,855],{"class":119},"    try",[80,857,286],{"class":130},[80,859,860,863,865],{"class":82,"line":393},[80,861,862],{"class":130},"        spec ",[80,864,268],{"class":119},[80,866,867],{"class":130}," SpecifierSet(spec_text)\n",[80,869,870,873],{"class":82,"line":398},[80,871,872],{"class":119},"    except",[80,874,875],{"class":130}," InvalidSpecifier:\n",[80,877,878,880,883,886,888,891,894,896],{"class":82,"line":403},[80,879,847],{"class":119},[80,881,882],{"class":119}," f",[80,884,885],{"class":93},"\"invalid REQUIRES_PLUGIN_API ",[80,887,601],{"class":123},[80,889,890],{"class":130},"spec_text",[80,892,893],{"class":119},"!r",[80,895,607],{"class":123},[80,897,898],{"class":93},"\"\n",[80,900,901,903,906,908,911,914,917],{"class":82,"line":418},[80,902,832],{"class":119},[80,904,905],{"class":130}," Version(",[80,907,192],{"class":123},[80,909,910],{"class":130},") ",[80,912,913],{"class":119},"not",[80,915,916],{"class":119}," in",[80,918,919],{"class":130}," spec:\n",[80,921,922,924,926,929,931,933,935,938,941],{"class":82,"line":428},[80,923,847],{"class":119},[80,925,882],{"class":119},[80,927,928],{"class":93},"\"needs plugin API ",[80,930,601],{"class":123},[80,932,890],{"class":130},[80,934,607],{"class":123},[80,936,937],{"class":93},", this mytool provides ",[80,939,940],{"class":123},"{PLUGIN_API_VERSION}",[80,942,898],{"class":93},[80,944,945,948],{"class":82,"line":434},[80,946,947],{"class":119},"    return",[80,949,950],{"class":123}," None\n",[80,952,953],{"class":82,"line":445},[80,954,101],{"emptyLinePlaceholder":100},[80,956,957],{"class":82,"line":451},[80,958,101],{"emptyLinePlaceholder":100},[80,960,962,964,967],{"class":82,"line":961},37,[80,963,563],{"class":119},[80,965,966],{"class":257}," load_compatible",[80,968,969],{"class":130},"(pm) -> list[Rejected]:\n",[80,971,973,976,978],{"class":82,"line":972},38,[80,974,975],{"class":130},"    rejected: list[Rejected] ",[80,977,268],{"class":119},[80,979,980],{"class":130}," []\n",[80,982,984,986,989,991,994,997,1000,1002,1004,1007,1010,1013],{"class":82,"line":983},39,[80,985,578],{"class":119},[80,987,988],{"class":130}," ep ",[80,990,584],{"class":119},[80,992,993],{"class":123}," sorted",[80,995,996],{"class":130},"(entry_points(",[80,998,999],{"class":264},"group",[80,1001,268],{"class":119},[80,1003,725],{"class":123},[80,1005,1006],{"class":130},"), ",[80,1008,1009],{"class":264},"key",[80,1011,1012],{"class":119},"=lambda",[80,1014,1015],{"class":130}," e: e.name):\n",[80,1017,1019,1022,1024,1026,1028,1030,1033,1035,1038,1041,1043,1045,1048,1051,1054],{"class":82,"line":1018},40,[80,1020,1021],{"class":130},"        dist ",[80,1023,268],{"class":119},[80,1025,882],{"class":119},[80,1027,610],{"class":93},[80,1029,601],{"class":123},[80,1031,1032],{"class":130},"ep.dist.name",[80,1034,607],{"class":123},[80,1036,1037],{"class":123}," {",[80,1039,1040],{"class":130},"ep.dist.version",[80,1042,607],{"class":123},[80,1044,610],{"class":93},[80,1046,1047],{"class":119}," if",[80,1049,1050],{"class":130}," ep.dist ",[80,1052,1053],{"class":119},"else",[80,1055,1056],{"class":93}," \"?\"\n",[80,1058,1060,1063],{"class":82,"line":1059},41,[80,1061,1062],{"class":119},"        try",[80,1064,286],{"class":130},[80,1066,1068,1071,1073],{"class":82,"line":1067},42,[80,1069,1070],{"class":130},"            module ",[80,1072,268],{"class":119},[80,1074,1075],{"class":130}," ep.load()\n",[80,1077,1079,1082,1085,1088],{"class":82,"line":1078},43,[80,1080,1081],{"class":119},"        except",[80,1083,1084],{"class":123}," Exception",[80,1086,1087],{"class":119}," as",[80,1089,1090],{"class":130}," exc:\n",[80,1092,1094,1097,1099,1102,1104,1107,1109,1111],{"class":82,"line":1093},44,[80,1095,1096],{"class":130},"            rejected.append(Rejected(ep.name, dist, ",[80,1098,595],{"class":119},[80,1100,1101],{"class":93},"\"failed to import: ",[80,1103,601],{"class":123},[80,1105,1106],{"class":130},"exc",[80,1108,607],{"class":123},[80,1110,610],{"class":93},[80,1112,1113],{"class":130},"))\n",[80,1115,1117],{"class":82,"line":1116},45,[80,1118,1119],{"class":119},"            continue\n",[80,1121,1123,1126,1128],{"class":82,"line":1122},46,[80,1124,1125],{"class":130},"        reason ",[80,1127,268],{"class":119},[80,1129,1130],{"class":130}," compatible(module)\n",[80,1132,1134,1137],{"class":82,"line":1133},47,[80,1135,1136],{"class":119},"        if",[80,1138,1139],{"class":130}," reason:\n",[80,1141,1143],{"class":82,"line":1142},48,[80,1144,1145],{"class":130},"            rejected.append(Rejected(ep.name, dist, reason))\n",[80,1147,1149,1152],{"class":82,"line":1148},49,[80,1150,1151],{"class":119},"        else",[80,1153,286],{"class":130},[80,1155,1157,1160,1163,1165],{"class":82,"line":1156},50,[80,1158,1159],{"class":130},"            pm.register(module, ",[80,1161,1162],{"class":264},"name",[80,1164,268],{"class":119},[80,1166,1167],{"class":130},"ep.name)\n",[80,1169,1171,1173],{"class":82,"line":1170},51,[80,1172,947],{"class":119},[80,1174,1175],{"class":130}," rejected\n",[10,1177,1178,1179,1182],{},"The command layer prints one warning per rejected plugin — naming the plugin, its package and version, and the reason — and carries on with the compatible ones. Users see \"plugin 'aws' (mytool-aws 1.4.0) needs plugin API >=1.0,\u003C2, this mytool provides 2.1\" and know exactly what to upgrade, instead of seeing a ",[14,1180,1181],{},"TypeError"," from deep inside a hook call.",[10,1184,1185,1186,1189,1190,1193,1194,1197],{},"Dependency constraints in the plugin's own ",[14,1187,1188],{},"pyproject.toml"," (",[14,1191,1192],{},"mytool>=3.2,\u003C5",") still matter — they stop installers from putting incompatible versions together in the first place. The runtime check is the second line of defence for environments where that did not happen, such as a user upgrading the CLI with ",[14,1195,1196],{},"pipx upgrade"," while an injected plugin stays behind.",[25,1199,1201],{"id":1200},"changing-a-hook-without-breaking-plugins","Changing a hook without breaking plugins",[10,1203,1204],{},"When a hook must change incompatibly, run old and new side by side for a period:",[67,1206],{"name":1207},"pv-timeline",[1209,1210,1211,1217,1227,1233],"ol",{},[33,1212,1213,1216],{},[467,1214,1215],{},"Add the new hook"," in a minor API release, and have the host call both the new and the old one.",[33,1218,1219,1222,1223,1226],{},[467,1220,1221],{},"Warn"," when a plugin implements the old hook, naming the plugin and the replacement. With pluggy, ",[14,1224,1225],{},"pm.hook.mytool_old_hook.get_hookimpls()"," lists which plugins implement it, so the warning can be precise.",[33,1228,1229,1232],{},[467,1230,1231],{},"Document the migration"," in the plugin changelog with a before-and-after example.",[33,1234,1235,1238,1239,1241],{},[467,1236,1237],{},"Remove the old hook"," in the next major API version, and bump ",[14,1240,192],{}," so unmigrated plugins are rejected cleanly at load time.",[71,1243,1245],{"className":73,"code":1244,"language":75,"meta":76,"style":76},"import warnings\n\n\ndef warn_deprecated_hooks(pm) -> None:\n    for impl in pm.hook.mytool_pre_deploy.get_hookimpls():          # the old hook\n        warnings.warn(\n            f\"plugin {impl.plugin_name!r} implements mytool_pre_deploy, which is deprecated \"\n            \"and will be removed in plugin API 3.0; implement mytool_before_deploy instead\",\n            DeprecationWarning, stacklevel=2,\n        )\n",[14,1246,1247,1254,1258,1262,1276,1291,1296,1316,1324,1341],{"__ignoreMap":76},[80,1248,1249,1251],{"class":82,"line":83},[80,1250,147],{"class":119},[80,1252,1253],{"class":130}," warnings\n",[80,1255,1256],{"class":82,"line":90},[80,1257,101],{"emptyLinePlaceholder":100},[80,1259,1260],{"class":82,"line":97},[80,1261,101],{"emptyLinePlaceholder":100},[80,1263,1264,1266,1269,1272,1274],{"class":82,"line":104},[80,1265,563],{"class":119},[80,1267,1268],{"class":257}," warn_deprecated_hooks",[80,1270,1271],{"class":130},"(pm) -> ",[80,1273,364],{"class":123},[80,1275,286],{"class":130},[80,1277,1278,1280,1283,1285,1288],{"class":82,"line":110},[80,1279,578],{"class":119},[80,1281,1282],{"class":130}," impl ",[80,1284,584],{"class":119},[80,1286,1287],{"class":130}," pm.hook.mytool_pre_deploy.get_hookimpls():          ",[80,1289,1290],{"class":86},"# the old hook\n",[80,1292,1293],{"class":82,"line":116},[80,1294,1295],{"class":130},"        warnings.warn(\n",[80,1297,1298,1301,1304,1306,1309,1311,1313],{"class":82,"line":134},[80,1299,1300],{"class":119},"            f",[80,1302,1303],{"class":93},"\"plugin ",[80,1305,601],{"class":123},[80,1307,1308],{"class":130},"impl.plugin_name",[80,1310,893],{"class":119},[80,1312,607],{"class":123},[80,1314,1315],{"class":93}," implements mytool_pre_deploy, which is deprecated \"\n",[80,1317,1318,1321],{"class":82,"line":139},[80,1319,1320],{"class":93},"            \"and will be removed in plugin API 3.0; implement mytool_before_deploy instead\"",[80,1322,1323],{"class":130},",\n",[80,1325,1326,1329,1331,1334,1336,1339],{"class":82,"line":153},[80,1327,1328],{"class":123},"            DeprecationWarning",[80,1330,220],{"class":130},[80,1332,1333],{"class":264},"stacklevel",[80,1335,268],{"class":119},[80,1337,1338],{"class":123},"2",[80,1340,1323],{"class":130},[80,1342,1343],{"class":82,"line":166},[80,1344,1345],{"class":130},"        )\n",[25,1347,1349],{"id":1348},"ux-considerations","UX considerations",[30,1351,1352,1362,1371,1384],{},[33,1353,1354,1357,1358,1361],{},[467,1355,1356],{},"Publish the plugin API reference separately"," from user documentation, generated from ",[14,1359,1360],{},"plugin_api.py"," and the hook specs, with the version prominently displayed.",[33,1363,1364,1370],{},[467,1365,1366,1367,23],{},"Show API compatibility in ",[14,1368,1369],{},"plugins list"," A column with each plugin's declared range and whether it is compatible answers most support questions.",[33,1372,1373,1376,1377,1379,1380,23],{},[467,1374,1375],{},"Provide a plugin template."," A cookiecutter template with the correct ",[14,1378,540],{},", entry point and tests makes the right thing the default, as in ",[19,1381,1383],{"href":1382},"\u002Fproject-setup-dependency-management\u002Fcli-project-scaffolding-with-cookiecutter\u002Fbuilding-a-cookiecutter-template-for-typer-clis\u002F","building a cookiecutter template for Typer CLIs",[33,1385,1386,1389],{},[467,1387,1388],{},"Test popular plugins in your CI."," If a handful of plugins matter to your users, install them in a CI job and run their test suites against your main branch. You find out about breakage before a release does.",[25,1391,1393],{"id":1392},"testing-the-behaviour","Testing the behaviour",[10,1395,1396],{},"The compatibility check is pure logic over module attributes, so it tests cleanly with throwaway modules:",[71,1398,1400],{"className":73,"code":1399,"language":75,"meta":76,"style":76},"# tests\u002Ftest_plugin_compat.py\nimport types\n\nimport pytest\n\nfrom mytool import plugin_api\nfrom mytool.plugin_loader import compatible\n\n\ndef plugin(requires: str | None) -> types.ModuleType:\n    mod = types.ModuleType(\"fake_plugin\")\n    if requires is not None:\n        mod.REQUIRES_PLUGIN_API = requires\n    return mod\n\n\n@pytest.mark.parametrize(\"requires\", [\">=2.0,\u003C3\", \"~=2.1\", \">=2\"])\ndef test_compatible_ranges(requires):\n    assert compatible(plugin(requires)) is None\n\n\n@pytest.mark.parametrize(\"requires, fragment\", [\n    (\">=1.0,\u003C2\", \"needs plugin API\"),\n    (\"banana\", \"invalid\"),\n    (None, \"does not declare\"),\n])\ndef test_incompatible_plugins_are_explained(requires, fragment):\n    assert fragment in compatible(plugin(requires))\n\n\ndef test_public_api_surface_is_stable():\n    assert set(plugin_api.__all__) == {\"PLUGIN_API_VERSION\", \"hookimpl\", \"Context\", \"Target\", \"Reporter\"}\n",[14,1401,1402,1407,1414,1418,1425,1429,1441,1453,1457,1461,1480,1495,1511,1523,1530,1534,1538,1567,1577,1589,1593,1597,1609,1625,1639,1652,1656,1666,1678,1682,1686,1696],{"__ignoreMap":76},[80,1403,1404],{"class":82,"line":83},[80,1405,1406],{"class":86},"# tests\u002Ftest_plugin_compat.py\n",[80,1408,1409,1411],{"class":82,"line":90},[80,1410,147],{"class":119},[80,1412,1413],{"class":130}," types\n",[80,1415,1416],{"class":82,"line":97},[80,1417,101],{"emptyLinePlaceholder":100},[80,1419,1420,1422],{"class":82,"line":104},[80,1421,147],{"class":119},[80,1423,1424],{"class":130}," pytest\n",[80,1426,1427],{"class":82,"line":110},[80,1428,101],{"emptyLinePlaceholder":100},[80,1430,1431,1433,1436,1438],{"class":82,"line":116},[80,1432,120],{"class":119},[80,1434,1435],{"class":130}," mytool ",[80,1437,147],{"class":119},[80,1439,1440],{"class":130}," plugin_api\n",[80,1442,1443,1445,1448,1450],{"class":82,"line":134},[80,1444,120],{"class":119},[80,1446,1447],{"class":130}," mytool.plugin_loader ",[80,1449,147],{"class":119},[80,1451,1452],{"class":130}," compatible\n",[80,1454,1455],{"class":82,"line":139},[80,1456,101],{"emptyLinePlaceholder":100},[80,1458,1459],{"class":82,"line":153},[80,1460,101],{"emptyLinePlaceholder":100},[80,1462,1463,1465,1468,1471,1473,1475,1477],{"class":82,"line":166},[80,1464,563],{"class":119},[80,1466,1467],{"class":257}," plugin",[80,1469,1470],{"class":130},"(requires: ",[80,1472,358],{"class":123},[80,1474,795],{"class":119},[80,1476,798],{"class":123},[80,1478,1479],{"class":130},") -> types.ModuleType:\n",[80,1481,1482,1485,1487,1490,1493],{"class":82,"line":171},[80,1483,1484],{"class":130},"    mod ",[80,1486,268],{"class":119},[80,1488,1489],{"class":130}," types.ModuleType(",[80,1491,1492],{"class":93},"\"fake_plugin\"",[80,1494,274],{"class":130},[80,1496,1497,1499,1502,1504,1507,1509],{"class":82,"line":184},[80,1498,832],{"class":119},[80,1500,1501],{"class":130}," requires ",[80,1503,838],{"class":119},[80,1505,1506],{"class":119}," not",[80,1508,798],{"class":123},[80,1510,286],{"class":130},[80,1512,1513,1516,1518,1520],{"class":82,"line":189},[80,1514,1515],{"class":130},"        mod.",[80,1517,540],{"class":123},[80,1519,195],{"class":119},[80,1521,1522],{"class":130}," requires\n",[80,1524,1525,1527],{"class":82,"line":201},[80,1526,947],{"class":119},[80,1528,1529],{"class":130}," mod\n",[80,1531,1532],{"class":82,"line":206},[80,1533,101],{"emptyLinePlaceholder":100},[80,1535,1536],{"class":82,"line":244},[80,1537,101],{"emptyLinePlaceholder":100},[80,1539,1540,1543,1545,1548,1551,1554,1556,1559,1561,1564],{"class":82,"line":249},[80,1541,1542],{"class":257},"@pytest.mark.parametrize",[80,1544,261],{"class":130},[80,1546,1547],{"class":93},"\"requires\"",[80,1549,1550],{"class":130},", [",[80,1552,1553],{"class":93},"\">=2.0,\u003C3\"",[80,1555,220],{"class":130},[80,1557,1558],{"class":93},"\"~=2.1\"",[80,1560,220],{"class":130},[80,1562,1563],{"class":93},"\">=2\"",[80,1565,1566],{"class":130},"])\n",[80,1568,1569,1571,1574],{"class":82,"line":254},[80,1570,563],{"class":119},[80,1572,1573],{"class":257}," test_compatible_ranges",[80,1575,1576],{"class":130},"(requires):\n",[80,1578,1579,1582,1585,1587],{"class":82,"line":277},[80,1580,1581],{"class":119},"    assert",[80,1583,1584],{"class":130}," compatible(plugin(requires)) ",[80,1586,838],{"class":119},[80,1588,950],{"class":123},[80,1590,1591],{"class":82,"line":289},[80,1592,101],{"emptyLinePlaceholder":100},[80,1594,1595],{"class":82,"line":295},[80,1596,101],{"emptyLinePlaceholder":100},[80,1598,1599,1601,1603,1606],{"class":82,"line":304},[80,1600,1542],{"class":257},[80,1602,261],{"class":130},[80,1604,1605],{"class":93},"\"requires, fragment\"",[80,1607,1608],{"class":130},", [\n",[80,1610,1611,1614,1617,1619,1622],{"class":82,"line":312},[80,1612,1613],{"class":130},"    (",[80,1615,1616],{"class":93},"\">=1.0,\u003C2\"",[80,1618,220],{"class":130},[80,1620,1621],{"class":93},"\"needs plugin API\"",[80,1623,1624],{"class":130},"),\n",[80,1626,1627,1629,1632,1634,1637],{"class":82,"line":320},[80,1628,1613],{"class":130},[80,1630,1631],{"class":93},"\"banana\"",[80,1633,220],{"class":130},[80,1635,1636],{"class":93},"\"invalid\"",[80,1638,1624],{"class":130},[80,1640,1641,1643,1645,1647,1650],{"class":82,"line":325},[80,1642,1613],{"class":130},[80,1644,364],{"class":123},[80,1646,220],{"class":130},[80,1648,1649],{"class":93},"\"does not declare\"",[80,1651,1624],{"class":130},[80,1653,1654],{"class":82,"line":330},[80,1655,1566],{"class":130},[80,1657,1658,1660,1663],{"class":82,"line":346},[80,1659,563],{"class":119},[80,1661,1662],{"class":257}," test_incompatible_plugins_are_explained",[80,1664,1665],{"class":130},"(requires, fragment):\n",[80,1667,1668,1670,1673,1675],{"class":82,"line":373},[80,1669,1581],{"class":119},[80,1671,1672],{"class":130}," fragment ",[80,1674,584],{"class":119},[80,1676,1677],{"class":130}," compatible(plugin(requires))\n",[80,1679,1680],{"class":82,"line":393},[80,1681,101],{"emptyLinePlaceholder":100},[80,1683,1684],{"class":82,"line":398},[80,1685,101],{"emptyLinePlaceholder":100},[80,1687,1688,1690,1693],{"class":82,"line":403},[80,1689,563],{"class":119},[80,1691,1692],{"class":257}," test_public_api_surface_is_stable",[80,1694,1695],{"class":130},"():\n",[80,1697,1698,1700,1703,1706,1708,1710,1713,1715,1717,1719,1721,1723,1725,1727,1729,1731,1733],{"class":82,"line":418},[80,1699,1581],{"class":119},[80,1701,1702],{"class":123}," set",[80,1704,1705],{"class":130},"(plugin_api.",[80,1707,209],{"class":123},[80,1709,910],{"class":130},[80,1711,1712],{"class":119},"==",[80,1714,1037],{"class":130},[80,1716,217],{"class":93},[80,1718,220],{"class":130},[80,1720,223],{"class":93},[80,1722,220],{"class":130},[80,1724,228],{"class":93},[80,1726,220],{"class":130},[80,1728,233],{"class":93},[80,1730,220],{"class":130},[80,1732,238],{"class":93},[80,1734,1735],{"class":130},"}\n",[10,1737,1738,1739,1742,1743,23],{},"The last test is a small contract: changing what ",[14,1740,1741],{},"plugin_api"," exports requires editing it, which makes the change visible in review — the same principle as the CLI contract tests in ",[19,1744,1746],{"href":1745},"\u002Fproject-setup-dependency-management\u002Fmanaging-cli-versioning-changelogs\u002Fsemantic-versioning-policy-for-cli-tools\u002F","semantic versioning policy for CLI tools",[25,1748,1750],{"id":1749},"conclusion","Conclusion",[10,1752,1753],{},"A plugin ecosystem is only as stable as the interface it is built on. Give plugins one small public module with frozen data types, protocols and the hook marker; version that surface separately from the CLI; have plugins declare the range they support and check it at load time with a clear message; and change hooks by adding, warning and only then removing. Plugin authors get a contract they can rely on, and you keep the freedom to refactor everything behind it.",[25,1755,1757],{"id":1756},"frequently-asked-questions","Frequently asked questions",[1759,1760,1762,1763,1765],"h3",{"id":1761},"is-requires_plugin_api-better-than-a-dependency-on-the-cli-package","Is ",[14,1764,540],{}," better than a dependency on the CLI package?",[10,1767,1768],{},"They work together. The dependency constraint keeps installers from creating incompatible environments; the runtime check catches the ones that exist anyway and produces a clear message. The API range is also more precise, because it tracks the plugin surface rather than the whole CLI.",[1759,1770,1772],{"id":1771},"should-the-host-import-plugin-modules-to-check-their-declared-version","Should the host import plugin modules to check their declared version?",[10,1774,1775,1776,1779,1780,1783],{},"It has to import the module to read the attribute. If import itself might fail on an incompatible host, put the declaration in the plugin's package metadata instead — for example a ",[14,1777,1778],{},"Requires-Dist"," on a tiny ",[14,1781,1782],{},"mytool-plugin-api"," marker package with its own version — so it can be read without importing.",[1759,1785,1787],{"id":1786},"how-do-i-stop-plugins-from-importing-internal-modules-anyway","How do I stop plugins from importing internal modules anyway?",[10,1789,1790,1791,1794,1795,1798],{},"You cannot fully prevent it in Python, but you can make it obviously unsupported: an underscore-prefixed internal package (",[14,1792,1793],{},"mytool._internal","), a clear statement in the docs, and ",[14,1796,1797],{},"plugin_api.__all__"," as the documented surface. Plugins that reach inside accept the risk explicitly.",[1759,1800,1802],{"id":1801},"when-is-it-worth-having-a-plugin-api-version-at-all","When is it worth having a plugin API version at all?",[10,1804,1805,1806,1810],{},"As soon as plugins are written by people who do not release together with the CLI. For plugins maintained in the same repository, a workspace with shared tests, as in ",[19,1807,1809],{"href":1808},"\u002Fproject-setup-dependency-management\u002Fuv-for-python-cli-dependency-management\u002Fuv-workspaces-for-multi-package-clis\u002F","uv workspaces for multi-package CLIs",", is often enough.",[25,1812,1814],{"id":1813},"related","Related",[30,1816,1817,1823,1828,1833,1839],{},[33,1818,1819,1820],{},"Up: ",[19,1821,1822],{"href":21},"Plugin architectures for extensible CLIs",[33,1824,1825],{},[19,1826,1827],{"href":43},"Hook-based plugins with pluggy",[33,1829,1830],{},[19,1831,1832],{"href":38},"Discovering plugins with entry points",[33,1834,1835],{},[19,1836,1838],{"href":1837},"\u002Fproject-setup-dependency-management\u002Flinting-and-type-checking-cli-code\u002Fenforcing-import-boundaries-in-a-cli-codebase\u002F","Enforcing import boundaries in a CLI codebase",[33,1840,1841],{},[19,1842,1843],{"href":1745},"Semantic versioning policy for CLI tools",[1845,1846,1847],"style",{},"html pre.shiki code .sJ8bj, html code.shiki .sJ8bj{--shiki-default:#6A737D;--shiki-dark:#6A737D}html pre.shiki code .sZZnC, html code.shiki .sZZnC{--shiki-default:#032F62;--shiki-dark:#9ECBFF}html pre.shiki code .szBVR, html code.shiki .szBVR{--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .sj4cs, html code.shiki .sj4cs{--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .sVt8B, html code.shiki .sVt8B{--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .sScJk, html code.shiki .sScJk{--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .s4XuR, html code.shiki .s4XuR{--shiki-default:#E36209;--shiki-dark:#FFAB70}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":76,"searchDepth":90,"depth":90,"links":1849},[1850,1851,1852,1853,1854,1855,1856,1857,1858,1865],{"id":27,"depth":90,"text":28},{"id":57,"depth":90,"text":58},{"id":485,"depth":90,"text":486},{"id":505,"depth":90,"text":506},{"id":1200,"depth":90,"text":1201},{"id":1348,"depth":90,"text":1349},{"id":1392,"depth":90,"text":1393},{"id":1749,"depth":90,"text":1750},{"id":1756,"depth":90,"text":1757,"children":1859},[1860,1862,1863,1864],{"id":1761,"depth":97,"text":1861},"Is REQUIRES_PLUGIN_API better than a dependency on the CLI package?",{"id":1771,"depth":97,"text":1772},{"id":1786,"depth":97,"text":1787},{"id":1801,"depth":97,"text":1802},{"id":1813,"depth":90,"text":1814},"2026-09-18","Evolve a Python CLI without breaking its plugins: a small public plugin_api module, an API version separate from the CLI’s, compatibility checks at load time and deprecations.","advanced",false,"md",{},"\u002Fmodern-python-cli-frameworks-architecture\u002Fplugin-architectures-for-extensible-clis\u002Fversioning-a-plugin-api",{"title":5,"description":1867},"modern-python-cli-frameworks-architecture\u002Fplugin-architectures-for-extensible-clis\u002Fversioning-a-plugin-api\u002Findex",[1876,1877,1878,1879],"plugins","versioning","compatibility","api-design","BE3cJtiqd6ebtPKASKijuu3YHA-tSQGYa52718vvMJ0",[1882,1885,1888,1891,1894,1897,1900,1903,1906,1909,1912,1915,1918,1921,1924,1927,1930,1933,1936,1939,1942,1945,1948,1951,1954,1957,1960,1963,1966,1969,1972,1975,1978,1981,1984,1987,1990,1993,1996,1999,2002,2005,2008,2011,2014,2017,2020,2023,2026,2029,2032,2035,2038,2041,2044,2047,2050,2053,2056,2059,2062,2065,2068,2071,2074,2077,2080,2083,2086,2089,2092,2095,2098,2101,2104,2107,2110,2113,2116,2119,2122,2125,2128,2131,2134,2137,2140,2143,2146,2149,2152,2155,2158,2161,2164,2167,2170,2173,2176,2179,2182,2185,2188,2191,2194,2197,2200,2203,2206,2209,2212,2215,2218,2219,2222,2225,2228,2231,2234,2237,2240,2243,2246,2249,2252,2255,2258,2261,2264,2267,2270,2273,2276,2279,2282,2285,2288,2291,2294,2297,2300,2303,2306,2309,2312,2315,2318,2321,2324,2327,2330,2333,2336,2339,2342,2345,2348,2351,2354,2357,2360,2363,2366,2369,2372,2375,2378,2381,2384,2387,2390,2393,2396,2399,2402,2405,2408,2411,2414,2417,2420,2423,2426],{"path":1883,"title":1884},"\u002Fabout","About Python CLI Toolcraft",{"path":1886,"title":1887},"\u002Fadvanced-input-parsing-user-experience\u002Fadvanced-argument-validation-strategies","Advanced Argument Validation Strategies",{"path":1889,"title":1890},"\u002Fadvanced-input-parsing-user-experience\u002Fadvanced-argument-validation-strategies\u002Fparsing-nested-json-arguments-in-python-clis","Parsing Nested JSON Args in Python CLIs",{"path":1892,"title":1893},"\u002Fadvanced-input-parsing-user-experience\u002Fadvanced-argument-validation-strategies\u002Fvalidating-dependent-and-conflicting-options","Validating Dependent and Conflicting CLI Options",{"path":1895,"title":1896},"\u002Fadvanced-input-parsing-user-experience\u002Fadvanced-argument-validation-strategies\u002Fvalidating-file-and-directory-paths-in-clis","Validating File and Directory Paths in CLIs",{"path":1898,"title":1899},"\u002Fadvanced-input-parsing-user-experience\u002Fadvanced-argument-validation-strategies\u002Fwriting-custom-click-parameter-types","Writing Custom Click Parameter Types",{"path":1901,"title":1902},"\u002Fadvanced-input-parsing-user-experience\u002Fbuilding-terminal-uis-with-textual\u002Fbuilding-your-first-textual-app","Building Your First Textual App for a Python CLI",{"path":1904,"title":1905},"\u002Fadvanced-input-parsing-user-experience\u002Fbuilding-terminal-uis-with-textual\u002Fchoosing-between-a-cli-a-prompt-flow-and-a-tui","Choosing Between a CLI, a Prompt Flow and a TUI",{"path":1907,"title":1908},"\u002Fadvanced-input-parsing-user-experience\u002Fbuilding-terminal-uis-with-textual","Building Terminal UIs with Textual for Python CLIs",{"path":1910,"title":1911},"\u002Fadvanced-input-parsing-user-experience\u002Fbuilding-terminal-uis-with-textual\u002Ftesting-textual-apps-with-pilot","Testing Textual Apps with Pilot",{"path":1913,"title":1914},"\u002Fadvanced-input-parsing-user-experience\u002Fcli-help-output-and-documentation\u002Fadding-examples-and-epilogs-to-help-output","Adding Examples and Epilogs to Help Output",{"path":1916,"title":1917},"\u002Fadvanced-input-parsing-user-experience\u002Fcli-help-output-and-documentation\u002Fgenerating-man-pages-and-docs-from-a-cli","Generating Man Pages and Docs from a CLI",{"path":1919,"title":1920},"\u002Fadvanced-input-parsing-user-experience\u002Fcli-help-output-and-documentation","CLI Help Output and Documentation",{"path":1922,"title":1923},"\u002Fadvanced-input-parsing-user-experience\u002Fcli-help-output-and-documentation\u002Fversioning-and-deprecating-cli-flags","Versioning and Deprecating CLI Flags",{"path":1925,"title":1926},"\u002Fadvanced-input-parsing-user-experience\u002Fcli-help-output-and-documentation\u002Fwriting-help-text-users-actually-read","Writing Help Text Users Actually Read",{"path":1928,"title":1929},"\u002Fadvanced-input-parsing-user-experience\u002Fcross-platform-terminal-compatibility\u002Fadapting-output-to-terminal-width","Adapting Python CLI Output to Terminal Width",{"path":1931,"title":1932},"\u002Fadvanced-input-parsing-user-experience\u002Fcross-platform-terminal-compatibility\u002Fdetecting-ci-environments-and-non-interactive-shells","Detecting CI Environments and Non-Interactive Shells",{"path":1934,"title":1935},"\u002Fadvanced-input-parsing-user-experience\u002Fcross-platform-terminal-compatibility\u002Ffixing-unicode-and-encoding-errors-on-windows","Fixing Unicode and Encoding Errors on Windows in Python CLIs",{"path":1937,"title":1938},"\u002Fadvanced-input-parsing-user-experience\u002Fcross-platform-terminal-compatibility","Cross-Platform Terminal Compatibility for Python CLIs",{"path":1940,"title":1941},"\u002Fadvanced-input-parsing-user-experience\u002Fcross-platform-terminal-compatibility\u002Frespecting-no-color-and-force-color","Respecting NO_COLOR and FORCE_COLOR in Python CLIs",{"path":1943,"title":1944},"\u002Fadvanced-input-parsing-user-experience\u002Ferror-handling-and-exit-codes\u002Fchoosing-exit-codes-for-cli-tools","Choosing Exit Codes for CLI Tools",{"path":1946,"title":1947},"\u002Fadvanced-input-parsing-user-experience\u002Ferror-handling-and-exit-codes\u002Fdesigning-an-exception-hierarchy-for-a-cli","Designing an Exception Hierarchy for a Python CLI",{"path":1949,"title":1950},"\u002Fadvanced-input-parsing-user-experience\u002Ferror-handling-and-exit-codes\u002Ffriendly-error-messages-and-tracebacks","Friendly Error Messages and Tracebacks",{"path":1952,"title":1953},"\u002Fadvanced-input-parsing-user-experience\u002Ferror-handling-and-exit-codes\u002Fhandling-keyboard-interrupt-cleanly","Handling Keyboard Interrupt Cleanly",{"path":1955,"title":1956},"\u002Fadvanced-input-parsing-user-experience\u002Ferror-handling-and-exit-codes","Error Handling and Exit Codes for CLIs",{"path":1958,"title":1959},"\u002Fadvanced-input-parsing-user-experience\u002Ferror-handling-and-exit-codes\u002Freporting-machine-readable-errors-in-json-mode","Reporting Machine-Readable Errors in JSON Mode",{"path":1961,"title":1962},"\u002Fadvanced-input-parsing-user-experience\u002Fhandling-configuration-files-env-vars\u002Fconfig-precedence-flags-env-files-defaults","Config Precedence: Flags, Env, Files, Defaults",{"path":1964,"title":1965},"\u002Fadvanced-input-parsing-user-experience\u002Fhandling-configuration-files-env-vars\u002Fdiscovering-project-config-files-by-walking-up-directories","Discovering Project Config Files by Walking Up Directories",{"path":1967,"title":1968},"\u002Fadvanced-input-parsing-user-experience\u002Fhandling-configuration-files-env-vars","Handling Config Files and Env Vars in CLIs",{"path":1970,"title":1971},"\u002Fadvanced-input-parsing-user-experience\u002Fhandling-configuration-files-env-vars\u002Floading-yaml-configs-safely-in-cli-apps","Loading YAML configs safely in CLI apps",{"path":1973,"title":1974},"\u002Fadvanced-input-parsing-user-experience\u002Fhandling-configuration-files-env-vars\u002Freading-toml-config-with-tomllib","Reading TOML Config with tomllib in Python CLIs",{"path":1976,"title":1977},"\u002Fadvanced-input-parsing-user-experience\u002Fhandling-configuration-files-env-vars\u002Ftyped-settings-with-pydantic-settings","Typed Settings with pydantic-settings in Python CLIs",{"path":1979,"title":1980},"\u002Fadvanced-input-parsing-user-experience","Advanced Input Parsing for Python CLIs",{"path":1982,"title":1983},"\u002Fadvanced-input-parsing-user-experience\u002Finteractive-terminal-ui-with-rich\u002Fadding-progress-bars-and-spinners-to-python-clis","Progress Bars and Spinners for Python CLIs",{"path":1985,"title":1986},"\u002Fadvanced-input-parsing-user-experience\u002Finteractive-terminal-ui-with-rich\u002Fbuilding-interactive-prompts-and-menus","Building Interactive Prompts and Menus in Python CLIs",{"path":1988,"title":1989},"\u002Fadvanced-input-parsing-user-experience\u002Finteractive-terminal-ui-with-rich","Interactive Terminal UI with Rich",{"path":1991,"title":1992},"\u002Fadvanced-input-parsing-user-experience\u002Finteractive-terminal-ui-with-rich\u002Flive-dashboards-with-rich-live","Live Dashboards with Rich Live in Python CLIs",{"path":1994,"title":1995},"\u002Fadvanced-input-parsing-user-experience\u002Finteractive-terminal-ui-with-rich\u002Frendering-tables-and-json-with-rich","Rendering Tables and JSON with Rich",{"path":1997,"title":1998},"\u002Fadvanced-input-parsing-user-experience\u002Finteractive-terminal-ui-with-rich\u002Ftheming-rich-output-consistently","Theming Rich Output Consistently in Python CLIs",{"path":2000,"title":2001},"\u002Fadvanced-input-parsing-user-experience\u002Fshell-completion-for-python-clis\u002Fdynamic-completion-values-from-apis-and-files","Dynamic Completion Values from APIs and Files",{"path":2003,"title":2004},"\u002Fadvanced-input-parsing-user-experience\u002Fshell-completion-for-python-clis\u002Fenabling-tab-completion-in-click-and-typer","Enabling Tab Completion in Click and Typer",{"path":2006,"title":2007},"\u002Fadvanced-input-parsing-user-experience\u002Fshell-completion-for-python-clis","Shell Completion for Python CLIs",{"path":2009,"title":2010},"\u002Fadvanced-input-parsing-user-experience\u002Fshell-completion-for-python-clis\u002Finstalling-shell-completion-for-bash-zsh-fish","Installing Shell Completion for bash, zsh, fish",{"path":2012,"title":2013},"\u002Fadvanced-input-parsing-user-experience\u002Fshell-completion-for-python-clis\u002Ftesting-shell-completion-in-python-clis","Testing Shell Completion in Python CLIs",{"path":2015,"title":2016},"\u002Fadvanced-input-parsing-user-experience\u002Fstructured-logging-for-cli-apps\u002Fadding-trace-ids-and-context-to-cli-logs","Adding Trace IDs and Context to Python CLI Logs",{"path":2018,"title":2019},"\u002Fadvanced-input-parsing-user-experience\u002Fstructured-logging-for-cli-apps\u002Fadding-verbose-and-quiet-logging-flags","Adding Verbose and Quiet Logging Flags",{"path":2021,"title":2022},"\u002Fadvanced-input-parsing-user-experience\u002Fstructured-logging-for-cli-apps","Structured Logging for CLI Apps",{"path":2024,"title":2025},"\u002Fadvanced-input-parsing-user-experience\u002Fstructured-logging-for-cli-apps\u002Fstructured-json-logging-in-python-clis","Structured JSON Logging in Python CLIs",{"path":2027,"title":2028},"\u002Fadvanced-input-parsing-user-experience\u002Fstructured-logging-for-cli-apps\u002Fwriting-rotating-log-files-from-a-cli","Writing Rotating Log Files from a Python CLI",{"path":2030,"title":2031},"\u002Fadvanced-input-parsing-user-experience\u002Fworking-with-stdin-stdout-and-pipes\u002Fdetecting-tty-and-adapting-output","Detecting a TTY and Adapting Output",{"path":2033,"title":2034},"\u002Fadvanced-input-parsing-user-experience\u002Fworking-with-stdin-stdout-and-pipes\u002Femitting-json-output-for-scripting","Emitting JSON Output for Scripting",{"path":2036,"title":2037},"\u002Fadvanced-input-parsing-user-experience\u002Fworking-with-stdin-stdout-and-pipes\u002Fhandling-broken-pipe-and-sigpipe","Handling Broken Pipe and SIGPIPE",{"path":2039,"title":2040},"\u002Fadvanced-input-parsing-user-experience\u002Fworking-with-stdin-stdout-and-pipes","Working with stdin, stdout and Pipes",{"path":2042,"title":2043},"\u002Fadvanced-input-parsing-user-experience\u002Fworking-with-stdin-stdout-and-pipes\u002Fprocessing-large-files-and-ndjson-streams","Processing Large Files and NDJSON Streams in Python CLIs",{"path":2045,"title":2046},"\u002Fadvanced-input-parsing-user-experience\u002Fworking-with-stdin-stdout-and-pipes\u002Freading-piped-input-in-python-clis","Reading Piped Input in Python CLIs",{"path":2048,"title":2049},"\u002Fcli-runtime-systems-integration\u002Fcalling-http-apis-from-python-clis\u002Fbuilding-an-api-client-cli-with-httpx","Building an API Client CLI with httpx",{"path":2051,"title":2052},"\u002Fcli-runtime-systems-integration\u002Fcalling-http-apis-from-python-clis\u002Fdownloading-files-with-progress-in-python","Downloading Files with Progress in Python CLIs",{"path":2054,"title":2055},"\u002Fcli-runtime-systems-integration\u002Fcalling-http-apis-from-python-clis","Calling HTTP APIs from Python CLIs",{"path":2057,"title":2058},"\u002Fcli-runtime-systems-integration\u002Fcalling-http-apis-from-python-clis\u002Foauth-device-flow-login-for-clis","OAuth Device Flow Login for Python CLIs",{"path":2060,"title":2061},"\u002Fcli-runtime-systems-integration\u002Fcalling-http-apis-from-python-clis\u002Fpaginating-api-results-in-a-cli","Paginating API Results in a Python CLI",{"path":2063,"title":2064},"\u002Fcli-runtime-systems-integration\u002Fcalling-http-apis-from-python-clis\u002Fretries-and-backoff-for-cli-http-calls","Retries and Backoff for CLI HTTP Calls",{"path":2066,"title":2067},"\u002Fcli-runtime-systems-integration\u002Fconcurrency-and-async-in-python-clis\u002Fcancelling-async-tasks-on-ctrl-c","Cancelling Async Tasks on Ctrl+C in Python CLIs",{"path":2069,"title":2070},"\u002Fcli-runtime-systems-integration\u002Fconcurrency-and-async-in-python-clis","Concurrency and Async in Python CLIs",{"path":2072,"title":2073},"\u002Fcli-runtime-systems-integration\u002Fconcurrency-and-async-in-python-clis\u002Fmultiprocessing-for-cpu-bound-cli-tasks","Multiprocessing for CPU-Bound CLI Tasks",{"path":2075,"title":2076},"\u002Fcli-runtime-systems-integration\u002Fconcurrency-and-async-in-python-clis\u002Fparallelising-cli-work-with-thread-pools","Parallelising CLI Work with Thread Pools",{"path":2078,"title":2079},"\u002Fcli-runtime-systems-integration\u002Fconcurrency-and-async-in-python-clis\u002Frate-limiting-concurrent-requests-in-clis","Rate-Limiting Concurrent Requests in Python CLIs",{"path":2081,"title":2082},"\u002Fcli-runtime-systems-integration\u002Fconcurrency-and-async-in-python-clis\u002Frunning-async-code-in-typer-and-click","Running Async Code in Typer and Click",{"path":2084,"title":2085},"\u002Fcli-runtime-systems-integration\u002Ffilesystem-paths-and-atomic-writes\u002Fcross-platform-paths-with-pathlib","Cross-Platform Paths with pathlib in CLIs",{"path":2087,"title":2088},"\u002Fcli-runtime-systems-integration\u002Ffilesystem-paths-and-atomic-writes\u002Ffile-locking-for-concurrent-cli-runs","File Locking for Concurrent CLI Runs in Python",{"path":2090,"title":2091},"\u002Fcli-runtime-systems-integration\u002Ffilesystem-paths-and-atomic-writes","Filesystem Paths and Atomic Writes for CLIs",{"path":2093,"title":2094},"\u002Fcli-runtime-systems-integration\u002Ffilesystem-paths-and-atomic-writes\u002Fsafe-temporary-files-and-directories","Safe Temporary Files and Directories in CLIs",{"path":2096,"title":2097},"\u002Fcli-runtime-systems-integration\u002Ffilesystem-paths-and-atomic-writes\u002Fstoring-app-data-with-platformdirs","Storing CLI App Data with platformdirs",{"path":2099,"title":2100},"\u002Fcli-runtime-systems-integration\u002Ffilesystem-paths-and-atomic-writes\u002Fwriting-files-atomically-in-python-clis","Writing Files Atomically in Python CLIs",{"path":2102,"title":2103},"\u002Fcli-runtime-systems-integration","CLI Runtime & Systems Integration for Python",{"path":2105,"title":2106},"\u002Fcli-runtime-systems-integration\u002Flong-running-and-watch-mode-clis\u002Fbuilding-a-watch-mode-with-watchfiles","Building a Watch Mode with watchfiles in Python",{"path":2108,"title":2109},"\u002Fcli-runtime-systems-integration\u002Flong-running-and-watch-mode-clis\u002Fhandling-sigterm-and-graceful-shutdown","Handling SIGTERM and Graceful Shutdown in CLIs",{"path":2111,"title":2112},"\u002Fcli-runtime-systems-integration\u002Flong-running-and-watch-mode-clis\u002Fhealth-checks-and-heartbeats-for-long-running-clis","Health Checks and Heartbeats for Long-Running CLIs",{"path":2114,"title":2115},"\u002Fcli-runtime-systems-integration\u002Flong-running-and-watch-mode-clis","Long-Running and Watch-Mode Python CLIs",{"path":2117,"title":2118},"\u002Fcli-runtime-systems-integration\u002Flong-running-and-watch-mode-clis\u002Frunning-a-cli-on-a-schedule-with-cron-and-systemd","Running a Python CLI on a Schedule with cron and systemd",{"path":2120,"title":2121},"\u002Fcli-runtime-systems-integration\u002Frunning-subprocesses-from-python-clis\u002Favoiding-shell-injection-in-python-clis","Avoiding Shell Injection in Python CLIs",{"path":2123,"title":2124},"\u002Fcli-runtime-systems-integration\u002Frunning-subprocesses-from-python-clis\u002Fcalling-external-commands-safely-with-subprocess","Calling External Commands Safely with subprocess",{"path":2126,"title":2127},"\u002Fcli-runtime-systems-integration\u002Frunning-subprocesses-from-python-clis\u002Fhandling-subprocess-timeouts-and-exit-codes","Handling Subprocess Timeouts and Exit Codes",{"path":2129,"title":2130},"\u002Fcli-runtime-systems-integration\u002Frunning-subprocesses-from-python-clis","Running Subprocesses from Python CLIs",{"path":2132,"title":2133},"\u002Fcli-runtime-systems-integration\u002Frunning-subprocesses-from-python-clis\u002Fstreaming-subprocess-output-in-real-time","Streaming Subprocess Output in Real Time",{"path":2135,"title":2136},"\u002Fcli-runtime-systems-integration\u002Frunning-subprocesses-from-python-clis\u002Fwrapping-git-and-other-tools-from-a-python-cli","Wrapping git and Other Tools from a Python CLI",{"path":2138,"title":2139},"\u002Fcli-runtime-systems-integration\u002Fsecrets-and-credentials-in-python-clis","Secrets and Credentials in Python CLIs",{"path":2141,"title":2142},"\u002Fcli-runtime-systems-integration\u002Fsecrets-and-credentials-in-python-clis\u002Fprompting-for-passwords-securely","Prompting for Passwords Securely in Python CLIs",{"path":2144,"title":2145},"\u002Fcli-runtime-systems-integration\u002Fsecrets-and-credentials-in-python-clis\u002Freading-secrets-from-env-and-files","Reading Secrets from Env Vars and Files in CLIs",{"path":2147,"title":2148},"\u002Fcli-runtime-systems-integration\u002Fsecrets-and-credentials-in-python-clis\u002Fredacting-secrets-from-cli-output-and-logs","Redacting Secrets from CLI Output and Logs",{"path":2150,"title":2151},"\u002Fcli-runtime-systems-integration\u002Fsecrets-and-credentials-in-python-clis\u002Fstoring-tokens-with-keyring","Storing CLI Tokens Securely with keyring",{"path":2153,"title":2154},"\u002Fcli-runtime-systems-integration\u002Fsecrets-and-credentials-in-python-clis\u002Fsupporting-multiple-profiles-and-accounts","Supporting Multiple Profiles and Accounts in CLIs",{"path":2156,"title":2157},"\u002F","Python CLI Toolcraft",{"path":2159,"title":2160},"\u002Fmodern-python-cli-frameworks-architecture\u002Fcli-startup-performance-and-lazy-loading\u002Fcaching-expensive-work-between-cli-runs","Caching Expensive Work Between Python CLI Runs",{"path":2162,"title":2163},"\u002Fmodern-python-cli-frameworks-architecture\u002Fcli-startup-performance-and-lazy-loading","CLI Startup Performance and Lazy Loading",{"path":2165,"title":2166},"\u002Fmodern-python-cli-frameworks-architecture\u002Fcli-startup-performance-and-lazy-loading\u002Flazy-loading-subcommands-for-faster-startup","Lazy Loading Subcommands for Faster Startup",{"path":2168,"title":2169},"\u002Fmodern-python-cli-frameworks-architecture\u002Fcli-startup-performance-and-lazy-loading\u002Fprofiling-python-cli-startup-time","Profiling Python CLI Startup Time",{"path":2171,"title":2172},"\u002Fmodern-python-cli-frameworks-architecture\u002Fcli-startup-performance-and-lazy-loading\u002Freducing-cli-dependency-weight","Reducing CLI Dependency Weight",{"path":2174,"title":2175},"\u002Fmodern-python-cli-frameworks-architecture\u002Fcommand-line-parsing-with-argparse\u002Fargparse-subparsers-for-subcommands","argparse Subparsers for Subcommands",{"path":2177,"title":2178},"\u002Fmodern-python-cli-frameworks-architecture\u002Fcommand-line-parsing-with-argparse\u002Fargparse-vs-click-vs-typer-comparison","argparse vs Click vs Typer Compared",{"path":2180,"title":2181},"\u002Fmodern-python-cli-frameworks-architecture\u002Fcommand-line-parsing-with-argparse","Command-Line Parsing with argparse",{"path":2183,"title":2184},"\u002Fmodern-python-cli-frameworks-architecture\u002Fcommand-line-parsing-with-argparse\u002Fmigrating-from-argparse-to-typer","Migrating from argparse to Typer",{"path":2186,"title":2187},"\u002Fmodern-python-cli-frameworks-architecture\u002Fcommand-line-parsing-with-argparse\u002Fmutually-exclusive-options-in-argparse","Mutually Exclusive Options in argparse",{"path":2189,"title":2190},"\u002Fmodern-python-cli-frameworks-architecture\u002Fcommand-line-parsing-with-argparse\u002Fwriting-custom-argparse-actions","Writing Custom argparse Actions in Python",{"path":2192,"title":2193},"\u002Fmodern-python-cli-frameworks-architecture\u002Fdesigning-cli-interfaces-and-conventions\u002Fadding-dry-run-and-confirmation-to-destructive-commands","Adding Dry-Run and Confirmation to Destructive Commands",{"path":2195,"title":2196},"\u002Fmodern-python-cli-frameworks-architecture\u002Fdesigning-cli-interfaces-and-conventions\u002Ffollowing-posix-and-gnu-argument-conventions","Following POSIX and GNU Argument Conventions in Python",{"path":2198,"title":2199},"\u002Fmodern-python-cli-frameworks-architecture\u002Fdesigning-cli-interfaces-and-conventions\u002Fglobal-options-vs-per-command-options","Global Options vs Per-Command Options in Python CLIs",{"path":2201,"title":2202},"\u002Fmodern-python-cli-frameworks-architecture\u002Fdesigning-cli-interfaces-and-conventions","Designing CLI Interfaces and Conventions in Python",{"path":2204,"title":2205},"\u002Fmodern-python-cli-frameworks-architecture\u002Fdesigning-cli-interfaces-and-conventions\u002Fnaming-commands-and-flags-consistently","Naming Commands and Flags Consistently in Python CLIs",{"path":2207,"title":2208},"\u002Fmodern-python-cli-frameworks-architecture","Python CLI Frameworks and Architecture",{"path":2210,"title":2211},"\u002Fmodern-python-cli-frameworks-architecture\u002Fplugin-architectures-for-extensible-clis\u002Fdiscovering-plugins-with-entry-points","Discovering Plugins with Entry Points in Python CLIs",{"path":2213,"title":2214},"\u002Fmodern-python-cli-frameworks-architecture\u002Fplugin-architectures-for-extensible-clis\u002Fhook-based-plugins-with-pluggy","Hook-Based Plugins for Python CLIs with pluggy",{"path":2216,"title":2217},"\u002Fmodern-python-cli-frameworks-architecture\u002Fplugin-architectures-for-extensible-clis","Plugin Architectures for Extensible CLIs",{"path":1872,"title":5},{"path":2220,"title":2221},"\u002Fmodern-python-cli-frameworks-architecture\u002Fplugin-architectures-for-extensible-clis\u002Fwriting-a-plugin-for-an-existing-cli","Writing a Plugin for an Existing CLI",{"path":2223,"title":2224},"\u002Fmodern-python-cli-frameworks-architecture\u002Fstructuring-multi-command-python-clis\u002Fbest-practices-for-python-cli-entry-points","Best practices for Python CLI entry points",{"path":2226,"title":2227},"\u002Fmodern-python-cli-frameworks-architecture\u002Fstructuring-multi-command-python-clis\u002Fdependency-injection-patterns-for-cli-commands","Dependency Injection Patterns for CLI Commands",{"path":2229,"title":2230},"\u002Fmodern-python-cli-frameworks-architecture\u002Fstructuring-multi-command-python-clis\u002Fhow-to-structure-a-large-python-cli-project","Structuring a Large Python CLI Project",{"path":2232,"title":2233},"\u002Fmodern-python-cli-frameworks-architecture\u002Fstructuring-multi-command-python-clis","Structuring Multi-Command Python CLIs",{"path":2235,"title":2236},"\u002Fmodern-python-cli-frameworks-architecture\u002Fstructuring-multi-command-python-clis\u002Fsharing-common-options-across-commands","Sharing Common Options Across Python CLI Commands",{"path":2238,"title":2239},"\u002Fmodern-python-cli-frameworks-architecture\u002Fstructuring-multi-command-python-clis\u002Fsharing-state-with-click-context-objects","Sharing State with Click Context Objects",{"path":2241,"title":2242},"\u002Fmodern-python-cli-frameworks-architecture\u002Ftesting-python-cli-applications\u002Fend-to-end-testing-an-installed-cli","End-to-End Testing an Installed Python CLI",{"path":2244,"title":2245},"\u002Fmodern-python-cli-frameworks-architecture\u002Ftesting-python-cli-applications","Testing Python CLI Applications",{"path":2247,"title":2248},"\u002Fmodern-python-cli-frameworks-architecture\u002Ftesting-python-cli-applications\u002Fmeasuring-cli-test-coverage","Measuring CLI Test Coverage",{"path":2250,"title":2251},"\u002Fmodern-python-cli-frameworks-architecture\u002Ftesting-python-cli-applications\u002Fmocking-filesystem-and-network-in-cli-tests","Mocking the Filesystem and Network in CLI Tests",{"path":2253,"title":2254},"\u002Fmodern-python-cli-frameworks-architecture\u002Ftesting-python-cli-applications\u002Fproperty-based-testing-cli-arguments-with-hypothesis","Property-Based Testing CLI Arguments with Hypothesis",{"path":2256,"title":2257},"\u002Fmodern-python-cli-frameworks-architecture\u002Ftesting-python-cli-applications\u002Fsnapshot-testing-cli-output","Snapshot Testing CLI Output",{"path":2259,"title":2260},"\u002Fmodern-python-cli-frameworks-architecture\u002Ftesting-python-cli-applications\u002Ftesting-click-commands-with-clirunner","Testing Click Commands with CliRunner",{"path":2262,"title":2263},"\u002Fmodern-python-cli-frameworks-architecture\u002Ftesting-python-cli-applications\u002Ftesting-interactive-prompts-and-stdin","Testing Interactive Prompts and stdin",{"path":2265,"title":2266},"\u002Fmodern-python-cli-frameworks-architecture\u002Ftyper-vs-click-when-to-use-each\u002Fbuilding-a-cli-with-subcommands-in-click","Building a CLI with subcommands in Click",{"path":2268,"title":2269},"\u002Fmodern-python-cli-frameworks-architecture\u002Ftyper-vs-click-when-to-use-each\u002Fbuilding-dynamic-commands-in-click","Building Dynamic Commands in Click",{"path":2271,"title":2272},"\u002Fmodern-python-cli-frameworks-architecture\u002Ftyper-vs-click-when-to-use-each\u002Fconverting-a-click-app-to-typer","Converting a Click App to Typer",{"path":2274,"title":2275},"\u002Fmodern-python-cli-frameworks-architecture\u002Ftyper-vs-click-when-to-use-each","Typer vs Click: When to Use Each",{"path":2277,"title":2278},"\u002Fmodern-python-cli-frameworks-architecture\u002Ftyper-vs-click-when-to-use-each\u002Ftyper-callback-functions-explained","Typer callback functions explained",{"path":2280,"title":2281},"\u002Fmodern-python-cli-frameworks-architecture\u002Ftyper-vs-click-when-to-use-each\u002Fusing-annotated-options-in-typer","Using Annotated Options in Typer",{"path":2283,"title":2284},"\u002Fproject-setup-dependency-management\u002Fci-cd-pipelines-for-python-clis\u002Fautomating-releases-from-git-tags","Automating Python CLI Releases from Git Tags",{"path":2286,"title":2287},"\u002Fproject-setup-dependency-management\u002Fci-cd-pipelines-for-python-clis\u002Fcaching-uv-dependencies-in-ci","Caching uv Dependencies in CI for Python CLIs",{"path":2289,"title":2290},"\u002Fproject-setup-dependency-management\u002Fci-cd-pipelines-for-python-clis","CI\u002FCD Pipelines for Python CLIs",{"path":2292,"title":2293},"\u002Fproject-setup-dependency-management\u002Fci-cd-pipelines-for-python-clis\u002Fpublishing-to-pypi-with-trusted-publishing","Publishing a CLI to PyPI with Trusted Publishing",{"path":2295,"title":2296},"\u002Fproject-setup-dependency-management\u002Fci-cd-pipelines-for-python-clis\u002Fsmoke-testing-the-built-wheel-in-ci","Smoke-Testing the Built Wheel of a Python CLI in CI",{"path":2298,"title":2299},"\u002Fproject-setup-dependency-management\u002Fci-cd-pipelines-for-python-clis\u002Ftesting-a-cli-across-python-versions-with-github-actions","Testing a CLI Across Python Versions in GitHub Actions",{"path":2301,"title":2302},"\u002Fproject-setup-dependency-management\u002Fcli-project-scaffolding-with-cookiecutter\u002Fbuilding-a-cookiecutter-template-for-typer-clis","Building a Cookiecutter Template for Typer CLIs",{"path":2304,"title":2305},"\u002Fproject-setup-dependency-management\u002Fcli-project-scaffolding-with-cookiecutter\u002Fcopier-vs-cookiecutter-for-cli-templates","Copier vs Cookiecutter for CLI Templates",{"path":2307,"title":2308},"\u002Fproject-setup-dependency-management\u002Fcli-project-scaffolding-with-cookiecutter","CLI Project Scaffolding with Cookiecutter",{"path":2310,"title":2311},"\u002Fproject-setup-dependency-management\u002Fcli-project-scaffolding-with-cookiecutter\u002Fpost-generation-hooks-in-cli-templates","Post-Generation Hooks in Python CLI Templates",{"path":2313,"title":2314},"\u002Fproject-setup-dependency-management\u002Fdistributing-clis-as-standalone-binaries\u002Fbuilding-cross-platform-release-binaries-in-ci","Building Cross-Platform Release Binaries in CI",{"path":2316,"title":2317},"\u002Fproject-setup-dependency-management\u002Fdistributing-clis-as-standalone-binaries\u002Fbundling-a-python-cli-with-pyinstaller","Bundling a Python CLI with PyInstaller",{"path":2319,"title":2320},"\u002Fproject-setup-dependency-management\u002Fdistributing-clis-as-standalone-binaries\u002Fhomebrew-and-scoop-packaging-for-python-clis","Homebrew and Scoop Packaging for Python CLIs",{"path":2322,"title":2323},"\u002Fproject-setup-dependency-management\u002Fdistributing-clis-as-standalone-binaries","Distributing CLIs as Standalone Binaries",{"path":2325,"title":2326},"\u002Fproject-setup-dependency-management\u002Fdistributing-clis-as-standalone-binaries\u002Fnuitka-vs-pyinstaller-for-python-clis","Nuitka vs PyInstaller for Python CLI Binaries",{"path":2328,"title":2329},"\u002Fproject-setup-dependency-management\u002Fdistributing-clis-as-standalone-binaries\u002Fshipping-a-cli-as-a-zipapp-with-shiv","Shipping a CLI as a Zipapp with shiv",{"path":2331,"title":2332},"\u002Fproject-setup-dependency-management","Project Setup & Dependency Management",{"path":2334,"title":2335},"\u002Fproject-setup-dependency-management\u002Flinting-and-type-checking-cli-code\u002Fconfiguring-ruff-for-a-cli-project","Configuring Ruff for a Python CLI Project",{"path":2337,"title":2338},"\u002Fproject-setup-dependency-management\u002Flinting-and-type-checking-cli-code\u002Fenforcing-import-boundaries-in-a-cli-codebase","Enforcing Import Boundaries in a Python CLI Codebase",{"path":2340,"title":2341},"\u002Fproject-setup-dependency-management\u002Flinting-and-type-checking-cli-code","Linting and Type-Checking Python CLI Code",{"path":2343,"title":2344},"\u002Fproject-setup-dependency-management\u002Flinting-and-type-checking-cli-code\u002Ftype-checking-click-and-typer-code-with-mypy","Type-Checking Click and Typer Code with mypy",{"path":2346,"title":2347},"\u002Fproject-setup-dependency-management\u002Fmanaging-cli-versioning-changelogs\u002Fautomating-changelogs-with-conventional-commits","Automating Changelogs with Conventional Commits",{"path":2349,"title":2350},"\u002Fproject-setup-dependency-management\u002Fmanaging-cli-versioning-changelogs\u002Fderiving-versions-from-git-tags-with-hatch-vcs","Deriving CLI Versions from Git Tags with hatch-vcs",{"path":2352,"title":2353},"\u002Fproject-setup-dependency-management\u002Fmanaging-cli-versioning-changelogs\u002Fexposing-version-info-and-build-metadata","Exposing Version Info and Build Metadata",{"path":2355,"title":2356},"\u002Fproject-setup-dependency-management\u002Fmanaging-cli-versioning-changelogs","Managing CLI Versioning & Changelogs",{"path":2358,"title":2359},"\u002Fproject-setup-dependency-management\u002Fmanaging-cli-versioning-changelogs\u002Fsemantic-versioning-policy-for-cli-tools","A Semantic Versioning Policy for CLI Tools",{"path":2361,"title":2362},"\u002Fproject-setup-dependency-management\u002Fpackaging-python-clis-for-distribution\u002Fbuilding-wheels-and-sdists-for-python-clis","Building Wheels and sdists for Python CLIs",{"path":2364,"title":2365},"\u002Fproject-setup-dependency-management\u002Fpackaging-python-clis-for-distribution\u002Fbundling-data-files-with-importlib-resources","Bundling Data Files with importlib.resources in CLIs",{"path":2367,"title":2368},"\u002Fproject-setup-dependency-management\u002Fpackaging-python-clis-for-distribution","Packaging Python CLIs for Distribution",{"path":2370,"title":2371},"\u002Fproject-setup-dependency-management\u002Fpackaging-python-clis-for-distribution\u002Finstalling-and-distributing-clis-with-pipx","Installing and Distributing CLIs with pipx",{"path":2373,"title":2374},"\u002Fproject-setup-dependency-management\u002Fpackaging-python-clis-for-distribution\u002Fpublishing-a-python-cli-to-pypi","Publishing a Python CLI to PyPI",{"path":2376,"title":2377},"\u002Fproject-setup-dependency-management\u002Fpackaging-python-clis-for-distribution\u002Fwriting-pyproject-toml-metadata-for-a-cli","Writing pyproject.toml Metadata for a Python CLI",{"path":2379,"title":2380},"\u002Fproject-setup-dependency-management\u002Fpoetry-workflows-for-cli-development","Poetry Workflows for CLI Development",{"path":2382,"title":2383},"\u002Fproject-setup-dependency-management\u002Fpoetry-workflows-for-cli-development\u002Fmigrating-a-cli-from-poetry-to-uv","Migrating a Python CLI from Poetry to uv",{"path":2385,"title":2386},"\u002Fproject-setup-dependency-management\u002Fpoetry-workflows-for-cli-development\u002Fpoetry-dependency-groups-for-cli-tooling","Poetry Dependency Groups for CLI Tooling",{"path":2388,"title":2389},"\u002Fproject-setup-dependency-management\u002Fpoetry-workflows-for-cli-development\u002Fpoetry-entry-points-and-scripts-for-clis","Poetry Entry Points and Scripts for CLIs",{"path":2391,"title":2392},"\u002Fproject-setup-dependency-management\u002Fpre-commit-hooks-for-cli-projects","Pre-commit Hooks for CLI Projects",{"path":2394,"title":2395},"\u002Fproject-setup-dependency-management\u002Fpre-commit-hooks-for-cli-projects\u002Fsetting-up-pre-commit-for-python-cli-repos","Setting up pre-commit for Python CLI repos",{"path":2397,"title":2398},"\u002Fproject-setup-dependency-management\u002Fpre-commit-hooks-for-cli-projects\u002Fshipping-your-cli-as-a-pre-commit-hook","Shipping Your Python CLI as a pre-commit Hook",{"path":2400,"title":2401},"\u002Fproject-setup-dependency-management\u002Fpre-commit-hooks-for-cli-projects\u002Fwriting-local-pre-commit-hooks-in-python","Writing Local pre-commit Hooks in Python",{"path":2403,"title":2404},"\u002Fproject-setup-dependency-management\u002Fuv-for-python-cli-dependency-management","uv for Python CLI Dependency Management",{"path":2406,"title":2407},"\u002Fproject-setup-dependency-management\u002Fuv-for-python-cli-dependency-management\u002Frunning-one-off-cli-scripts-with-uv-run","Running One-Off CLI Scripts with uv run and PEP 723",{"path":2409,"title":2410},"\u002Fproject-setup-dependency-management\u002Fuv-for-python-cli-dependency-management\u002Fuv-init-vs-poetry-init-for-cli-tools","uv init vs poetry init for CLI tools",{"path":2412,"title":2413},"\u002Fproject-setup-dependency-management\u002Fuv-for-python-cli-dependency-management\u002Fuv-tool-install-vs-pipx-for-clis","uv tool install vs pipx for CLIs",{"path":2415,"title":2416},"\u002Fproject-setup-dependency-management\u002Fuv-for-python-cli-dependency-management\u002Fuv-workspaces-for-multi-package-clis","uv Workspaces for Multi-Package Python CLIs",{"path":2418,"title":2419},"\u002Fproject-setup-dependency-management\u002Fvirtual-environments-isolation-best-practices","Python CLI Env Isolation Best Practices",{"path":2421,"title":2422},"\u002Fproject-setup-dependency-management\u002Fvirtual-environments-isolation-best-practices\u002Fmanaging-virtual-environments-for-cross-platform-clis","Managing Python CLI Virtual Environments",{"path":2424,"title":2425},"\u002Fproject-setup-dependency-management\u002Fvirtual-environments-isolation-best-practices\u002Fpinning-the-python-version-for-a-cli","Pinning the Python Version for a CLI",{"path":2427,"title":2428},"\u002Fproject-setup-dependency-management\u002Fvirtual-environments-isolation-best-practices\u002Fsupporting-multiple-python-versions-with-nox","Supporting Multiple Python Versions with nox",1789736907280]