[{"data":1,"prerenderedAt":1715},["ShallowReactive",2],{"page-\u002Fmodern-python-cli-frameworks-architecture\u002Ftyper-vs-click-when-to-use-each\u002Fconverting-a-click-app-to-typer\u002F":3,"content-directory":1471},{"id":4,"title":5,"body":6,"date":1455,"description":1456,"difficulty":1457,"draft":1458,"extension":1459,"meta":1460,"navigation":112,"path":1461,"seo":1462,"stem":1463,"tags":1464,"updated":1455,"__hash__":1470},"content\u002Fmodern-python-cli-frameworks-architecture\u002Ftyper-vs-click-when-to-use-each\u002Fconverting-a-click-app-to-typer\u002Findex.md","Converting a Click App to Typer",{"type":7,"value":8,"toc":1433},"minimark",[9,13,18,56,60,63,67,70,194,200,230,233,237,241,244,247,505,508,706,748,752,755,768,774,788,792,795,802,1085,1096,1100,1103,1117,1129,1132,1136,1139,1213,1216,1220,1223,1233,1239,1245,1254,1264,1267,1271,1284,1294,1303,1325,1329,1332,1336,1341,1344,1352,1362,1366,1375,1379,1382,1386,1389,1393,1429],[10,11,12],"p",{},"Because Typer builds Click objects and runs on Click's runtime, a conversion is a series of local\nedits rather than a rewrite. The tool keeps working after every commit, and the risky part —\nproving nothing changed — is a test table you write before you start.",[14,15,17],"h2",{"id":16},"tldr","TL;DR",[19,20,21,25,33,36,48],"ul",{},[22,23,24],"li",{},"Mount the Typer app inside the existing Click group so both halves run together.",[22,26,27,28,32],{},"Move commands ",[29,30,31],"strong",{},"smallest first",", one commit each.",[22,34,35],{},"Translate decorators to signature parameters; the mapping is mechanical.",[22,37,38,39,42,43,47],{},"Write a ",[29,40,41],{},"parity test"," over documented invocations ",[44,45,46],"em",{},"before"," moving anything.",[22,49,50,51,55],{},"Leave custom ",[52,53,54],"code",{},"Command"," subclasses and dynamically built groups in Click.",[14,57,59],{"id":58},"prerequisites","Prerequisites",[10,61,62],{},"A working Click application with tests, and Typer installed. Both libraries coexist happily in one\nproject — Typer depends on Click.",[14,64,66],{"id":65},"mounting-both-trees","Mounting both trees",[10,68,69],{},"The first commit changes no behaviour: it adds an empty Typer app and attaches it to the existing\ngroup.",[71,72,77],"pre",{"className":73,"code":74,"language":75,"meta":76,"style":76},"language-python shiki shiki-themes github-light github-dark","# mytool\u002Fcli.py\nimport click\nimport typer\n\nfrom mytool.commands import legacy          # existing @click.command functions\nfrom mytool.commands import migrated        # the new Typer app (empty at first)\n\ncli = click.Group(help=\"Manage deployments.\")\ncli.add_command(legacy.sync)\ncli.add_command(legacy.status)\ncli.add_command(typer.main.get_command(migrated.app))\n","python","",[52,78,79,88,99,107,114,131,146,151,176,182,188],{"__ignoreMap":76},[80,81,84],"span",{"class":82,"line":83},"line",1,[80,85,87],{"class":86},"sJ8bj","# mytool\u002Fcli.py\n",[80,89,91,95],{"class":82,"line":90},2,[80,92,94],{"class":93},"szBVR","import",[80,96,98],{"class":97},"sVt8B"," click\n",[80,100,102,104],{"class":82,"line":101},3,[80,103,94],{"class":93},[80,105,106],{"class":97}," typer\n",[80,108,110],{"class":82,"line":109},4,[80,111,113],{"emptyLinePlaceholder":112},true,"\n",[80,115,117,120,123,125,128],{"class":82,"line":116},5,[80,118,119],{"class":93},"from",[80,121,122],{"class":97}," mytool.commands ",[80,124,94],{"class":93},[80,126,127],{"class":97}," legacy          ",[80,129,130],{"class":86},"# existing @click.command functions\n",[80,132,134,136,138,140,143],{"class":82,"line":133},6,[80,135,119],{"class":93},[80,137,122],{"class":97},[80,139,94],{"class":93},[80,141,142],{"class":97}," migrated        ",[80,144,145],{"class":86},"# the new Typer app (empty at first)\n",[80,147,149],{"class":82,"line":148},7,[80,150,113],{"emptyLinePlaceholder":112},[80,152,154,157,160,163,167,169,173],{"class":82,"line":153},8,[80,155,156],{"class":97},"cli ",[80,158,159],{"class":93},"=",[80,161,162],{"class":97}," click.Group(",[80,164,166],{"class":165},"s4XuR","help",[80,168,159],{"class":93},[80,170,172],{"class":171},"sZZnC","\"Manage deployments.\"",[80,174,175],{"class":97},")\n",[80,177,179],{"class":82,"line":178},9,[80,180,181],{"class":97},"cli.add_command(legacy.sync)\n",[80,183,185],{"class":82,"line":184},10,[80,186,187],{"class":97},"cli.add_command(legacy.status)\n",[80,189,191],{"class":82,"line":190},11,[80,192,193],{"class":97},"cli.add_command(typer.main.get_command(migrated.app))\n",[10,195,196,199],{},[52,197,198],{},"typer.main.get_command"," converts a Typer app into a Click command, so it slots into the existing\ntree. The reverse also works when you would rather make the Typer app the root:",[71,201,203],{"className":73,"code":202,"language":75,"meta":76,"style":76},"app = typer.Typer()\napp.add_click_command(legacy.sync, name=\"sync\")\n",[52,204,205,215],{"__ignoreMap":76},[80,206,207,210,212],{"class":82,"line":83},[80,208,209],{"class":97},"app ",[80,211,159],{"class":93},[80,213,214],{"class":97}," typer.Typer()\n",[80,216,217,220,223,225,228],{"class":82,"line":90},[80,218,219],{"class":97},"app.add_click_command(legacy.sync, ",[80,221,222],{"class":165},"name",[80,224,159],{"class":93},[80,226,227],{"class":171},"\"sync\"",[80,229,175],{"class":97},[10,231,232],{},"Either arrangement lets commands move one at a time while the CLI stays whole.",[234,235],"inline-diagram",{"name":236},"click-typer-migration-steps",[14,238,240],{"id":239},"translating-a-command","Translating a command",[234,242],{"name":243},"decorator-to-signature",[10,245,246],{},"Most of the work is mechanical. A Click command:",[71,248,250],{"className":73,"code":249,"language":75,"meta":76,"style":76},"@click.command()\n@click.argument(\"source\", type=click.Path(exists=True, path_type=Path))\n@click.option(\"--retries\", type=int, default=3, show_default=True, help=\"Attempts per file.\")\n@click.option(\"--tag\", \"tags\", multiple=True, help=\"Attach a tag.\")\n@click.option(\"--mode\", type=click.Choice([\"keep\", \"delete\"]), default=\"keep\")\n@click.option(\"--dry-run\", is_flag=True, help=\"Report without uploading.\")\n@click.pass_obj\ndef sync(settings, source: Path, retries: int, tags: tuple[str, ...], mode: str, dry_run: bool) -> None:\n    \"\"\"Sync SOURCE to the bucket.\"\"\"\n",[52,251,252,261,302,351,385,422,451,456,500],{"__ignoreMap":76},[80,253,254,258],{"class":82,"line":83},[80,255,257],{"class":256},"sScJk","@click.command",[80,259,260],{"class":97},"()\n",[80,262,263,266,269,272,275,278,280,283,286,288,292,294,297,299],{"class":82,"line":90},[80,264,265],{"class":256},"@click.argument",[80,267,268],{"class":97},"(",[80,270,271],{"class":171},"\"source\"",[80,273,274],{"class":97},", ",[80,276,277],{"class":165},"type",[80,279,159],{"class":93},[80,281,282],{"class":97},"click.Path(",[80,284,285],{"class":165},"exists",[80,287,159],{"class":93},[80,289,291],{"class":290},"sj4cs","True",[80,293,274],{"class":97},[80,295,296],{"class":165},"path_type",[80,298,159],{"class":93},[80,300,301],{"class":97},"Path))\n",[80,303,304,307,309,312,314,316,318,321,323,326,328,331,333,336,338,340,342,344,346,349],{"class":82,"line":101},[80,305,306],{"class":256},"@click.option",[80,308,268],{"class":97},[80,310,311],{"class":171},"\"--retries\"",[80,313,274],{"class":97},[80,315,277],{"class":165},[80,317,159],{"class":93},[80,319,320],{"class":290},"int",[80,322,274],{"class":97},[80,324,325],{"class":165},"default",[80,327,159],{"class":93},[80,329,330],{"class":290},"3",[80,332,274],{"class":97},[80,334,335],{"class":165},"show_default",[80,337,159],{"class":93},[80,339,291],{"class":290},[80,341,274],{"class":97},[80,343,166],{"class":165},[80,345,159],{"class":93},[80,347,348],{"class":171},"\"Attempts per file.\"",[80,350,175],{"class":97},[80,352,353,355,357,360,362,365,367,370,372,374,376,378,380,383],{"class":82,"line":109},[80,354,306],{"class":256},[80,356,268],{"class":97},[80,358,359],{"class":171},"\"--tag\"",[80,361,274],{"class":97},[80,363,364],{"class":171},"\"tags\"",[80,366,274],{"class":97},[80,368,369],{"class":165},"multiple",[80,371,159],{"class":93},[80,373,291],{"class":290},[80,375,274],{"class":97},[80,377,166],{"class":165},[80,379,159],{"class":93},[80,381,382],{"class":171},"\"Attach a tag.\"",[80,384,175],{"class":97},[80,386,387,389,391,394,396,398,400,403,406,408,411,414,416,418,420],{"class":82,"line":116},[80,388,306],{"class":256},[80,390,268],{"class":97},[80,392,393],{"class":171},"\"--mode\"",[80,395,274],{"class":97},[80,397,277],{"class":165},[80,399,159],{"class":93},[80,401,402],{"class":97},"click.Choice([",[80,404,405],{"class":171},"\"keep\"",[80,407,274],{"class":97},[80,409,410],{"class":171},"\"delete\"",[80,412,413],{"class":97},"]), ",[80,415,325],{"class":165},[80,417,159],{"class":93},[80,419,405],{"class":171},[80,421,175],{"class":97},[80,423,424,426,428,431,433,436,438,440,442,444,446,449],{"class":82,"line":133},[80,425,306],{"class":256},[80,427,268],{"class":97},[80,429,430],{"class":171},"\"--dry-run\"",[80,432,274],{"class":97},[80,434,435],{"class":165},"is_flag",[80,437,159],{"class":93},[80,439,291],{"class":290},[80,441,274],{"class":97},[80,443,166],{"class":165},[80,445,159],{"class":93},[80,447,448],{"class":171},"\"Report without uploading.\"",[80,450,175],{"class":97},[80,452,453],{"class":82,"line":148},[80,454,455],{"class":256},"@click.pass_obj\n",[80,457,458,461,464,467,469,472,475,477,480,483,485,488,491,494,497],{"class":82,"line":153},[80,459,460],{"class":93},"def",[80,462,463],{"class":256}," sync",[80,465,466],{"class":97},"(settings, source: Path, retries: ",[80,468,320],{"class":290},[80,470,471],{"class":97},", tags: tuple[",[80,473,474],{"class":290},"str",[80,476,274],{"class":97},[80,478,479],{"class":290},"...",[80,481,482],{"class":97},"], mode: ",[80,484,474],{"class":290},[80,486,487],{"class":97},", dry_run: ",[80,489,490],{"class":290},"bool",[80,492,493],{"class":97},") -> ",[80,495,496],{"class":290},"None",[80,498,499],{"class":97},":\n",[80,501,502],{"class":82,"line":178},[80,503,504],{"class":171},"    \"\"\"Sync SOURCE to the bucket.\"\"\"\n",[10,506,507],{},"becomes:",[71,509,511],{"className":73,"code":510,"language":75,"meta":76,"style":76},"class SyncMode(str, Enum):\n    keep = \"keep\"\n    delete = \"delete\"\n\n@app.command()\ndef sync(\n    ctx: typer.Context,\n    source: Annotated[Path, typer.Argument(exists=True)],\n    retries: Annotated[int, typer.Option(help=\"Attempts per file.\")] = 3,\n    tags: Annotated[list[str], typer.Option(\"--tag\", help=\"Attach a tag.\")] = [],\n    mode: Annotated[SyncMode, typer.Option()] = SyncMode.keep,\n    dry_run: Annotated[bool, typer.Option(help=\"Report without uploading.\")] = False,\n) -> None:\n    \"\"\"Sync SOURCE to the bucket.\"\"\"\n    settings = ctx.obj\n",[52,512,513,533,543,553,557,564,573,578,592,619,646,656,681,690,695],{"__ignoreMap":76},[80,514,515,518,521,523,525,527,530],{"class":82,"line":83},[80,516,517],{"class":93},"class",[80,519,520],{"class":256}," SyncMode",[80,522,268],{"class":97},[80,524,474],{"class":290},[80,526,274],{"class":97},[80,528,529],{"class":256},"Enum",[80,531,532],{"class":97},"):\n",[80,534,535,538,540],{"class":82,"line":90},[80,536,537],{"class":97},"    keep ",[80,539,159],{"class":93},[80,541,542],{"class":171}," \"keep\"\n",[80,544,545,548,550],{"class":82,"line":101},[80,546,547],{"class":97},"    delete ",[80,549,159],{"class":93},[80,551,552],{"class":171}," \"delete\"\n",[80,554,555],{"class":82,"line":109},[80,556,113],{"emptyLinePlaceholder":112},[80,558,559,562],{"class":82,"line":116},[80,560,561],{"class":256},"@app.command",[80,563,260],{"class":97},[80,565,566,568,570],{"class":82,"line":133},[80,567,460],{"class":93},[80,569,463],{"class":256},[80,571,572],{"class":97},"(\n",[80,574,575],{"class":82,"line":148},[80,576,577],{"class":97},"    ctx: typer.Context,\n",[80,579,580,583,585,587,589],{"class":82,"line":153},[80,581,582],{"class":97},"    source: Annotated[Path, typer.Argument(",[80,584,285],{"class":165},[80,586,159],{"class":93},[80,588,291],{"class":290},[80,590,591],{"class":97},")],\n",[80,593,594,597,599,602,604,606,608,611,613,616],{"class":82,"line":178},[80,595,596],{"class":97},"    retries: Annotated[",[80,598,320],{"class":290},[80,600,601],{"class":97},", typer.Option(",[80,603,166],{"class":165},[80,605,159],{"class":93},[80,607,348],{"class":171},[80,609,610],{"class":97},")] ",[80,612,159],{"class":93},[80,614,615],{"class":290}," 3",[80,617,618],{"class":97},",\n",[80,620,621,624,626,629,631,633,635,637,639,641,643],{"class":82,"line":184},[80,622,623],{"class":97},"    tags: Annotated[list[",[80,625,474],{"class":290},[80,627,628],{"class":97},"], typer.Option(",[80,630,359],{"class":171},[80,632,274],{"class":97},[80,634,166],{"class":165},[80,636,159],{"class":93},[80,638,382],{"class":171},[80,640,610],{"class":97},[80,642,159],{"class":93},[80,644,645],{"class":97}," [],\n",[80,647,648,651,653],{"class":82,"line":190},[80,649,650],{"class":97},"    mode: Annotated[SyncMode, typer.Option()] ",[80,652,159],{"class":93},[80,654,655],{"class":97}," SyncMode.keep,\n",[80,657,659,662,664,666,668,670,672,674,676,679],{"class":82,"line":658},12,[80,660,661],{"class":97},"    dry_run: Annotated[",[80,663,490],{"class":290},[80,665,601],{"class":97},[80,667,166],{"class":165},[80,669,159],{"class":93},[80,671,448],{"class":171},[80,673,610],{"class":97},[80,675,159],{"class":93},[80,677,678],{"class":290}," False",[80,680,618],{"class":97},[80,682,684,686,688],{"class":82,"line":683},13,[80,685,493],{"class":97},[80,687,496],{"class":290},[80,689,499],{"class":97},[80,691,693],{"class":82,"line":692},14,[80,694,504],{"class":171},[80,696,698,701,703],{"class":82,"line":697},15,[80,699,700],{"class":97},"    settings ",[80,702,159],{"class":93},[80,704,705],{"class":97}," ctx.obj\n",[10,707,708,709,712,713,716,717,719,720,723,724,726,727,712,730,732,733,736,737,739,740,743,744,747],{},"Four translations to note. ",[52,710,711],{},"multiple=True"," becomes ",[52,714,715],{},"list[str]",", and the explicit ",[52,718,359],{}," keeps\nthe flag name singular. ",[52,721,722],{},"click.Choice"," becomes an ",[52,725,529],{},", which also gives you completion and a\nreal type in the body. ",[52,728,729],{},"is_flag=True",[52,731,490],{},", and Typer generates ",[52,734,735],{},"--dry-run\u002F--no-dry-run","\n— if you only want the positive form, pass ",[52,738,430],{}," explicitly. And ",[52,741,742],{},"@click.pass_obj"," becomes\na ",[52,745,746],{},"typer.Context"," parameter.",[14,749,751],{"id":750},"what-should-stay-in-click","What should stay in Click",[10,753,754],{},"Three constructs have no direct equivalent, and the right answer is usually to leave them alone\nrather than force a translation.",[10,756,757,767],{},[29,758,759,760,762,763,766],{},"Custom ",[52,761,54],{}," or ",[52,764,765],{},"Group"," subclasses."," A lazy-loading group, an alias resolver, a group that\nreads its subcommands from a registry — all of these are Click object-model code, and they keep\nworking unchanged inside a mixed tree.",[10,769,770,773],{},[29,771,772],{},"Dynamically constructed commands."," If options are derived at run time from a schema or a plugin,\nClick's builder API is the right tool; Typer assumes parameters are known when the module is\nimported.",[10,775,776,779,780,783,784,787],{},[29,777,778],{},"Parameter types with complex conversion."," A ",[52,781,782],{},"click.ParamType"," subclass can be used from Typer\ndirectly with ",[52,785,786],{},"click_type=",", so there is no need to rewrite it.",[14,789,791],{"id":790},"pinning-behaviour-first","Pinning behaviour first",[234,793],{"name":794},"migration-parity-check",[10,796,797,798,801],{},"The parity test is what turns \"I think this is equivalent\" into something the build checks. Write\nit against the ",[44,799,800],{},"existing"," CLI, get it green, then let it guard every step:",[71,803,805],{"className":73,"code":804,"language":75,"meta":76,"style":76},"import pytest\nfrom click.testing import CliRunner\n\nfrom mytool.cli import cli\n\nCASES = [\n    ([], 0),\n    ([\"--help\"], 0),\n    ([\"sync\", \".\u002Fdata\"], 0),\n    ([\"sync\"], 2),\n    ([\"sync\", \".\u002Fdata\", \"--retries\", \"x\"], 2),\n    ([\"sync\", \".\u002Fmissing\"], 2),\n    ([\"status\", \"--json\"], 0),\n]\n\n@pytest.mark.parametrize(\"argv,expected\", CASES, ids=lambda c: \" \".join(c) if isinstance(c, list) else str(c))\ndef test_exit_codes_unchanged(argv, expected, tmp_path, monkeypatch):\n    monkeypatch.chdir(tmp_path)\n    (tmp_path \u002F \"data\").mkdir()\n    assert CliRunner().invoke(cli, argv).exit_code == expected\n",[52,806,807,814,826,830,842,846,857,868,883,900,913,938,955,973,978,982,1038,1049,1055,1070],{"__ignoreMap":76},[80,808,809,811],{"class":82,"line":83},[80,810,94],{"class":93},[80,812,813],{"class":97}," pytest\n",[80,815,816,818,821,823],{"class":82,"line":90},[80,817,119],{"class":93},[80,819,820],{"class":97}," click.testing ",[80,822,94],{"class":93},[80,824,825],{"class":97}," CliRunner\n",[80,827,828],{"class":82,"line":101},[80,829,113],{"emptyLinePlaceholder":112},[80,831,832,834,837,839],{"class":82,"line":109},[80,833,119],{"class":93},[80,835,836],{"class":97}," mytool.cli ",[80,838,94],{"class":93},[80,840,841],{"class":97}," cli\n",[80,843,844],{"class":82,"line":116},[80,845,113],{"emptyLinePlaceholder":112},[80,847,848,851,854],{"class":82,"line":133},[80,849,850],{"class":290},"CASES",[80,852,853],{"class":93}," =",[80,855,856],{"class":97}," [\n",[80,858,859,862,865],{"class":82,"line":148},[80,860,861],{"class":97},"    ([], ",[80,863,864],{"class":290},"0",[80,866,867],{"class":97},"),\n",[80,869,870,873,876,879,881],{"class":82,"line":153},[80,871,872],{"class":97},"    ([",[80,874,875],{"class":171},"\"--help\"",[80,877,878],{"class":97},"], ",[80,880,864],{"class":290},[80,882,867],{"class":97},[80,884,885,887,889,891,894,896,898],{"class":82,"line":178},[80,886,872],{"class":97},[80,888,227],{"class":171},[80,890,274],{"class":97},[80,892,893],{"class":171},"\".\u002Fdata\"",[80,895,878],{"class":97},[80,897,864],{"class":290},[80,899,867],{"class":97},[80,901,902,904,906,908,911],{"class":82,"line":184},[80,903,872],{"class":97},[80,905,227],{"class":171},[80,907,878],{"class":97},[80,909,910],{"class":290},"2",[80,912,867],{"class":97},[80,914,915,917,919,921,923,925,927,929,932,934,936],{"class":82,"line":190},[80,916,872],{"class":97},[80,918,227],{"class":171},[80,920,274],{"class":97},[80,922,893],{"class":171},[80,924,274],{"class":97},[80,926,311],{"class":171},[80,928,274],{"class":97},[80,930,931],{"class":171},"\"x\"",[80,933,878],{"class":97},[80,935,910],{"class":290},[80,937,867],{"class":97},[80,939,940,942,944,946,949,951,953],{"class":82,"line":658},[80,941,872],{"class":97},[80,943,227],{"class":171},[80,945,274],{"class":97},[80,947,948],{"class":171},"\".\u002Fmissing\"",[80,950,878],{"class":97},[80,952,910],{"class":290},[80,954,867],{"class":97},[80,956,957,959,962,964,967,969,971],{"class":82,"line":683},[80,958,872],{"class":97},[80,960,961],{"class":171},"\"status\"",[80,963,274],{"class":97},[80,965,966],{"class":171},"\"--json\"",[80,968,878],{"class":97},[80,970,864],{"class":290},[80,972,867],{"class":97},[80,974,975],{"class":82,"line":692},[80,976,977],{"class":97},"]\n",[80,979,980],{"class":82,"line":697},[80,981,113],{"emptyLinePlaceholder":112},[80,983,985,988,990,993,995,997,999,1002,1005,1008,1011,1014,1017,1020,1023,1026,1029,1032,1035],{"class":82,"line":984},16,[80,986,987],{"class":256},"@pytest.mark.parametrize",[80,989,268],{"class":97},[80,991,992],{"class":171},"\"argv,expected\"",[80,994,274],{"class":97},[80,996,850],{"class":290},[80,998,274],{"class":97},[80,1000,1001],{"class":165},"ids",[80,1003,1004],{"class":93},"=lambda",[80,1006,1007],{"class":97}," c: ",[80,1009,1010],{"class":171},"\" \"",[80,1012,1013],{"class":97},".join(c) ",[80,1015,1016],{"class":93},"if",[80,1018,1019],{"class":290}," isinstance",[80,1021,1022],{"class":97},"(c, ",[80,1024,1025],{"class":290},"list",[80,1027,1028],{"class":97},") ",[80,1030,1031],{"class":93},"else",[80,1033,1034],{"class":290}," str",[80,1036,1037],{"class":97},"(c))\n",[80,1039,1041,1043,1046],{"class":82,"line":1040},17,[80,1042,460],{"class":93},[80,1044,1045],{"class":256}," test_exit_codes_unchanged",[80,1047,1048],{"class":97},"(argv, expected, tmp_path, monkeypatch):\n",[80,1050,1052],{"class":82,"line":1051},18,[80,1053,1054],{"class":97},"    monkeypatch.chdir(tmp_path)\n",[80,1056,1058,1061,1064,1067],{"class":82,"line":1057},19,[80,1059,1060],{"class":97},"    (tmp_path ",[80,1062,1063],{"class":93},"\u002F",[80,1065,1066],{"class":171}," \"data\"",[80,1068,1069],{"class":97},").mkdir()\n",[80,1071,1073,1076,1079,1082],{"class":82,"line":1072},20,[80,1074,1075],{"class":93},"    assert",[80,1077,1078],{"class":97}," CliRunner().invoke(cli, argv).exit_code ",[80,1080,1081],{"class":93},"==",[80,1083,1084],{"class":97}," expected\n",[10,1086,1087,1088,1091,1092,1095],{},"Add an output assertion for commands that produce data — ",[52,1089,1090],{},"json.loads(result.stdout)"," for anything\nwith a ",[52,1093,1094],{},"--json"," mode is a strong check. What not to assert on is help text: Typer renders through\nRich, so the layout differs by design, and pinning it guarantees a failure that means nothing.",[14,1097,1099],{"id":1098},"ux-considerations","UX considerations",[10,1101,1102],{},"Two user-visible differences arrive with Typer and are worth deciding on deliberately.",[10,1104,1105,1108,1109,1112,1113,1116],{},[29,1106,1107],{},"Help output looks different."," Panels, colour and aligned columns instead of Click's plain text.\nMost people prefer it; if your users pipe ",[52,1110,1111],{},"--help"," into something, ",[52,1114,1115],{},"rich_markup_mode=None"," restores\nplain output.",[10,1118,1119,1122,1123,712,1126,1128],{},[29,1120,1121],{},"Boolean flags gain a negative form."," ",[52,1124,1125],{},"--dry-run",[52,1127,735],{}," unless you\ndeclare only the positive name. That is usually an improvement, and it is a new flag appearing in\nyour interface, so mention it in the changelog.",[10,1130,1131],{},"Neither is breaking, but both are visible, which makes them worth a line in release notes rather\nthan a surprise.",[14,1133,1135],{"id":1134},"testing-the-behaviour","Testing the behaviour",[10,1137,1138],{},"Run the parity suite after every command you move; it is fast and it is the whole safety net. Add\none test that proves the mixed tree is intact while the migration is in progress:",[71,1140,1142],{"className":73,"code":1141,"language":75,"meta":76,"style":76},"def test_all_commands_are_reachable():\n    result = CliRunner().invoke(cli, [\"--help\"])\n    for name in (\"sync\", \"status\", \"db\", \"remote\"):\n        assert name in result.output\n",[52,1143,1144,1154,1169,1201],{"__ignoreMap":76},[80,1145,1146,1148,1151],{"class":82,"line":83},[80,1147,460],{"class":93},[80,1149,1150],{"class":256}," test_all_commands_are_reachable",[80,1152,1153],{"class":97},"():\n",[80,1155,1156,1159,1161,1164,1166],{"class":82,"line":90},[80,1157,1158],{"class":97},"    result ",[80,1160,159],{"class":93},[80,1162,1163],{"class":97}," CliRunner().invoke(cli, [",[80,1165,875],{"class":171},[80,1167,1168],{"class":97},"])\n",[80,1170,1171,1174,1177,1180,1183,1185,1187,1189,1191,1194,1196,1199],{"class":82,"line":101},[80,1172,1173],{"class":93},"    for",[80,1175,1176],{"class":97}," name ",[80,1178,1179],{"class":93},"in",[80,1181,1182],{"class":97}," (",[80,1184,227],{"class":171},[80,1186,274],{"class":97},[80,1188,961],{"class":171},[80,1190,274],{"class":97},[80,1192,1193],{"class":171},"\"db\"",[80,1195,274],{"class":97},[80,1197,1198],{"class":171},"\"remote\"",[80,1200,532],{"class":97},[80,1202,1203,1206,1208,1210],{"class":82,"line":109},[80,1204,1205],{"class":93},"        assert",[80,1207,1176],{"class":97},[80,1209,1179],{"class":93},[80,1211,1212],{"class":97}," result.output\n",[10,1214,1215],{},"When the last command has moved, the final commit removes the Click group, promotes the Typer app\nto the root, and deletes the interop line. At that point the parity tests become ordinary tests —\nwhich is a good outcome, since they encode the invocations your users depend on.",[14,1217,1219],{"id":1218},"a-worked-order-of-operations","A worked order of operations",[10,1221,1222],{},"For a tool of a dozen commands, the sequence that keeps risk low looks like this.",[10,1224,1225,1228,1229,1232],{},[29,1226,1227],{},"Commit 1 — interop, no behaviour change."," Add Typer as a dependency, create an empty\n",[52,1230,1231],{},"migrated.app",", mount it, and confirm the parity suite is green. Nothing has moved yet, and the\ndiff is four lines.",[10,1234,1235,1238],{},[29,1236,1237],{},"Commit 2 — the smallest leaf command."," Pick the command with the fewest options and no shared\nstate. Translate it, delete the Click version, run the suite. This is where you learn the\nmechanics on something that cannot break anyone's day.",[10,1240,1241,1244],{},[29,1242,1243],{},"Commit 3 — the callback."," Move the root callback so global options and the settings object are\nbuilt by Typer. This is the step that touches every command, so do it once the translations are\nfamiliar and while most commands are still Click ones reached through interop.",[10,1246,1247,1250,1251,1253],{},[29,1248,1249],{},"Commits 4 to n — one command each."," In increasing order of complexity, leaving anything that\nsubclasses ",[52,1252,54],{}," for last (or forever).",[10,1255,1256,1259,1260,1263],{},[29,1257,1258],{},"Final commit — promote and clean up."," Make the Typer app the root, drop the interop line, remove\nthe Click import if nothing else uses it, and update the entry point in ",[52,1261,1262],{},"pyproject.toml"," if the\nobject it names has changed.",[10,1265,1266],{},"Each commit ships. If a release goes out mid-migration, users see a tool that works — with one\ncosmetic difference in the help output of the commands that have moved.",[14,1268,1270],{"id":1269},"things-that-surprise-people-mid-migration","Things that surprise people mid-migration",[10,1272,1273,1122,1276,1279,1280,1283],{},[29,1274,1275],{},"Mutable default arguments.",[52,1277,1278],{},"tags: list[str] = []"," is idiomatic in Typer and flagged by linters\nas a mutable default. Typer copies it per invocation, so it is safe here — configure the rule rather\nthan fighting it, or use ",[52,1281,1282],{},"Annotated[list[str], typer.Option()] = None"," and normalise inside.",[10,1285,1286,1289,1290,1293],{},[29,1287,1288],{},"Required options."," In Click, ",[52,1291,1292],{},"required=True"," on an option is common. In Typer, a parameter with\nno default is required, which usually reads better — but check whether the value should have been a\npositional argument all along.",[10,1295,1296,1299,1300,1302],{},[29,1297,1298],{},"Argument order."," Click applies decorators bottom-up, so the parameter order in the function may\nnot match the order options appear in help. In Typer the signature is the order. Migrating can\ntherefore change the sequence in ",[52,1301,1111],{},", which is cosmetic but worth expecting.",[10,1304,1305,1308,1309,1312,1313,1316,1317,1320,1321,1324],{},[29,1306,1307],{},"Context is not automatic."," A Click command with ",[52,1310,1311],{},"@click.pass_context"," becomes a Typer command\nwith an explicit ",[52,1314,1315],{},"ctx: typer.Context"," parameter. Forgetting it produces a ",[52,1318,1319],{},"NameError"," at run time\nrather than a helpful message, so it is worth grepping for ",[52,1322,1323],{},"pass_context"," before starting.",[14,1326,1328],{"id":1327},"conclusion","Conclusion",[10,1330,1331],{},"Mount both, move the smallest command first, translate decorators into the signature, and let a\nparity table over documented invocations decide whether anything changed. The conversion is a\nsequence of small, revertible commits, and at no point does the tool ship half-migrated.",[14,1333,1335],{"id":1334},"frequently-asked-questions","Frequently asked questions",[1337,1338,1340],"h3",{"id":1339},"do-i-have-to-migrate-everything","Do I have to migrate everything?",[10,1342,1343],{},"No. A permanently mixed tree is a legitimate outcome — declared commands in Typer, dynamically\nbuilt ones in Click. The interop is not a migration crutch; it is a supported way to use both\nobject models in one application.",[1337,1345,1347,1348,1351],{"id":1346},"what-happens-to-my-click-context-and-pass_obj","What happens to my Click context and ",[52,1349,1350],{},"pass_obj","?",[10,1353,1354,1355,1357,1358,1361],{},"They keep working. Typer commands take ",[52,1356,1315],{},", which is Click's context, so\n",[52,1359,1360],{},"ctx.obj"," is the same object your Click callback assigned. That is what allows a half-migrated tree\nto share state between old and new commands.",[1337,1363,1365],{"id":1364},"will-my-custom-parameter-types-still-work","Will my custom parameter types still work?",[10,1367,1368,1369,1371,1372,1374],{},"Yes — pass them with ",[52,1370,786],{},". A ",[52,1373,782],{}," subclass is unchanged by the migration, and\nfor validation that does not fit a type hint it remains the right tool in either framework.",[1337,1376,1378],{"id":1377},"does-the-migration-change-my-exit-codes","Does the migration change my exit codes?",[10,1380,1381],{},"It should not, and the parity test is what proves it. Both frameworks exit 2 on usage errors and\npropagate exceptions to your boundary the same way. If a code changes, it is because a parameter\nbecame required or a type became stricter — worth catching before release.",[1337,1383,1385],{"id":1384},"how-long-does-a-conversion-take","How long does a conversion take?",[10,1387,1388],{},"For a tool with a dozen commands, typically a day of work spread over several commits, most of it\nmechanical. The parity test is the part worth doing carefully; the translations themselves are fast\nonce you have done two or three.",[14,1390,1392],{"id":1391},"related","Related",[19,1394,1395,1403,1410,1416,1423],{},[22,1396,1397,1398],{},"Up: ",[1399,1400,1402],"a",{"href":1401},"\u002Fmodern-python-cli-frameworks-architecture\u002Ftyper-vs-click-when-to-use-each\u002F","Typer vs Click: when to use each",[22,1404,1405,1406],{},"Sideways: ",[1399,1407,1409],{"href":1408},"\u002Fmodern-python-cli-frameworks-architecture\u002Ftyper-vs-click-when-to-use-each\u002Ftyper-callback-functions-explained\u002F","Typer callback functions explained",[22,1411,1405,1412],{},[1399,1413,1415],{"href":1414},"\u002Fmodern-python-cli-frameworks-architecture\u002Ftyper-vs-click-when-to-use-each\u002Fbuilding-a-cli-with-subcommands-in-click\u002F","Building a CLI with subcommands in Click",[22,1417,1418,1419],{},"Related: ",[1399,1420,1422],{"href":1421},"\u002Fmodern-python-cli-frameworks-architecture\u002Fcommand-line-parsing-with-argparse\u002Fmigrating-from-argparse-to-typer\u002F","Migrating from argparse to Typer",[22,1424,1418,1425],{},[1399,1426,1428],{"href":1427},"\u002Fmodern-python-cli-frameworks-architecture\u002Ftesting-python-cli-applications\u002Ftesting-click-commands-with-clirunner\u002F","Testing Click commands with CliRunner",[1430,1431,1432],"style",{},"html pre.shiki code .sJ8bj, html code.shiki .sJ8bj{--shiki-default:#6A737D;--shiki-dark:#6A737D}html pre.shiki code .szBVR, html code.shiki .szBVR{--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .sVt8B, html code.shiki .sVt8B{--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .s4XuR, html code.shiki .s4XuR{--shiki-default:#E36209;--shiki-dark:#FFAB70}html pre.shiki code .sZZnC, html code.shiki .sZZnC{--shiki-default:#032F62;--shiki-dark:#9ECBFF}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);}html pre.shiki code .sScJk, html code.shiki .sScJk{--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sj4cs, html code.shiki .sj4cs{--shiki-default:#005CC5;--shiki-dark:#79B8FF}",{"title":76,"searchDepth":90,"depth":90,"links":1434},[1435,1436,1437,1438,1439,1440,1441,1442,1443,1444,1445,1446,1454],{"id":16,"depth":90,"text":17},{"id":58,"depth":90,"text":59},{"id":65,"depth":90,"text":66},{"id":239,"depth":90,"text":240},{"id":750,"depth":90,"text":751},{"id":790,"depth":90,"text":791},{"id":1098,"depth":90,"text":1099},{"id":1134,"depth":90,"text":1135},{"id":1218,"depth":90,"text":1219},{"id":1269,"depth":90,"text":1270},{"id":1327,"depth":90,"text":1328},{"id":1334,"depth":90,"text":1335,"children":1447},[1448,1449,1451,1452,1453],{"id":1339,"depth":101,"text":1340},{"id":1346,"depth":101,"text":1450},"What happens to my Click context and pass_obj?",{"id":1364,"depth":101,"text":1365},{"id":1377,"depth":101,"text":1378},{"id":1384,"depth":101,"text":1385},{"id":1391,"depth":90,"text":1392},"2026-08-01","Migrate a Click CLI to Typer one command at a time - mount both trees, translate decorators to signatures, and pin behaviour with parity tests.","intermediate",false,"md",{},"\u002Fmodern-python-cli-frameworks-architecture\u002Ftyper-vs-click-when-to-use-each\u002Fconverting-a-click-app-to-typer",{"title":5,"description":1456},"modern-python-cli-frameworks-architecture\u002Ftyper-vs-click-when-to-use-each\u002Fconverting-a-click-app-to-typer\u002Findex",[1465,1466,1467,1468,1469],"typer","click","migration","refactoring","testing","Br0GrC7tTTiqMDrs_1BguPLHXLRa_XnSzVeTa94WSRw",[1472,1475,1478,1481,1484,1487,1490,1493,1496,1499,1502,1505,1508,1511,1514,1517,1520,1523,1526,1529,1532,1535,1538,1541,1544,1547,1550,1553,1556,1559,1562,1565,1567,1570,1573,1576,1579,1582,1585,1588,1590,1593,1596,1599,1602,1605,1608,1611,1614,1617,1620,1623,1626,1629,1632,1634,1635,1638,1640,1643,1646,1649,1652,1655,1658,1661,1664,1667,1670,1673,1676,1679,1682,1685,1688,1691,1694,1697,1700,1703,1706,1709,1712],{"path":1473,"title":1474},"\u002Fabout","About Python CLI Toolcraft",{"path":1476,"title":1477},"\u002Fadvanced-input-parsing-user-experience\u002Fadvanced-argument-validation-strategies","Advanced Argument Validation Strategies",{"path":1479,"title":1480},"\u002Fadvanced-input-parsing-user-experience\u002Fadvanced-argument-validation-strategies\u002Fparsing-nested-json-arguments-in-python-clis","Parsing Nested JSON Args in Python CLIs",{"path":1482,"title":1483},"\u002Fadvanced-input-parsing-user-experience\u002Fadvanced-argument-validation-strategies\u002Fvalidating-file-and-directory-paths-in-clis","Validating File and Directory Paths in CLIs",{"path":1485,"title":1486},"\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":1488,"title":1489},"\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":1491,"title":1492},"\u002Fadvanced-input-parsing-user-experience\u002Fcli-help-output-and-documentation","CLI Help Output and Documentation",{"path":1494,"title":1495},"\u002Fadvanced-input-parsing-user-experience\u002Fcli-help-output-and-documentation\u002Fversioning-and-deprecating-cli-flags","Versioning and Deprecating CLI Flags",{"path":1497,"title":1498},"\u002Fadvanced-input-parsing-user-experience\u002Fcli-help-output-and-documentation\u002Fwriting-help-text-users-actually-read","Writing Help Text Users Actually Read",{"path":1500,"title":1501},"\u002Fadvanced-input-parsing-user-experience\u002Ferror-handling-and-exit-codes\u002Fchoosing-exit-codes-for-cli-tools","Choosing Exit Codes for CLI Tools",{"path":1503,"title":1504},"\u002Fadvanced-input-parsing-user-experience\u002Ferror-handling-and-exit-codes\u002Ffriendly-error-messages-and-tracebacks","Friendly Error Messages and Tracebacks",{"path":1506,"title":1507},"\u002Fadvanced-input-parsing-user-experience\u002Ferror-handling-and-exit-codes\u002Fhandling-keyboard-interrupt-cleanly","Handling Keyboard Interrupt Cleanly",{"path":1509,"title":1510},"\u002Fadvanced-input-parsing-user-experience\u002Ferror-handling-and-exit-codes","Error Handling and Exit Codes for CLIs",{"path":1512,"title":1513},"\u002Fadvanced-input-parsing-user-experience\u002Fhandling-configuration-files-env-vars\u002Fconfig-precedence-flags-env-files-defaults","Config Precedence: Flags, Env, Files, Defaults",{"path":1515,"title":1516},"\u002Fadvanced-input-parsing-user-experience\u002Fhandling-configuration-files-env-vars","Handling Config Files and Env Vars in CLIs",{"path":1518,"title":1519},"\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":1521,"title":1522},"\u002Fadvanced-input-parsing-user-experience","Advanced Input Parsing for Python CLIs",{"path":1524,"title":1525},"\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":1527,"title":1528},"\u002Fadvanced-input-parsing-user-experience\u002Finteractive-terminal-ui-with-rich","Interactive Terminal UI with Rich",{"path":1530,"title":1531},"\u002Fadvanced-input-parsing-user-experience\u002Finteractive-terminal-ui-with-rich\u002Frendering-tables-and-json-with-rich","Rendering Tables and JSON with Rich",{"path":1533,"title":1534},"\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":1536,"title":1537},"\u002Fadvanced-input-parsing-user-experience\u002Fshell-completion-for-python-clis","Shell Completion for Python CLIs",{"path":1539,"title":1540},"\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":1542,"title":1543},"\u002Fadvanced-input-parsing-user-experience\u002Fstructured-logging-for-cli-apps\u002Fadding-verbose-and-quiet-logging-flags","Adding Verbose and Quiet Logging Flags",{"path":1545,"title":1546},"\u002Fadvanced-input-parsing-user-experience\u002Fstructured-logging-for-cli-apps","Structured Logging for CLI Apps",{"path":1548,"title":1549},"\u002Fadvanced-input-parsing-user-experience\u002Fstructured-logging-for-cli-apps\u002Fstructured-json-logging-in-python-clis","Structured JSON Logging in Python CLIs",{"path":1551,"title":1552},"\u002Fadvanced-input-parsing-user-experience\u002Fworking-with-stdin-stdout-and-pipes\u002Fdetecting-tty-and-adapting-output","Detecting a TTY and Adapting Output",{"path":1554,"title":1555},"\u002Fadvanced-input-parsing-user-experience\u002Fworking-with-stdin-stdout-and-pipes\u002Femitting-json-output-for-scripting","Emitting JSON Output for Scripting",{"path":1557,"title":1558},"\u002Fadvanced-input-parsing-user-experience\u002Fworking-with-stdin-stdout-and-pipes\u002Fhandling-broken-pipe-and-sigpipe","Handling Broken Pipe and SIGPIPE",{"path":1560,"title":1561},"\u002Fadvanced-input-parsing-user-experience\u002Fworking-with-stdin-stdout-and-pipes","Working with stdin, stdout and Pipes",{"path":1563,"title":1564},"\u002Fadvanced-input-parsing-user-experience\u002Fworking-with-stdin-stdout-and-pipes\u002Freading-piped-input-in-python-clis","Reading Piped Input in Python CLIs",{"path":1063,"title":1566},"Python CLI Toolcraft",{"path":1568,"title":1569},"\u002Fmodern-python-cli-frameworks-architecture\u002Fcli-startup-performance-and-lazy-loading","CLI Startup Performance and Lazy Loading",{"path":1571,"title":1572},"\u002Fmodern-python-cli-frameworks-architecture\u002Fcli-startup-performance-and-lazy-loading\u002Flazy-loading-subcommands-for-faster-startup","Lazy Loading Subcommands for Faster Startup",{"path":1574,"title":1575},"\u002Fmodern-python-cli-frameworks-architecture\u002Fcli-startup-performance-and-lazy-loading\u002Fprofiling-python-cli-startup-time","Profiling Python CLI Startup Time",{"path":1577,"title":1578},"\u002Fmodern-python-cli-frameworks-architecture\u002Fcli-startup-performance-and-lazy-loading\u002Freducing-cli-dependency-weight","Reducing CLI Dependency Weight",{"path":1580,"title":1581},"\u002Fmodern-python-cli-frameworks-architecture\u002Fcommand-line-parsing-with-argparse\u002Fargparse-subparsers-for-subcommands","argparse Subparsers for Subcommands",{"path":1583,"title":1584},"\u002Fmodern-python-cli-frameworks-architecture\u002Fcommand-line-parsing-with-argparse\u002Fargparse-vs-click-vs-typer-comparison","argparse vs Click vs Typer Compared",{"path":1586,"title":1587},"\u002Fmodern-python-cli-frameworks-architecture\u002Fcommand-line-parsing-with-argparse","Command-Line Parsing with argparse",{"path":1589,"title":1422},"\u002Fmodern-python-cli-frameworks-architecture\u002Fcommand-line-parsing-with-argparse\u002Fmigrating-from-argparse-to-typer",{"path":1591,"title":1592},"\u002Fmodern-python-cli-frameworks-architecture","Python CLI Frameworks and Architecture",{"path":1594,"title":1595},"\u002Fmodern-python-cli-frameworks-architecture\u002Fplugin-architectures-for-extensible-clis","Plugin Architectures for Extensible CLIs",{"path":1597,"title":1598},"\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":1600,"title":1601},"\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":1603,"title":1604},"\u002Fmodern-python-cli-frameworks-architecture\u002Fstructuring-multi-command-python-clis\u002Fdependency-injection-patterns-for-cli-commands","Dependency Injection Patterns for CLI Commands",{"path":1606,"title":1607},"\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":1609,"title":1610},"\u002Fmodern-python-cli-frameworks-architecture\u002Fstructuring-multi-command-python-clis","Structuring Multi-Command Python CLIs",{"path":1612,"title":1613},"\u002Fmodern-python-cli-frameworks-architecture\u002Fstructuring-multi-command-python-clis\u002Fsharing-state-with-click-context-objects","Sharing State with Click Context Objects",{"path":1615,"title":1616},"\u002Fmodern-python-cli-frameworks-architecture\u002Ftesting-python-cli-applications","Testing Python CLI Applications",{"path":1618,"title":1619},"\u002Fmodern-python-cli-frameworks-architecture\u002Ftesting-python-cli-applications\u002Fmeasuring-cli-test-coverage","Measuring CLI Test Coverage",{"path":1621,"title":1622},"\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":1624,"title":1625},"\u002Fmodern-python-cli-frameworks-architecture\u002Ftesting-python-cli-applications\u002Fsnapshot-testing-cli-output","Snapshot Testing CLI Output",{"path":1627,"title":1628},"\u002Fmodern-python-cli-frameworks-architecture\u002Ftesting-python-cli-applications\u002Ftesting-click-commands-with-clirunner","Testing Click Commands with CliRunner",{"path":1630,"title":1631},"\u002Fmodern-python-cli-frameworks-architecture\u002Ftesting-python-cli-applications\u002Ftesting-interactive-prompts-and-stdin","Testing Interactive Prompts and stdin",{"path":1633,"title":1415},"\u002Fmodern-python-cli-frameworks-architecture\u002Ftyper-vs-click-when-to-use-each\u002Fbuilding-a-cli-with-subcommands-in-click",{"path":1461,"title":5},{"path":1636,"title":1637},"\u002Fmodern-python-cli-frameworks-architecture\u002Ftyper-vs-click-when-to-use-each","Typer vs Click: When to Use Each",{"path":1639,"title":1409},"\u002Fmodern-python-cli-frameworks-architecture\u002Ftyper-vs-click-when-to-use-each\u002Ftyper-callback-functions-explained",{"path":1641,"title":1642},"\u002Fproject-setup-dependency-management\u002Fcli-project-scaffolding-with-cookiecutter\u002Fcopier-vs-cookiecutter-for-cli-templates","Copier vs Cookiecutter for CLI Templates",{"path":1644,"title":1645},"\u002Fproject-setup-dependency-management\u002Fcli-project-scaffolding-with-cookiecutter","CLI Project Scaffolding with Cookiecutter",{"path":1647,"title":1648},"\u002Fproject-setup-dependency-management\u002Fdistributing-clis-as-standalone-binaries\u002Fbuilding-cross-platform-release-binaries-in-ci","Building Cross-Platform Release Binaries in CI",{"path":1650,"title":1651},"\u002Fproject-setup-dependency-management\u002Fdistributing-clis-as-standalone-binaries\u002Fbundling-a-python-cli-with-pyinstaller","Bundling a Python CLI with PyInstaller",{"path":1653,"title":1654},"\u002Fproject-setup-dependency-management\u002Fdistributing-clis-as-standalone-binaries\u002Fhomebrew-and-scoop-packaging-for-python-clis","Homebrew and Scoop Packaging for Python CLIs",{"path":1656,"title":1657},"\u002Fproject-setup-dependency-management\u002Fdistributing-clis-as-standalone-binaries","Distributing CLIs as Standalone Binaries",{"path":1659,"title":1660},"\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":1662,"title":1663},"\u002Fproject-setup-dependency-management","Project Setup & Dependency Management",{"path":1665,"title":1666},"\u002Fproject-setup-dependency-management\u002Fmanaging-cli-versioning-changelogs\u002Fautomating-changelogs-with-conventional-commits","Automating Changelogs with Conventional Commits",{"path":1668,"title":1669},"\u002Fproject-setup-dependency-management\u002Fmanaging-cli-versioning-changelogs\u002Fexposing-version-info-and-build-metadata","Exposing Version Info and Build Metadata",{"path":1671,"title":1672},"\u002Fproject-setup-dependency-management\u002Fmanaging-cli-versioning-changelogs","Managing CLI Versioning & Changelogs",{"path":1674,"title":1675},"\u002Fproject-setup-dependency-management\u002Fpackaging-python-clis-for-distribution\u002Fbuilding-wheels-and-sdists-for-python-clis","Building Wheels and sdists for Python CLIs",{"path":1677,"title":1678},"\u002Fproject-setup-dependency-management\u002Fpackaging-python-clis-for-distribution","Packaging Python CLIs for Distribution",{"path":1680,"title":1681},"\u002Fproject-setup-dependency-management\u002Fpackaging-python-clis-for-distribution\u002Finstalling-and-distributing-clis-with-pipx","Installing and Distributing CLIs with pipx",{"path":1683,"title":1684},"\u002Fproject-setup-dependency-management\u002Fpackaging-python-clis-for-distribution\u002Fpublishing-a-python-cli-to-pypi","Publishing a Python CLI to PyPI",{"path":1686,"title":1687},"\u002Fproject-setup-dependency-management\u002Fpoetry-workflows-for-cli-development","Poetry Workflows for CLI Development",{"path":1689,"title":1690},"\u002Fproject-setup-dependency-management\u002Fpoetry-workflows-for-cli-development\u002Fpoetry-entry-points-and-scripts-for-clis","Poetry Entry Points and Scripts for CLIs",{"path":1692,"title":1693},"\u002Fproject-setup-dependency-management\u002Fpre-commit-hooks-for-cli-projects","Pre-commit Hooks for CLI Projects",{"path":1695,"title":1696},"\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":1698,"title":1699},"\u002Fproject-setup-dependency-management\u002Fuv-for-python-cli-dependency-management","uv for Python CLI Dependency Management",{"path":1701,"title":1702},"\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":1704,"title":1705},"\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":1707,"title":1708},"\u002Fproject-setup-dependency-management\u002Fvirtual-environments-isolation-best-practices","Python CLI Env Isolation Best Practices",{"path":1710,"title":1711},"\u002Fproject-setup-dependency-management\u002Fvirtual-environments-isolation-best-practices\u002Fmanaging-virtual-environments-for-cross-platform-clis","Managing Python CLI Virtual Environments",{"path":1713,"title":1714},"\u002Fproject-setup-dependency-management\u002Fvirtual-environments-isolation-best-practices\u002Fpinning-the-python-version-for-a-cli","Pinning the Python Version for a CLI",1785614690033]