[{"data":1,"prerenderedAt":2483},["ShallowReactive",2],{"page-\u002Fadvanced-input-parsing-user-experience\u002Fbuilding-terminal-uis-with-textual\u002Ftesting-textual-apps-with-pilot\u002F":3,"content-directory":1936},{"id":4,"title":5,"body":6,"date":1921,"description":1922,"difficulty":1923,"draft":1924,"extension":1925,"meta":1926,"navigation":134,"path":1927,"seo":1928,"stem":1929,"tags":1930,"updated":1921,"__hash__":1935},"content\u002Fadvanced-input-parsing-user-experience\u002Fbuilding-terminal-uis-with-textual\u002Ftesting-textual-apps-with-pilot\u002Findex.md","Testing Textual Apps with Pilot",{"type":7,"value":8,"toc":1901},"minimark",[9,33,38,67,71,75,82,86,93,302,855,873,877,1069,1072,1076,1079,1476,1479,1543,1550,1555,1565,1569,1575,1741,1751,1755,1758,1788,1792,1795,1798,1805,1809,1812,1816,1820,1823,1827,1837,1841,1848,1852,1862,1866,1897],[10,11,12,13,17,18,22,23,26,27,32],"p",{},"A terminal UI is the part of a CLI most likely to go untested. It feels visual and interactive, so it gets checked by hand — until a refactor quietly breaks the Enter key, or a Textual upgrade changes focus behaviour, and nobody notices until a user does. Textual was designed with testing in mind: ",[14,15,16],"code",{},"App.run_test()"," runs an app ",[19,20,21],"strong",{},"headless"," at a chosen screen size, and the ",[19,24,25],{},"Pilot"," it yields presses keys, clicks widgets and waits for the app to settle, while your test inspects widgets directly. Combined with plain unit tests for logic and snapshot tests for appearance, that gives a TUI the same safety net as the rest of the CLI. This guide builds that net for a small fuzzy-picker app. It belongs to the ",[28,29,31],"a",{"href":30},"\u002Fadvanced-input-parsing-user-experience\u002Fbuilding-terminal-uis-with-textual\u002F","building terminal UIs with Textual topic",".",[34,35,37],"h2",{"id":36},"prerequisites","Prerequisites",[39,40,41,53,60],"ul",{},[42,43,44,45,48,49,52],"li",{},"Textual 1.0+ and pytest, plus an async test plugin: ",[14,46,47],{},"pytest-asyncio"," with ",[14,50,51],{},"asyncio_mode = \"auto\""," in your pytest configuration, or anyio's pytest plugin.",[42,54,55,56,59],{},"Optional: ",[14,57,58],{},"pytest-textual-snapshot"," for visual snapshot tests.",[42,61,62,63,32],{},"An app built along the lines of ",[28,64,66],{"href":65},"\u002Fadvanced-input-parsing-user-experience\u002Fbuilding-terminal-uis-with-textual\u002Fbuilding-your-first-textual-app\u002F","building your first Textual app",[34,68,70],{"id":69},"decide-what-to-test-where","Decide what to test where",[72,73],"inline-diagram",{"name":74},"pilot-matrix",[10,76,77,78,81],{},"The most effective TUI testing strategy is mostly ",[19,79,80],{},"not"," TUI testing. Filtering, sorting, formatting and validation belong in plain functions that the app calls; they are tested with ordinary fast unit tests. Pilot tests then cover what only a running app can show — that keys do what they should, focus moves correctly, screens appear and dismiss, and the app returns the right result. Snapshot tests catch visual regressions in layout and styling.",[34,83,85],{"id":84},"the-app-under-test","The app under test",[10,87,88,89,92],{},"A picker: type to filter a list of names, move with the arrow keys, press Enter to choose or Escape to cancel. It is the kind of component a CLI uses as ",[14,90,91],{},"mytool checkout $(mytool pick-branch)",". The ranking logic lives in its own module:",[94,95,100],"pre",{"className":96,"code":97,"language":98,"meta":99,"style":99},"language-python shiki shiki-themes github-light github-dark","# src\u002Fpicker\u002Flogic.py\nfrom __future__ import annotations\n\n\ndef rank(query: str, names: list[str]) -> list[str]:\n    \"\"\"Case-insensitive filter: prefix matches first, then substring matches, alphabetical within each.\"\"\"\n    q = query.strip().lower()\n    if not q:\n        return sorted(names)\n    prefix = sorted(n for n in names if n.lower().startswith(q))\n    inner = sorted(n for n in names if q in n.lower() and n not in prefix)\n    return prefix + inner\n","python","",[14,101,102,111,129,136,141,170,177,189,201,213,244,287],{"__ignoreMap":99},[103,104,107],"span",{"class":105,"line":106},"line",1,[103,108,110],{"class":109},"sJ8bj","# src\u002Fpicker\u002Flogic.py\n",[103,112,114,118,122,125],{"class":105,"line":113},2,[103,115,117],{"class":116},"szBVR","from",[103,119,121],{"class":120},"sj4cs"," __future__",[103,123,124],{"class":116}," import",[103,126,128],{"class":127},"sVt8B"," annotations\n",[103,130,132],{"class":105,"line":131},3,[103,133,135],{"emptyLinePlaceholder":134},true,"\n",[103,137,139],{"class":105,"line":138},4,[103,140,135],{"emptyLinePlaceholder":134},[103,142,144,147,151,154,157,160,162,165,167],{"class":105,"line":143},5,[103,145,146],{"class":116},"def",[103,148,150],{"class":149},"sScJk"," rank",[103,152,153],{"class":127},"(query: ",[103,155,156],{"class":120},"str",[103,158,159],{"class":127},", names: list[",[103,161,156],{"class":120},[103,163,164],{"class":127},"]) -> list[",[103,166,156],{"class":120},[103,168,169],{"class":127},"]:\n",[103,171,173],{"class":105,"line":172},6,[103,174,176],{"class":175},"sZZnC","    \"\"\"Case-insensitive filter: prefix matches first, then substring matches, alphabetical within each.\"\"\"\n",[103,178,180,183,186],{"class":105,"line":179},7,[103,181,182],{"class":127},"    q ",[103,184,185],{"class":116},"=",[103,187,188],{"class":127}," query.strip().lower()\n",[103,190,192,195,198],{"class":105,"line":191},8,[103,193,194],{"class":116},"    if",[103,196,197],{"class":116}," not",[103,199,200],{"class":127}," q:\n",[103,202,204,207,210],{"class":105,"line":203},9,[103,205,206],{"class":116},"        return",[103,208,209],{"class":120}," sorted",[103,211,212],{"class":127},"(names)\n",[103,214,216,219,221,223,226,229,232,235,238,241],{"class":105,"line":215},10,[103,217,218],{"class":127},"    prefix ",[103,220,185],{"class":116},[103,222,209],{"class":120},[103,224,225],{"class":127},"(n ",[103,227,228],{"class":116},"for",[103,230,231],{"class":127}," n ",[103,233,234],{"class":116},"in",[103,236,237],{"class":127}," names ",[103,239,240],{"class":116},"if",[103,242,243],{"class":127}," n.lower().startswith(q))\n",[103,245,247,250,252,254,256,258,260,262,264,266,269,271,274,277,279,281,284],{"class":105,"line":246},11,[103,248,249],{"class":127},"    inner ",[103,251,185],{"class":116},[103,253,209],{"class":120},[103,255,225],{"class":127},[103,257,228],{"class":116},[103,259,231],{"class":127},[103,261,234],{"class":116},[103,263,237],{"class":127},[103,265,240],{"class":116},[103,267,268],{"class":127}," q ",[103,270,234],{"class":116},[103,272,273],{"class":127}," n.lower() ",[103,275,276],{"class":116},"and",[103,278,231],{"class":127},[103,280,80],{"class":116},[103,282,283],{"class":116}," in",[103,285,286],{"class":127}," prefix)\n",[103,288,290,293,296,299],{"class":105,"line":289},12,[103,291,292],{"class":116},"    return",[103,294,295],{"class":127}," prefix ",[103,297,298],{"class":116},"+",[103,300,301],{"class":127}," inner\n",[94,303,305],{"className":96,"code":304,"language":98,"meta":99,"style":99},"# src\u002Fpicker\u002Fapp.py\nfrom __future__ import annotations\n\nfrom textual import events\nfrom textual.app import App, ComposeResult\nfrom textual.widgets import Footer, Input, OptionList\n\nfrom picker.logic import rank\n\n\nclass Picker(App[str | None]):\n    \"\"\"Type to filter, arrows to move, Enter to choose, Escape to give up.\"\"\"\n\n    BINDINGS = [(\"escape\", \"give_up\", \"Cancel\")]\n\n    def __init__(self, names: list[str]) -> None:\n        super().__init__()\n        self.names = names\n\n    def compose(self) -> ComposeResult:\n        yield Input(placeholder=\"type to filter\")\n        yield OptionList(*rank(\"\", self.names))\n        yield Footer()\n\n    def on_input_changed(self, event: Input.Changed) -> None:\n        options = self.query_one(OptionList)\n        options.clear_options()\n        options.add_options(rank(event.value, self.names))\n        if options.option_count:\n            options.highlighted = 0\n\n    def on_input_submitted(self) -> None:\n        options = self.query_one(OptionList)\n        if options.highlighted is not None:\n            self.exit(str(options.get_option_at_index(options.highlighted).prompt))\n\n    def on_key(self, event: events.Key) -> None:\n        \"\"\"Let arrow keys move through the list while typing in the input.\"\"\"\n        if event.key in (\"down\", \"up\") and self.focused is self.query_one(Input):\n            options = self.query_one(OptionList)\n            if event.key == \"down\":\n                options.action_cursor_down()\n            else:\n                options.action_cursor_up()\n            event.prevent_default()\n\n    def action_give_up(self) -> None:\n        self.exit(None)\n",[14,306,307,312,322,326,339,351,363,367,379,383,387,409,414,419,448,453,476,491,505,510,521,542,567,575,580,595,609,615,625,634,645,650,665,676,693,707,712,727,733,771,783,799,805,813,819,825,830,844],{"__ignoreMap":99},[103,308,309],{"class":105,"line":106},[103,310,311],{"class":109},"# src\u002Fpicker\u002Fapp.py\n",[103,313,314,316,318,320],{"class":105,"line":113},[103,315,117],{"class":116},[103,317,121],{"class":120},[103,319,124],{"class":116},[103,321,128],{"class":127},[103,323,324],{"class":105,"line":131},[103,325,135],{"emptyLinePlaceholder":134},[103,327,328,330,333,336],{"class":105,"line":138},[103,329,117],{"class":116},[103,331,332],{"class":127}," textual ",[103,334,335],{"class":116},"import",[103,337,338],{"class":127}," events\n",[103,340,341,343,346,348],{"class":105,"line":143},[103,342,117],{"class":116},[103,344,345],{"class":127}," textual.app ",[103,347,335],{"class":116},[103,349,350],{"class":127}," App, ComposeResult\n",[103,352,353,355,358,360],{"class":105,"line":172},[103,354,117],{"class":116},[103,356,357],{"class":127}," textual.widgets ",[103,359,335],{"class":116},[103,361,362],{"class":127}," Footer, Input, OptionList\n",[103,364,365],{"class":105,"line":179},[103,366,135],{"emptyLinePlaceholder":134},[103,368,369,371,374,376],{"class":105,"line":191},[103,370,117],{"class":116},[103,372,373],{"class":127}," picker.logic ",[103,375,335],{"class":116},[103,377,378],{"class":127}," rank\n",[103,380,381],{"class":105,"line":203},[103,382,135],{"emptyLinePlaceholder":134},[103,384,385],{"class":105,"line":215},[103,386,135],{"emptyLinePlaceholder":134},[103,388,389,392,395,398,400,403,406],{"class":105,"line":246},[103,390,391],{"class":116},"class",[103,393,394],{"class":149}," Picker",[103,396,397],{"class":127},"(App[",[103,399,156],{"class":120},[103,401,402],{"class":116}," |",[103,404,405],{"class":120}," None",[103,407,408],{"class":127},"]):\n",[103,410,411],{"class":105,"line":289},[103,412,413],{"class":175},"    \"\"\"Type to filter, arrows to move, Enter to choose, Escape to give up.\"\"\"\n",[103,415,417],{"class":105,"line":416},13,[103,418,135],{"emptyLinePlaceholder":134},[103,420,422,425,428,431,434,437,440,442,445],{"class":105,"line":421},14,[103,423,424],{"class":120},"    BINDINGS",[103,426,427],{"class":116}," =",[103,429,430],{"class":127}," [(",[103,432,433],{"class":175},"\"escape\"",[103,435,436],{"class":127},", ",[103,438,439],{"class":175},"\"give_up\"",[103,441,436],{"class":127},[103,443,444],{"class":175},"\"Cancel\"",[103,446,447],{"class":127},")]\n",[103,449,451],{"class":105,"line":450},15,[103,452,135],{"emptyLinePlaceholder":134},[103,454,456,459,462,465,467,470,473],{"class":105,"line":455},16,[103,457,458],{"class":116},"    def",[103,460,461],{"class":120}," __init__",[103,463,464],{"class":127},"(self, names: list[",[103,466,156],{"class":120},[103,468,469],{"class":127},"]) -> ",[103,471,472],{"class":120},"None",[103,474,475],{"class":127},":\n",[103,477,479,482,485,488],{"class":105,"line":478},17,[103,480,481],{"class":120},"        super",[103,483,484],{"class":127},"().",[103,486,487],{"class":120},"__init__",[103,489,490],{"class":127},"()\n",[103,492,494,497,500,502],{"class":105,"line":493},18,[103,495,496],{"class":120},"        self",[103,498,499],{"class":127},".names ",[103,501,185],{"class":116},[103,503,504],{"class":127}," names\n",[103,506,508],{"class":105,"line":507},19,[103,509,135],{"emptyLinePlaceholder":134},[103,511,513,515,518],{"class":105,"line":512},20,[103,514,458],{"class":116},[103,516,517],{"class":149}," compose",[103,519,520],{"class":127},"(self) -> ComposeResult:\n",[103,522,524,527,530,534,536,539],{"class":105,"line":523},21,[103,525,526],{"class":116},"        yield",[103,528,529],{"class":127}," Input(",[103,531,533],{"class":532},"s4XuR","placeholder",[103,535,185],{"class":116},[103,537,538],{"class":175},"\"type to filter\"",[103,540,541],{"class":127},")\n",[103,543,545,547,550,553,556,559,561,564],{"class":105,"line":544},22,[103,546,526],{"class":116},[103,548,549],{"class":127}," OptionList(",[103,551,552],{"class":116},"*",[103,554,555],{"class":127},"rank(",[103,557,558],{"class":175},"\"\"",[103,560,436],{"class":127},[103,562,563],{"class":120},"self",[103,565,566],{"class":127},".names))\n",[103,568,570,572],{"class":105,"line":569},23,[103,571,526],{"class":116},[103,573,574],{"class":127}," Footer()\n",[103,576,578],{"class":105,"line":577},24,[103,579,135],{"emptyLinePlaceholder":134},[103,581,583,585,588,591,593],{"class":105,"line":582},25,[103,584,458],{"class":116},[103,586,587],{"class":149}," on_input_changed",[103,589,590],{"class":127},"(self, event: Input.Changed) -> ",[103,592,472],{"class":120},[103,594,475],{"class":127},[103,596,598,601,603,606],{"class":105,"line":597},26,[103,599,600],{"class":127},"        options ",[103,602,185],{"class":116},[103,604,605],{"class":120}," self",[103,607,608],{"class":127},".query_one(OptionList)\n",[103,610,612],{"class":105,"line":611},27,[103,613,614],{"class":127},"        options.clear_options()\n",[103,616,618,621,623],{"class":105,"line":617},28,[103,619,620],{"class":127},"        options.add_options(rank(event.value, ",[103,622,563],{"class":120},[103,624,566],{"class":127},[103,626,628,631],{"class":105,"line":627},29,[103,629,630],{"class":116},"        if",[103,632,633],{"class":127}," options.option_count:\n",[103,635,637,640,642],{"class":105,"line":636},30,[103,638,639],{"class":127},"            options.highlighted ",[103,641,185],{"class":116},[103,643,644],{"class":120}," 0\n",[103,646,648],{"class":105,"line":647},31,[103,649,135],{"emptyLinePlaceholder":134},[103,651,653,655,658,661,663],{"class":105,"line":652},32,[103,654,458],{"class":116},[103,656,657],{"class":149}," on_input_submitted",[103,659,660],{"class":127},"(self) -> ",[103,662,472],{"class":120},[103,664,475],{"class":127},[103,666,668,670,672,674],{"class":105,"line":667},33,[103,669,600],{"class":127},[103,671,185],{"class":116},[103,673,605],{"class":120},[103,675,608],{"class":127},[103,677,679,681,684,687,689,691],{"class":105,"line":678},34,[103,680,630],{"class":116},[103,682,683],{"class":127}," options.highlighted ",[103,685,686],{"class":116},"is",[103,688,197],{"class":116},[103,690,405],{"class":120},[103,692,475],{"class":127},[103,694,696,699,702,704],{"class":105,"line":695},35,[103,697,698],{"class":120},"            self",[103,700,701],{"class":127},".exit(",[103,703,156],{"class":120},[103,705,706],{"class":127},"(options.get_option_at_index(options.highlighted).prompt))\n",[103,708,710],{"class":105,"line":709},36,[103,711,135],{"emptyLinePlaceholder":134},[103,713,715,717,720,723,725],{"class":105,"line":714},37,[103,716,458],{"class":116},[103,718,719],{"class":149}," on_key",[103,721,722],{"class":127},"(self, event: events.Key) -> ",[103,724,472],{"class":120},[103,726,475],{"class":127},[103,728,730],{"class":105,"line":729},38,[103,731,732],{"class":175},"        \"\"\"Let arrow keys move through the list while typing in the input.\"\"\"\n",[103,734,736,738,741,743,746,749,751,754,757,759,761,764,766,768],{"class":105,"line":735},39,[103,737,630],{"class":116},[103,739,740],{"class":127}," event.key ",[103,742,234],{"class":116},[103,744,745],{"class":127}," (",[103,747,748],{"class":175},"\"down\"",[103,750,436],{"class":127},[103,752,753],{"class":175},"\"up\"",[103,755,756],{"class":127},") ",[103,758,276],{"class":116},[103,760,605],{"class":120},[103,762,763],{"class":127},".focused ",[103,765,686],{"class":116},[103,767,605],{"class":120},[103,769,770],{"class":127},".query_one(Input):\n",[103,772,774,777,779,781],{"class":105,"line":773},40,[103,775,776],{"class":127},"            options ",[103,778,185],{"class":116},[103,780,605],{"class":120},[103,782,608],{"class":127},[103,784,786,789,791,794,797],{"class":105,"line":785},41,[103,787,788],{"class":116},"            if",[103,790,740],{"class":127},[103,792,793],{"class":116},"==",[103,795,796],{"class":175}," \"down\"",[103,798,475],{"class":127},[103,800,802],{"class":105,"line":801},42,[103,803,804],{"class":127},"                options.action_cursor_down()\n",[103,806,808,811],{"class":105,"line":807},43,[103,809,810],{"class":116},"            else",[103,812,475],{"class":127},[103,814,816],{"class":105,"line":815},44,[103,817,818],{"class":127},"                options.action_cursor_up()\n",[103,820,822],{"class":105,"line":821},45,[103,823,824],{"class":127},"            event.prevent_default()\n",[103,826,828],{"class":105,"line":827},46,[103,829,135],{"emptyLinePlaceholder":134},[103,831,833,835,838,840,842],{"class":105,"line":832},47,[103,834,458],{"class":116},[103,836,837],{"class":149}," action_give_up",[103,839,660],{"class":127},[103,841,472],{"class":120},[103,843,475],{"class":127},[103,845,847,849,851,853],{"class":105,"line":846},48,[103,848,496],{"class":120},[103,850,701],{"class":127},[103,852,472],{"class":120},[103,854,541],{"class":127},[10,856,857,860,861,864,865,868,869,872],{},[14,858,859],{},"App[str | None]"," declares the return type: ",[14,862,863],{},"self.exit(value)"," ends the app, and ",[14,866,867],{},"run()"," — or ",[14,870,871],{},"app.return_value"," in tests — gives the caller that value.",[34,874,876],{"id":875},"the-recipe-unit-tests-for-the-logic","The recipe: unit tests for the logic",[94,878,880],{"className":96,"code":879,"language":98,"meta":99,"style":99},"# tests\u002Ftest_logic.py\nfrom picker.logic import rank\n\nNAMES = [\"web\", \"webhooks\", \"api\", \"billing-web\", \"worker\"]\n\n\ndef test_empty_query_lists_everything_sorted():\n    assert rank(\"\", NAMES) == sorted(NAMES)\n\n\ndef test_prefix_matches_come_first():\n    assert rank(\"web\", NAMES) == [\"web\", \"webhooks\", \"billing-web\"]\n\n\ndef test_case_insensitive():\n    assert rank(\"API\", NAMES) == [\"api\"]\n",[14,881,882,887,897,901,937,941,945,955,982,986,990,999,1029,1033,1037,1046],{"__ignoreMap":99},[103,883,884],{"class":105,"line":106},[103,885,886],{"class":109},"# tests\u002Ftest_logic.py\n",[103,888,889,891,893,895],{"class":105,"line":113},[103,890,117],{"class":116},[103,892,373],{"class":127},[103,894,335],{"class":116},[103,896,378],{"class":127},[103,898,899],{"class":105,"line":131},[103,900,135],{"emptyLinePlaceholder":134},[103,902,903,906,908,911,914,916,919,921,924,926,929,931,934],{"class":105,"line":138},[103,904,905],{"class":120},"NAMES",[103,907,427],{"class":116},[103,909,910],{"class":127}," [",[103,912,913],{"class":175},"\"web\"",[103,915,436],{"class":127},[103,917,918],{"class":175},"\"webhooks\"",[103,920,436],{"class":127},[103,922,923],{"class":175},"\"api\"",[103,925,436],{"class":127},[103,927,928],{"class":175},"\"billing-web\"",[103,930,436],{"class":127},[103,932,933],{"class":175},"\"worker\"",[103,935,936],{"class":127},"]\n",[103,938,939],{"class":105,"line":143},[103,940,135],{"emptyLinePlaceholder":134},[103,942,943],{"class":105,"line":172},[103,944,135],{"emptyLinePlaceholder":134},[103,946,947,949,952],{"class":105,"line":179},[103,948,146],{"class":116},[103,950,951],{"class":149}," test_empty_query_lists_everything_sorted",[103,953,954],{"class":127},"():\n",[103,956,957,960,963,965,967,969,971,973,975,978,980],{"class":105,"line":191},[103,958,959],{"class":116},"    assert",[103,961,962],{"class":127}," rank(",[103,964,558],{"class":175},[103,966,436],{"class":127},[103,968,905],{"class":120},[103,970,756],{"class":127},[103,972,793],{"class":116},[103,974,209],{"class":120},[103,976,977],{"class":127},"(",[103,979,905],{"class":120},[103,981,541],{"class":127},[103,983,984],{"class":105,"line":203},[103,985,135],{"emptyLinePlaceholder":134},[103,987,988],{"class":105,"line":215},[103,989,135],{"emptyLinePlaceholder":134},[103,991,992,994,997],{"class":105,"line":246},[103,993,146],{"class":116},[103,995,996],{"class":149}," test_prefix_matches_come_first",[103,998,954],{"class":127},[103,1000,1001,1003,1005,1007,1009,1011,1013,1015,1017,1019,1021,1023,1025,1027],{"class":105,"line":289},[103,1002,959],{"class":116},[103,1004,962],{"class":127},[103,1006,913],{"class":175},[103,1008,436],{"class":127},[103,1010,905],{"class":120},[103,1012,756],{"class":127},[103,1014,793],{"class":116},[103,1016,910],{"class":127},[103,1018,913],{"class":175},[103,1020,436],{"class":127},[103,1022,918],{"class":175},[103,1024,436],{"class":127},[103,1026,928],{"class":175},[103,1028,936],{"class":127},[103,1030,1031],{"class":105,"line":416},[103,1032,135],{"emptyLinePlaceholder":134},[103,1034,1035],{"class":105,"line":421},[103,1036,135],{"emptyLinePlaceholder":134},[103,1038,1039,1041,1044],{"class":105,"line":450},[103,1040,146],{"class":116},[103,1042,1043],{"class":149}," test_case_insensitive",[103,1045,954],{"class":127},[103,1047,1048,1050,1052,1055,1057,1059,1061,1063,1065,1067],{"class":105,"line":455},[103,1049,959],{"class":116},[103,1051,962],{"class":127},[103,1053,1054],{"class":175},"\"API\"",[103,1056,436],{"class":127},[103,1058,905],{"class":120},[103,1060,756],{"class":127},[103,1062,793],{"class":116},[103,1064,910],{"class":127},[103,1066,923],{"class":175},[103,1068,936],{"class":127},[10,1070,1071],{},"These run in milliseconds and pin the behaviour users care most about — which names appear, in what order — without starting the app at all.",[34,1073,1075],{"id":1074},"the-recipe-pilot-tests-for-interaction","The recipe: Pilot tests for interaction",[72,1077],{"name":1078},"pilot-flow",[94,1080,1082],{"className":96,"code":1081,"language":98,"meta":99,"style":99},"# tests\u002Ftest_picker.py\nfrom textual.widgets import Input, OptionList\n\nfrom picker.app import Picker\n\nNAMES = [\"web\", \"webhooks\", \"api\", \"billing-web\", \"worker\"]\n\n\nasync def test_typing_filters_the_list():\n    app = Picker(NAMES)\n    async with app.run_test() as pilot:\n        await pilot.press(*\"hook\")\n        options = app.query_one(OptionList)\n        assert options.option_count == 1\n        assert app.query_one(Input).value == \"hook\"\n\n\nasync def test_enter_returns_the_highlighted_name():\n    app = Picker(NAMES)\n    async with app.run_test() as pilot:\n        await pilot.press(*\"web\", \"down\", \"enter\")\n    assert app.return_value == \"webhooks\"\n\n\nasync def test_escape_returns_none():\n    app = Picker(NAMES)\n    async with app.run_test() as pilot:\n        await pilot.press(\"escape\")\n    assert app.return_value is None\n\n\nasync def test_no_matches_then_enter_does_nothing():\n    app = Picker(NAMES)\n    async with app.run_test() as pilot:\n        await pilot.press(*\"zzz\", \"enter\")\n        assert app.is_running\n        await pilot.press(\"escape\")\n    assert app.return_value is None\n",[14,1083,1084,1089,1100,1104,1116,1120,1148,1152,1156,1169,1183,1200,1215,1224,1237,1249,1253,1257,1268,1280,1292,1313,1325,1329,1333,1344,1356,1368,1378,1389,1393,1397,1408,1420,1432,1449,1456,1466],{"__ignoreMap":99},[103,1085,1086],{"class":105,"line":106},[103,1087,1088],{"class":109},"# tests\u002Ftest_picker.py\n",[103,1090,1091,1093,1095,1097],{"class":105,"line":113},[103,1092,117],{"class":116},[103,1094,357],{"class":127},[103,1096,335],{"class":116},[103,1098,1099],{"class":127}," Input, OptionList\n",[103,1101,1102],{"class":105,"line":131},[103,1103,135],{"emptyLinePlaceholder":134},[103,1105,1106,1108,1111,1113],{"class":105,"line":138},[103,1107,117],{"class":116},[103,1109,1110],{"class":127}," picker.app ",[103,1112,335],{"class":116},[103,1114,1115],{"class":127}," Picker\n",[103,1117,1118],{"class":105,"line":143},[103,1119,135],{"emptyLinePlaceholder":134},[103,1121,1122,1124,1126,1128,1130,1132,1134,1136,1138,1140,1142,1144,1146],{"class":105,"line":172},[103,1123,905],{"class":120},[103,1125,427],{"class":116},[103,1127,910],{"class":127},[103,1129,913],{"class":175},[103,1131,436],{"class":127},[103,1133,918],{"class":175},[103,1135,436],{"class":127},[103,1137,923],{"class":175},[103,1139,436],{"class":127},[103,1141,928],{"class":175},[103,1143,436],{"class":127},[103,1145,933],{"class":175},[103,1147,936],{"class":127},[103,1149,1150],{"class":105,"line":179},[103,1151,135],{"emptyLinePlaceholder":134},[103,1153,1154],{"class":105,"line":191},[103,1155,135],{"emptyLinePlaceholder":134},[103,1157,1158,1161,1164,1167],{"class":105,"line":203},[103,1159,1160],{"class":116},"async",[103,1162,1163],{"class":116}," def",[103,1165,1166],{"class":149}," test_typing_filters_the_list",[103,1168,954],{"class":127},[103,1170,1171,1174,1176,1179,1181],{"class":105,"line":215},[103,1172,1173],{"class":127},"    app ",[103,1175,185],{"class":116},[103,1177,1178],{"class":127}," Picker(",[103,1180,905],{"class":120},[103,1182,541],{"class":127},[103,1184,1185,1188,1191,1194,1197],{"class":105,"line":246},[103,1186,1187],{"class":116},"    async",[103,1189,1190],{"class":116}," with",[103,1192,1193],{"class":127}," app.run_test() ",[103,1195,1196],{"class":116},"as",[103,1198,1199],{"class":127}," pilot:\n",[103,1201,1202,1205,1208,1210,1213],{"class":105,"line":289},[103,1203,1204],{"class":116},"        await",[103,1206,1207],{"class":127}," pilot.press(",[103,1209,552],{"class":116},[103,1211,1212],{"class":175},"\"hook\"",[103,1214,541],{"class":127},[103,1216,1217,1219,1221],{"class":105,"line":416},[103,1218,600],{"class":127},[103,1220,185],{"class":116},[103,1222,1223],{"class":127}," app.query_one(OptionList)\n",[103,1225,1226,1229,1232,1234],{"class":105,"line":421},[103,1227,1228],{"class":116},"        assert",[103,1230,1231],{"class":127}," options.option_count ",[103,1233,793],{"class":116},[103,1235,1236],{"class":120}," 1\n",[103,1238,1239,1241,1244,1246],{"class":105,"line":450},[103,1240,1228],{"class":116},[103,1242,1243],{"class":127}," app.query_one(Input).value ",[103,1245,793],{"class":116},[103,1247,1248],{"class":175}," \"hook\"\n",[103,1250,1251],{"class":105,"line":455},[103,1252,135],{"emptyLinePlaceholder":134},[103,1254,1255],{"class":105,"line":478},[103,1256,135],{"emptyLinePlaceholder":134},[103,1258,1259,1261,1263,1266],{"class":105,"line":493},[103,1260,1160],{"class":116},[103,1262,1163],{"class":116},[103,1264,1265],{"class":149}," test_enter_returns_the_highlighted_name",[103,1267,954],{"class":127},[103,1269,1270,1272,1274,1276,1278],{"class":105,"line":507},[103,1271,1173],{"class":127},[103,1273,185],{"class":116},[103,1275,1178],{"class":127},[103,1277,905],{"class":120},[103,1279,541],{"class":127},[103,1281,1282,1284,1286,1288,1290],{"class":105,"line":512},[103,1283,1187],{"class":116},[103,1285,1190],{"class":116},[103,1287,1193],{"class":127},[103,1289,1196],{"class":116},[103,1291,1199],{"class":127},[103,1293,1294,1296,1298,1300,1302,1304,1306,1308,1311],{"class":105,"line":523},[103,1295,1204],{"class":116},[103,1297,1207],{"class":127},[103,1299,552],{"class":116},[103,1301,913],{"class":175},[103,1303,436],{"class":127},[103,1305,748],{"class":175},[103,1307,436],{"class":127},[103,1309,1310],{"class":175},"\"enter\"",[103,1312,541],{"class":127},[103,1314,1315,1317,1320,1322],{"class":105,"line":544},[103,1316,959],{"class":116},[103,1318,1319],{"class":127}," app.return_value ",[103,1321,793],{"class":116},[103,1323,1324],{"class":175}," \"webhooks\"\n",[103,1326,1327],{"class":105,"line":569},[103,1328,135],{"emptyLinePlaceholder":134},[103,1330,1331],{"class":105,"line":577},[103,1332,135],{"emptyLinePlaceholder":134},[103,1334,1335,1337,1339,1342],{"class":105,"line":582},[103,1336,1160],{"class":116},[103,1338,1163],{"class":116},[103,1340,1341],{"class":149}," test_escape_returns_none",[103,1343,954],{"class":127},[103,1345,1346,1348,1350,1352,1354],{"class":105,"line":597},[103,1347,1173],{"class":127},[103,1349,185],{"class":116},[103,1351,1178],{"class":127},[103,1353,905],{"class":120},[103,1355,541],{"class":127},[103,1357,1358,1360,1362,1364,1366],{"class":105,"line":611},[103,1359,1187],{"class":116},[103,1361,1190],{"class":116},[103,1363,1193],{"class":127},[103,1365,1196],{"class":116},[103,1367,1199],{"class":127},[103,1369,1370,1372,1374,1376],{"class":105,"line":617},[103,1371,1204],{"class":116},[103,1373,1207],{"class":127},[103,1375,433],{"class":175},[103,1377,541],{"class":127},[103,1379,1380,1382,1384,1386],{"class":105,"line":627},[103,1381,959],{"class":116},[103,1383,1319],{"class":127},[103,1385,686],{"class":116},[103,1387,1388],{"class":120}," None\n",[103,1390,1391],{"class":105,"line":636},[103,1392,135],{"emptyLinePlaceholder":134},[103,1394,1395],{"class":105,"line":647},[103,1396,135],{"emptyLinePlaceholder":134},[103,1398,1399,1401,1403,1406],{"class":105,"line":652},[103,1400,1160],{"class":116},[103,1402,1163],{"class":116},[103,1404,1405],{"class":149}," test_no_matches_then_enter_does_nothing",[103,1407,954],{"class":127},[103,1409,1410,1412,1414,1416,1418],{"class":105,"line":667},[103,1411,1173],{"class":127},[103,1413,185],{"class":116},[103,1415,1178],{"class":127},[103,1417,905],{"class":120},[103,1419,541],{"class":127},[103,1421,1422,1424,1426,1428,1430],{"class":105,"line":678},[103,1423,1187],{"class":116},[103,1425,1190],{"class":116},[103,1427,1193],{"class":127},[103,1429,1196],{"class":116},[103,1431,1199],{"class":127},[103,1433,1434,1436,1438,1440,1443,1445,1447],{"class":105,"line":695},[103,1435,1204],{"class":116},[103,1437,1207],{"class":127},[103,1439,552],{"class":116},[103,1441,1442],{"class":175},"\"zzz\"",[103,1444,436],{"class":127},[103,1446,1310],{"class":175},[103,1448,541],{"class":127},[103,1450,1451,1453],{"class":105,"line":709},[103,1452,1228],{"class":116},[103,1454,1455],{"class":127}," app.is_running\n",[103,1457,1458,1460,1462,1464],{"class":105,"line":714},[103,1459,1204],{"class":116},[103,1461,1207],{"class":127},[103,1463,433],{"class":175},[103,1465,541],{"class":127},[103,1467,1468,1470,1472,1474],{"class":105,"line":729},[103,1469,959],{"class":116},[103,1471,1319],{"class":127},[103,1473,686],{"class":116},[103,1475,1388],{"class":120},[10,1477,1478],{},"What these tests show:",[39,1480,1481,1493,1514,1524,1531],{},[42,1482,1483,1488,1489,1492],{},[19,1484,1485],{},[14,1486,1487],{},"async with app.run_test() as pilot"," starts the app headless with a default size of 80×24 (pass ",[14,1490,1491],{},"size=(w, h)"," for layout-sensitive tests) and shuts it down cleanly when the block ends.",[42,1494,1495,1500,1501,1504,1505,436,1507,436,1509,436,1511,32],{},[19,1496,1497],{},[14,1498,1499],{},"pilot.press(*\"hook\")"," types characters one key at a time, exactly as a user would, so the ",[14,1502,1503],{},"Input.Changed"," messages fire and the list refilters. Special keys use their names: ",[14,1506,1310],{},[14,1508,433],{},[14,1510,748],{},[14,1512,1513],{},"\"ctrl+c\"",[42,1515,1516,1519,1520,1523],{},[19,1517,1518],{},"Queries inspect state directly."," ",[14,1521,1522],{},"app.query_one(OptionList).option_count"," asserts on the widget rather than on rendered text, which is more robust than matching characters on screen.",[42,1525,1526,1530],{},[19,1527,1528],{},[14,1529,871],{}," is available after the block exits, which is how to test what a picker returns.",[42,1532,1533,1538,1539,1542],{},[19,1534,1535],{},[14,1536,1537],{},"app.is_running"," confirms the app did ",[1540,1541,80],"em",{}," exit — the edge case of pressing Enter with no matches, which should do nothing rather than return an empty string or crash.",[10,1544,1545,1546,1549],{},"Pilot methods await until the app has processed the input. When an action triggers further work — a message handled by another widget, a screen push — call ",[14,1547,1548],{},"await pilot.pause()"," before asserting, which lets pending messages drain.",[1551,1552,1554],"h3",{"id":1553},"workers-timers-and-time","Workers, timers and time",[10,1556,1557,1558,1561,1562,1564],{},"Apps that load data in background workers or refresh on a timer need two extra techniques. Wait for workers explicitly with ",[14,1559,1560],{},"await app.workers.wait_for_complete()"," rather than sleeping. And make intervals configurable, so a test can pass a long interval (or disable the timer) and trigger refreshes itself by pressing the refresh key — the approach used in the job-monitor test in ",[28,1563,66],{"href":65},". Inject the data source too: a fake that returns fixed data makes every run identical.",[34,1566,1568],{"id":1567},"snapshot-tests-for-appearance","Snapshot tests for appearance",[10,1570,1571,1572,1574],{},"Logic and interaction tests will not notice that a border disappeared or a column overlaps its neighbour. ",[14,1573,58],{}," renders the app to an SVG screenshot and compares it with a stored one:",[94,1576,1578],{"className":96,"code":1577,"language":98,"meta":99,"style":99},"# tests\u002Ftest_snapshots.py\nfrom pathlib import Path\n\nAPP = Path(__file__).parent \u002F \"snapshot_apps\" \u002F \"picker_app.py\"\n\n\ndef test_picker_initial(snap_compare):\n    assert snap_compare(APP, terminal_size=(60, 12))\n\n\ndef test_picker_filtered(snap_compare):\n    assert snap_compare(APP, press=[\"w\", \"e\", \"b\"], terminal_size=(60, 12))\n",[14,1579,1580,1585,1597,1601,1629,1633,1637,1647,1676,1680,1684,1693],{"__ignoreMap":99},[103,1581,1582],{"class":105,"line":106},[103,1583,1584],{"class":109},"# tests\u002Ftest_snapshots.py\n",[103,1586,1587,1589,1592,1594],{"class":105,"line":113},[103,1588,117],{"class":116},[103,1590,1591],{"class":127}," pathlib ",[103,1593,335],{"class":116},[103,1595,1596],{"class":127}," Path\n",[103,1598,1599],{"class":105,"line":131},[103,1600,135],{"emptyLinePlaceholder":134},[103,1602,1603,1606,1608,1611,1614,1617,1620,1623,1626],{"class":105,"line":138},[103,1604,1605],{"class":120},"APP",[103,1607,427],{"class":116},[103,1609,1610],{"class":127}," Path(",[103,1612,1613],{"class":120},"__file__",[103,1615,1616],{"class":127},").parent ",[103,1618,1619],{"class":116},"\u002F",[103,1621,1622],{"class":175}," \"snapshot_apps\"",[103,1624,1625],{"class":116}," \u002F",[103,1627,1628],{"class":175}," \"picker_app.py\"\n",[103,1630,1631],{"class":105,"line":143},[103,1632,135],{"emptyLinePlaceholder":134},[103,1634,1635],{"class":105,"line":172},[103,1636,135],{"emptyLinePlaceholder":134},[103,1638,1639,1641,1644],{"class":105,"line":179},[103,1640,146],{"class":116},[103,1642,1643],{"class":149}," test_picker_initial",[103,1645,1646],{"class":127},"(snap_compare):\n",[103,1648,1649,1651,1654,1656,1658,1661,1663,1665,1668,1670,1673],{"class":105,"line":191},[103,1650,959],{"class":116},[103,1652,1653],{"class":127}," snap_compare(",[103,1655,1605],{"class":120},[103,1657,436],{"class":127},[103,1659,1660],{"class":532},"terminal_size",[103,1662,185],{"class":116},[103,1664,977],{"class":127},[103,1666,1667],{"class":120},"60",[103,1669,436],{"class":127},[103,1671,1672],{"class":120},"12",[103,1674,1675],{"class":127},"))\n",[103,1677,1678],{"class":105,"line":203},[103,1679,135],{"emptyLinePlaceholder":134},[103,1681,1682],{"class":105,"line":215},[103,1683,135],{"emptyLinePlaceholder":134},[103,1685,1686,1688,1691],{"class":105,"line":246},[103,1687,146],{"class":116},[103,1689,1690],{"class":149}," test_picker_filtered",[103,1692,1646],{"class":127},[103,1694,1695,1697,1699,1701,1703,1706,1708,1711,1714,1716,1719,1721,1724,1727,1729,1731,1733,1735,1737,1739],{"class":105,"line":289},[103,1696,959],{"class":116},[103,1698,1653],{"class":127},[103,1700,1605],{"class":120},[103,1702,436],{"class":127},[103,1704,1705],{"class":532},"press",[103,1707,185],{"class":116},[103,1709,1710],{"class":127},"[",[103,1712,1713],{"class":175},"\"w\"",[103,1715,436],{"class":127},[103,1717,1718],{"class":175},"\"e\"",[103,1720,436],{"class":127},[103,1722,1723],{"class":175},"\"b\"",[103,1725,1726],{"class":127},"], ",[103,1728,1660],{"class":532},[103,1730,185],{"class":116},[103,1732,977],{"class":127},[103,1734,1667],{"class":120},[103,1736,436],{"class":127},[103,1738,1672],{"class":120},[103,1740,1675],{"class":127},[10,1742,1743,1746,1747,1750],{},[14,1744,1745],{},"snap_compare"," takes a path to a small script that creates the app (or an app instance), optional key presses to run first, and a terminal size. A snapshot test fails until a reference exists, so record the first ones with ",[14,1748,1749],{},"pytest --snapshot-update"," and commit the generated files; from then on any visual difference fails the test and produces an HTML report showing old and new side by side. Update snapshots the same way — deliberately, reviewing the diff — whenever a visual change is intended. Keep snapshot tests few — a handful of key screens — because every intentional styling change requires reviewing and updating them.",[34,1752,1754],{"id":1753},"ux-considerations","UX considerations",[10,1756,1757],{},"Tests protect the user experience in specific ways for TUIs:",[39,1759,1760,1770,1776,1782],{},[42,1761,1762,1765,1766,1769],{},[19,1763,1764],{},"Escape hatches must always work."," Test that Escape, ",[14,1767,1768],{},"q"," or Ctrl+C leave the app from every screen; a TUI you cannot exit is the worst possible failure.",[42,1771,1772,1775],{},[19,1773,1774],{},"Keyboard-only use."," Pilot tests that drive everything with keys prove the app is fully usable without a mouse, which matters over SSH and for accessibility.",[42,1777,1778,1781],{},[19,1779,1780],{},"Empty and error states."," No matches, no data, a failed load — test that each shows something sensible rather than an empty screen or a traceback.",[42,1783,1784,1787],{},[19,1785,1786],{},"Stable results for pickers."," When the TUI returns a value to a shell pipeline, test the exact value, since scripts will depend on it.",[34,1789,1791],{"id":1790},"testing-the-behaviour-in-ci","Testing the behaviour in CI",[10,1793,1794],{},"Headless tests need no terminal, so they run in any CI job on any operating system:",[72,1796],{"name":1797},"pilot-terminal",[10,1799,1800,1801,32],{},"Two practical notes. Pin Textual in the lockfile and upgrade deliberately; Textual evolves quickly, and a routine upgrade is exactly when these tests earn their keep. And run snapshot tests on one platform only (usually Linux), because font-independent as they are, minor rendering differences between platforms can still produce noisy diffs; logic and Pilot tests can run everywhere in the matrix described in ",[28,1802,1804],{"href":1803},"\u002Fproject-setup-dependency-management\u002Fci-cd-pipelines-for-python-clis\u002Ftesting-a-cli-across-python-versions-with-github-actions\u002F","testing a CLI across Python versions with GitHub Actions",[34,1806,1808],{"id":1807},"conclusion","Conclusion",[10,1810,1811],{},"Test a Textual TUI in three layers: plain unit tests for the logic you have extracted from widgets, Pilot tests that drive the running app headless with real key presses and assert on widget state and return values, and a few snapshot tests that catch visual regressions. Wait for workers and messages explicitly instead of sleeping, inject data sources and intervals, test the exits and empty states, and run it all in CI like any other suite. The interactive part of your CLI then gets the same confidence as the rest.",[34,1813,1815],{"id":1814},"frequently-asked-questions","Frequently asked questions",[1551,1817,1819],{"id":1818},"do-pilot-tests-run-in-parallel-with-pytest-xdist","Do Pilot tests run in parallel with pytest-xdist?",[10,1821,1822],{},"Yes. Each test starts its own app instance headless, so they are independent. Snapshot tests work with xdist too.",[1551,1824,1826],{"id":1825},"how-do-i-test-mouse-interactions","How do I test mouse interactions?",[10,1828,1829,1832,1833,1836],{},[14,1830,1831],{},"await pilot.click(\"#selector\")"," clicks a widget by CSS selector, and ",[14,1834,1835],{},"pilot.hover(...)"," moves the pointer. Offsets let you click specific positions within a widget.",[1551,1838,1840],{"id":1839},"my-test-passes-locally-but-fails-in-ci-with-a-timeout-why","My test passes locally but fails in CI with a timeout. Why?",[10,1842,1843,1844,1847],{},"Usually a worker or timer that never completes under the test's conditions — a real network call, or an interval so short the app never settles. Inject fakes for I\u002FO and make intervals configurable; ",[14,1845,1846],{},"wait_for_complete()"," then returns promptly.",[1551,1849,1851],{"id":1850},"should-i-test-the-typer-command-that-launches-the-tui","Should I test the Typer command that launches the TUI?",[10,1853,1854,1855,1858,1859,1861],{},"Test its non-interactive paths with ",[14,1856,1857],{},"CliRunner",": that it refuses to start without a terminal and points at the scriptable alternative. The app itself is covered by Pilot tests; starting a full-screen app through ",[14,1860,1857],{}," adds little.",[34,1863,1865],{"id":1864},"related","Related",[39,1867,1868,1874,1879,1885,1891],{},[42,1869,1870,1871],{},"Up: ",[28,1872,1873],{"href":30},"Building terminal UIs with Textual",[42,1875,1876],{},[28,1877,1878],{"href":65},"Building your first Textual app",[42,1880,1881],{},[28,1882,1884],{"href":1883},"\u002Fadvanced-input-parsing-user-experience\u002Fbuilding-terminal-uis-with-textual\u002Fchoosing-between-a-cli-a-prompt-flow-and-a-tui\u002F","Choosing between a CLI, a prompt flow and a TUI",[42,1886,1887],{},[28,1888,1890],{"href":1889},"\u002Fmodern-python-cli-frameworks-architecture\u002Ftesting-python-cli-applications\u002Fsnapshot-testing-cli-output\u002F","Snapshot testing CLI output",[42,1892,1893],{},[28,1894,1896],{"href":1895},"\u002Fmodern-python-cli-frameworks-architecture\u002Ftesting-python-cli-applications\u002Ftesting-interactive-prompts-and-stdin\u002F","Testing interactive prompts and stdin",[1898,1899,1900],"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 .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 .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 .s4XuR, html code.shiki .s4XuR{--shiki-default:#E36209;--shiki-dark:#FFAB70}",{"title":99,"searchDepth":113,"depth":113,"links":1902},[1903,1904,1905,1906,1907,1910,1911,1912,1913,1914,1920],{"id":36,"depth":113,"text":37},{"id":69,"depth":113,"text":70},{"id":84,"depth":113,"text":85},{"id":875,"depth":113,"text":876},{"id":1074,"depth":113,"text":1075,"children":1908},[1909],{"id":1553,"depth":131,"text":1554},{"id":1567,"depth":113,"text":1568},{"id":1753,"depth":113,"text":1754},{"id":1790,"depth":113,"text":1791},{"id":1807,"depth":113,"text":1808},{"id":1814,"depth":113,"text":1815,"children":1915},[1916,1917,1918,1919],{"id":1818,"depth":131,"text":1819},{"id":1825,"depth":131,"text":1826},{"id":1839,"depth":131,"text":1840},{"id":1850,"depth":131,"text":1851},{"id":1864,"depth":113,"text":1865},"2026-09-18","Test Textual terminal UIs in a Python CLI: logic in plain functions, run_test and Pilot for keys and focus, workers and timers, snapshot tests and CI setup.","intermediate",false,"md",{},"\u002Fadvanced-input-parsing-user-experience\u002Fbuilding-terminal-uis-with-textual\u002Ftesting-textual-apps-with-pilot",{"title":5,"description":1922},"advanced-input-parsing-user-experience\u002Fbuilding-terminal-uis-with-textual\u002Ftesting-textual-apps-with-pilot\u002Findex",[1931,1932,1933,1934],"textual","testing","pytest","tui","ZrG728tl2b_53jObQ3tfOjiOuZFCF9O04hO7Kh3agPk",[1937,1940,1943,1946,1949,1952,1955,1958,1961,1964,1965,1968,1971,1974,1977,1980,1983,1986,1989,1992,1995,1998,2001,2004,2007,2010,2013,2016,2019,2022,2025,2028,2031,2034,2037,2040,2043,2046,2049,2052,2055,2058,2061,2064,2067,2070,2073,2076,2079,2082,2085,2088,2091,2094,2097,2100,2103,2106,2109,2112,2115,2118,2121,2124,2127,2130,2133,2136,2139,2142,2145,2148,2151,2154,2157,2160,2163,2166,2169,2172,2175,2178,2181,2184,2187,2190,2193,2196,2199,2202,2205,2208,2210,2213,2216,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,2429,2432,2435,2438,2441,2444,2447,2450,2453,2456,2459,2462,2465,2468,2471,2474,2477,2480],{"path":1938,"title":1939},"\u002Fabout","About Python CLI Toolcraft",{"path":1941,"title":1942},"\u002Fadvanced-input-parsing-user-experience\u002Fadvanced-argument-validation-strategies","Advanced Argument Validation Strategies",{"path":1944,"title":1945},"\u002Fadvanced-input-parsing-user-experience\u002Fadvanced-argument-validation-strategies\u002Fparsing-nested-json-arguments-in-python-clis","Parsing Nested JSON Args in Python CLIs",{"path":1947,"title":1948},"\u002Fadvanced-input-parsing-user-experience\u002Fadvanced-argument-validation-strategies\u002Fvalidating-dependent-and-conflicting-options","Validating Dependent and Conflicting CLI Options",{"path":1950,"title":1951},"\u002Fadvanced-input-parsing-user-experience\u002Fadvanced-argument-validation-strategies\u002Fvalidating-file-and-directory-paths-in-clis","Validating File and Directory Paths in CLIs",{"path":1953,"title":1954},"\u002Fadvanced-input-parsing-user-experience\u002Fadvanced-argument-validation-strategies\u002Fwriting-custom-click-parameter-types","Writing Custom Click Parameter Types",{"path":1956,"title":1957},"\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":1959,"title":1960},"\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":1962,"title":1963},"\u002Fadvanced-input-parsing-user-experience\u002Fbuilding-terminal-uis-with-textual","Building Terminal UIs with Textual for Python CLIs",{"path":1927,"title":5},{"path":1966,"title":1967},"\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":1969,"title":1970},"\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":1972,"title":1973},"\u002Fadvanced-input-parsing-user-experience\u002Fcli-help-output-and-documentation","CLI Help Output and Documentation",{"path":1975,"title":1976},"\u002Fadvanced-input-parsing-user-experience\u002Fcli-help-output-and-documentation\u002Fversioning-and-deprecating-cli-flags","Versioning and Deprecating CLI Flags",{"path":1978,"title":1979},"\u002Fadvanced-input-parsing-user-experience\u002Fcli-help-output-and-documentation\u002Fwriting-help-text-users-actually-read","Writing Help Text Users Actually Read",{"path":1981,"title":1982},"\u002Fadvanced-input-parsing-user-experience\u002Fcross-platform-terminal-compatibility\u002Fadapting-output-to-terminal-width","Adapting Python CLI Output to Terminal Width",{"path":1984,"title":1985},"\u002Fadvanced-input-parsing-user-experience\u002Fcross-platform-terminal-compatibility\u002Fdetecting-ci-environments-and-non-interactive-shells","Detecting CI Environments and Non-Interactive Shells",{"path":1987,"title":1988},"\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":1990,"title":1991},"\u002Fadvanced-input-parsing-user-experience\u002Fcross-platform-terminal-compatibility","Cross-Platform Terminal Compatibility for Python CLIs",{"path":1993,"title":1994},"\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":1996,"title":1997},"\u002Fadvanced-input-parsing-user-experience\u002Ferror-handling-and-exit-codes\u002Fchoosing-exit-codes-for-cli-tools","Choosing Exit Codes for CLI Tools",{"path":1999,"title":2000},"\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":2002,"title":2003},"\u002Fadvanced-input-parsing-user-experience\u002Ferror-handling-and-exit-codes\u002Ffriendly-error-messages-and-tracebacks","Friendly Error Messages and Tracebacks",{"path":2005,"title":2006},"\u002Fadvanced-input-parsing-user-experience\u002Ferror-handling-and-exit-codes\u002Fhandling-keyboard-interrupt-cleanly","Handling Keyboard Interrupt Cleanly",{"path":2008,"title":2009},"\u002Fadvanced-input-parsing-user-experience\u002Ferror-handling-and-exit-codes","Error Handling and Exit Codes for CLIs",{"path":2011,"title":2012},"\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":2014,"title":2015},"\u002Fadvanced-input-parsing-user-experience\u002Fhandling-configuration-files-env-vars\u002Fconfig-precedence-flags-env-files-defaults","Config Precedence: Flags, Env, Files, Defaults",{"path":2017,"title":2018},"\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":2020,"title":2021},"\u002Fadvanced-input-parsing-user-experience\u002Fhandling-configuration-files-env-vars","Handling Config Files and Env Vars in CLIs",{"path":2023,"title":2024},"\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":2026,"title":2027},"\u002Fadvanced-input-parsing-user-experience\u002Fhandling-configuration-files-env-vars\u002Freading-toml-config-with-tomllib","Reading TOML Config with tomllib in Python CLIs",{"path":2029,"title":2030},"\u002Fadvanced-input-parsing-user-experience\u002Fhandling-configuration-files-env-vars\u002Ftyped-settings-with-pydantic-settings","Typed Settings with pydantic-settings in Python CLIs",{"path":2032,"title":2033},"\u002Fadvanced-input-parsing-user-experience","Advanced Input Parsing for Python CLIs",{"path":2035,"title":2036},"\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":2038,"title":2039},"\u002Fadvanced-input-parsing-user-experience\u002Finteractive-terminal-ui-with-rich\u002Fbuilding-interactive-prompts-and-menus","Building Interactive Prompts and Menus in Python CLIs",{"path":2041,"title":2042},"\u002Fadvanced-input-parsing-user-experience\u002Finteractive-terminal-ui-with-rich","Interactive Terminal UI with Rich",{"path":2044,"title":2045},"\u002Fadvanced-input-parsing-user-experience\u002Finteractive-terminal-ui-with-rich\u002Flive-dashboards-with-rich-live","Live Dashboards with Rich Live in Python CLIs",{"path":2047,"title":2048},"\u002Fadvanced-input-parsing-user-experience\u002Finteractive-terminal-ui-with-rich\u002Frendering-tables-and-json-with-rich","Rendering Tables and JSON with Rich",{"path":2050,"title":2051},"\u002Fadvanced-input-parsing-user-experience\u002Finteractive-terminal-ui-with-rich\u002Ftheming-rich-output-consistently","Theming Rich Output Consistently in Python CLIs",{"path":2053,"title":2054},"\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":2056,"title":2057},"\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":2059,"title":2060},"\u002Fadvanced-input-parsing-user-experience\u002Fshell-completion-for-python-clis","Shell Completion for Python CLIs",{"path":2062,"title":2063},"\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":2065,"title":2066},"\u002Fadvanced-input-parsing-user-experience\u002Fshell-completion-for-python-clis\u002Ftesting-shell-completion-in-python-clis","Testing Shell Completion in Python CLIs",{"path":2068,"title":2069},"\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":2071,"title":2072},"\u002Fadvanced-input-parsing-user-experience\u002Fstructured-logging-for-cli-apps\u002Fadding-verbose-and-quiet-logging-flags","Adding Verbose and Quiet Logging Flags",{"path":2074,"title":2075},"\u002Fadvanced-input-parsing-user-experience\u002Fstructured-logging-for-cli-apps","Structured Logging for CLI Apps",{"path":2077,"title":2078},"\u002Fadvanced-input-parsing-user-experience\u002Fstructured-logging-for-cli-apps\u002Fstructured-json-logging-in-python-clis","Structured JSON Logging in Python CLIs",{"path":2080,"title":2081},"\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":2083,"title":2084},"\u002Fadvanced-input-parsing-user-experience\u002Fworking-with-stdin-stdout-and-pipes\u002Fdetecting-tty-and-adapting-output","Detecting a TTY and Adapting Output",{"path":2086,"title":2087},"\u002Fadvanced-input-parsing-user-experience\u002Fworking-with-stdin-stdout-and-pipes\u002Femitting-json-output-for-scripting","Emitting JSON Output for Scripting",{"path":2089,"title":2090},"\u002Fadvanced-input-parsing-user-experience\u002Fworking-with-stdin-stdout-and-pipes\u002Fhandling-broken-pipe-and-sigpipe","Handling Broken Pipe and SIGPIPE",{"path":2092,"title":2093},"\u002Fadvanced-input-parsing-user-experience\u002Fworking-with-stdin-stdout-and-pipes","Working with stdin, stdout and Pipes",{"path":2095,"title":2096},"\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":2098,"title":2099},"\u002Fadvanced-input-parsing-user-experience\u002Fworking-with-stdin-stdout-and-pipes\u002Freading-piped-input-in-python-clis","Reading Piped Input in Python CLIs",{"path":2101,"title":2102},"\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":2104,"title":2105},"\u002Fcli-runtime-systems-integration\u002Fcalling-http-apis-from-python-clis\u002Fdownloading-files-with-progress-in-python","Downloading Files with Progress in Python CLIs",{"path":2107,"title":2108},"\u002Fcli-runtime-systems-integration\u002Fcalling-http-apis-from-python-clis","Calling HTTP APIs from Python CLIs",{"path":2110,"title":2111},"\u002Fcli-runtime-systems-integration\u002Fcalling-http-apis-from-python-clis\u002Foauth-device-flow-login-for-clis","OAuth Device Flow Login for Python CLIs",{"path":2113,"title":2114},"\u002Fcli-runtime-systems-integration\u002Fcalling-http-apis-from-python-clis\u002Fpaginating-api-results-in-a-cli","Paginating API Results in a Python CLI",{"path":2116,"title":2117},"\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":2119,"title":2120},"\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":2122,"title":2123},"\u002Fcli-runtime-systems-integration\u002Fconcurrency-and-async-in-python-clis","Concurrency and Async in Python CLIs",{"path":2125,"title":2126},"\u002Fcli-runtime-systems-integration\u002Fconcurrency-and-async-in-python-clis\u002Fmultiprocessing-for-cpu-bound-cli-tasks","Multiprocessing for CPU-Bound CLI Tasks",{"path":2128,"title":2129},"\u002Fcli-runtime-systems-integration\u002Fconcurrency-and-async-in-python-clis\u002Fparallelising-cli-work-with-thread-pools","Parallelising CLI Work with Thread Pools",{"path":2131,"title":2132},"\u002Fcli-runtime-systems-integration\u002Fconcurrency-and-async-in-python-clis\u002Frate-limiting-concurrent-requests-in-clis","Rate-Limiting Concurrent Requests in Python CLIs",{"path":2134,"title":2135},"\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":2137,"title":2138},"\u002Fcli-runtime-systems-integration\u002Ffilesystem-paths-and-atomic-writes\u002Fcross-platform-paths-with-pathlib","Cross-Platform Paths with pathlib in CLIs",{"path":2140,"title":2141},"\u002Fcli-runtime-systems-integration\u002Ffilesystem-paths-and-atomic-writes\u002Ffile-locking-for-concurrent-cli-runs","File Locking for Concurrent CLI Runs in Python",{"path":2143,"title":2144},"\u002Fcli-runtime-systems-integration\u002Ffilesystem-paths-and-atomic-writes","Filesystem Paths and Atomic Writes for CLIs",{"path":2146,"title":2147},"\u002Fcli-runtime-systems-integration\u002Ffilesystem-paths-and-atomic-writes\u002Fsafe-temporary-files-and-directories","Safe Temporary Files and Directories in CLIs",{"path":2149,"title":2150},"\u002Fcli-runtime-systems-integration\u002Ffilesystem-paths-and-atomic-writes\u002Fstoring-app-data-with-platformdirs","Storing CLI App Data with platformdirs",{"path":2152,"title":2153},"\u002Fcli-runtime-systems-integration\u002Ffilesystem-paths-and-atomic-writes\u002Fwriting-files-atomically-in-python-clis","Writing Files Atomically in Python CLIs",{"path":2155,"title":2156},"\u002Fcli-runtime-systems-integration","CLI Runtime & Systems Integration for Python",{"path":2158,"title":2159},"\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":2161,"title":2162},"\u002Fcli-runtime-systems-integration\u002Flong-running-and-watch-mode-clis\u002Fhandling-sigterm-and-graceful-shutdown","Handling SIGTERM and Graceful Shutdown in CLIs",{"path":2164,"title":2165},"\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":2167,"title":2168},"\u002Fcli-runtime-systems-integration\u002Flong-running-and-watch-mode-clis","Long-Running and Watch-Mode Python CLIs",{"path":2170,"title":2171},"\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":2173,"title":2174},"\u002Fcli-runtime-systems-integration\u002Frunning-subprocesses-from-python-clis\u002Favoiding-shell-injection-in-python-clis","Avoiding Shell Injection in Python CLIs",{"path":2176,"title":2177},"\u002Fcli-runtime-systems-integration\u002Frunning-subprocesses-from-python-clis\u002Fcalling-external-commands-safely-with-subprocess","Calling External Commands Safely with subprocess",{"path":2179,"title":2180},"\u002Fcli-runtime-systems-integration\u002Frunning-subprocesses-from-python-clis\u002Fhandling-subprocess-timeouts-and-exit-codes","Handling Subprocess Timeouts and Exit Codes",{"path":2182,"title":2183},"\u002Fcli-runtime-systems-integration\u002Frunning-subprocesses-from-python-clis","Running Subprocesses from Python CLIs",{"path":2185,"title":2186},"\u002Fcli-runtime-systems-integration\u002Frunning-subprocesses-from-python-clis\u002Fstreaming-subprocess-output-in-real-time","Streaming Subprocess Output in Real Time",{"path":2188,"title":2189},"\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":2191,"title":2192},"\u002Fcli-runtime-systems-integration\u002Fsecrets-and-credentials-in-python-clis","Secrets and Credentials in Python CLIs",{"path":2194,"title":2195},"\u002Fcli-runtime-systems-integration\u002Fsecrets-and-credentials-in-python-clis\u002Fprompting-for-passwords-securely","Prompting for Passwords Securely in Python CLIs",{"path":2197,"title":2198},"\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":2200,"title":2201},"\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":2203,"title":2204},"\u002Fcli-runtime-systems-integration\u002Fsecrets-and-credentials-in-python-clis\u002Fstoring-tokens-with-keyring","Storing CLI Tokens Securely with keyring",{"path":2206,"title":2207},"\u002Fcli-runtime-systems-integration\u002Fsecrets-and-credentials-in-python-clis\u002Fsupporting-multiple-profiles-and-accounts","Supporting Multiple Profiles and Accounts in CLIs",{"path":1619,"title":2209},"Python CLI Toolcraft",{"path":2211,"title":2212},"\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":2214,"title":2215},"\u002Fmodern-python-cli-frameworks-architecture\u002Fcli-startup-performance-and-lazy-loading","CLI Startup Performance and Lazy Loading",{"path":2217,"title":2218},"\u002Fmodern-python-cli-frameworks-architecture\u002Fcli-startup-performance-and-lazy-loading\u002Flazy-loading-subcommands-for-faster-startup","Lazy Loading Subcommands for Faster Startup",{"path":2220,"title":2221},"\u002Fmodern-python-cli-frameworks-architecture\u002Fcli-startup-performance-and-lazy-loading\u002Fprofiling-python-cli-startup-time","Profiling Python CLI Startup Time",{"path":2223,"title":2224},"\u002Fmodern-python-cli-frameworks-architecture\u002Fcli-startup-performance-and-lazy-loading\u002Freducing-cli-dependency-weight","Reducing CLI Dependency Weight",{"path":2226,"title":2227},"\u002Fmodern-python-cli-frameworks-architecture\u002Fcommand-line-parsing-with-argparse\u002Fargparse-subparsers-for-subcommands","argparse Subparsers for Subcommands",{"path":2229,"title":2230},"\u002Fmodern-python-cli-frameworks-architecture\u002Fcommand-line-parsing-with-argparse\u002Fargparse-vs-click-vs-typer-comparison","argparse vs Click vs Typer Compared",{"path":2232,"title":2233},"\u002Fmodern-python-cli-frameworks-architecture\u002Fcommand-line-parsing-with-argparse","Command-Line Parsing with argparse",{"path":2235,"title":2236},"\u002Fmodern-python-cli-frameworks-architecture\u002Fcommand-line-parsing-with-argparse\u002Fmigrating-from-argparse-to-typer","Migrating from argparse to Typer",{"path":2238,"title":2239},"\u002Fmodern-python-cli-frameworks-architecture\u002Fcommand-line-parsing-with-argparse\u002Fmutually-exclusive-options-in-argparse","Mutually Exclusive Options in argparse",{"path":2241,"title":2242},"\u002Fmodern-python-cli-frameworks-architecture\u002Fcommand-line-parsing-with-argparse\u002Fwriting-custom-argparse-actions","Writing Custom argparse Actions in Python",{"path":2244,"title":2245},"\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":2247,"title":2248},"\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":2250,"title":2251},"\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":2253,"title":2254},"\u002Fmodern-python-cli-frameworks-architecture\u002Fdesigning-cli-interfaces-and-conventions","Designing CLI Interfaces and Conventions in Python",{"path":2256,"title":2257},"\u002Fmodern-python-cli-frameworks-architecture\u002Fdesigning-cli-interfaces-and-conventions\u002Fnaming-commands-and-flags-consistently","Naming Commands and Flags Consistently in Python CLIs",{"path":2259,"title":2260},"\u002Fmodern-python-cli-frameworks-architecture","Python CLI Frameworks and Architecture",{"path":2262,"title":2263},"\u002Fmodern-python-cli-frameworks-architecture\u002Fplugin-architectures-for-extensible-clis\u002Fdiscovering-plugins-with-entry-points","Discovering Plugins with Entry Points in Python CLIs",{"path":2265,"title":2266},"\u002Fmodern-python-cli-frameworks-architecture\u002Fplugin-architectures-for-extensible-clis\u002Fhook-based-plugins-with-pluggy","Hook-Based Plugins for Python CLIs with pluggy",{"path":2268,"title":2269},"\u002Fmodern-python-cli-frameworks-architecture\u002Fplugin-architectures-for-extensible-clis","Plugin Architectures for Extensible CLIs",{"path":2271,"title":2272},"\u002Fmodern-python-cli-frameworks-architecture\u002Fplugin-architectures-for-extensible-clis\u002Fversioning-a-plugin-api","Versioning a Plugin API for a Python CLI",{"path":2274,"title":2275},"\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":2277,"title":2278},"\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":2280,"title":2281},"\u002Fmodern-python-cli-frameworks-architecture\u002Fstructuring-multi-command-python-clis\u002Fdependency-injection-patterns-for-cli-commands","Dependency Injection Patterns for CLI Commands",{"path":2283,"title":2284},"\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":2286,"title":2287},"\u002Fmodern-python-cli-frameworks-architecture\u002Fstructuring-multi-command-python-clis","Structuring Multi-Command Python CLIs",{"path":2289,"title":2290},"\u002Fmodern-python-cli-frameworks-architecture\u002Fstructuring-multi-command-python-clis\u002Fsharing-common-options-across-commands","Sharing Common Options Across Python CLI Commands",{"path":2292,"title":2293},"\u002Fmodern-python-cli-frameworks-architecture\u002Fstructuring-multi-command-python-clis\u002Fsharing-state-with-click-context-objects","Sharing State with Click Context Objects",{"path":2295,"title":2296},"\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":2298,"title":2299},"\u002Fmodern-python-cli-frameworks-architecture\u002Ftesting-python-cli-applications","Testing Python CLI Applications",{"path":2301,"title":2302},"\u002Fmodern-python-cli-frameworks-architecture\u002Ftesting-python-cli-applications\u002Fmeasuring-cli-test-coverage","Measuring CLI Test Coverage",{"path":2304,"title":2305},"\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":2307,"title":2308},"\u002Fmodern-python-cli-frameworks-architecture\u002Ftesting-python-cli-applications\u002Fproperty-based-testing-cli-arguments-with-hypothesis","Property-Based Testing CLI Arguments with Hypothesis",{"path":2310,"title":2311},"\u002Fmodern-python-cli-frameworks-architecture\u002Ftesting-python-cli-applications\u002Fsnapshot-testing-cli-output","Snapshot Testing CLI Output",{"path":2313,"title":2314},"\u002Fmodern-python-cli-frameworks-architecture\u002Ftesting-python-cli-applications\u002Ftesting-click-commands-with-clirunner","Testing Click Commands with CliRunner",{"path":2316,"title":2317},"\u002Fmodern-python-cli-frameworks-architecture\u002Ftesting-python-cli-applications\u002Ftesting-interactive-prompts-and-stdin","Testing Interactive Prompts and stdin",{"path":2319,"title":2320},"\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":2322,"title":2323},"\u002Fmodern-python-cli-frameworks-architecture\u002Ftyper-vs-click-when-to-use-each\u002Fbuilding-dynamic-commands-in-click","Building Dynamic Commands in Click",{"path":2325,"title":2326},"\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":2328,"title":2329},"\u002Fmodern-python-cli-frameworks-architecture\u002Ftyper-vs-click-when-to-use-each","Typer vs Click: When to Use Each",{"path":2331,"title":2332},"\u002Fmodern-python-cli-frameworks-architecture\u002Ftyper-vs-click-when-to-use-each\u002Ftyper-callback-functions-explained","Typer callback functions explained",{"path":2334,"title":2335},"\u002Fmodern-python-cli-frameworks-architecture\u002Ftyper-vs-click-when-to-use-each\u002Fusing-annotated-options-in-typer","Using Annotated Options in Typer",{"path":2337,"title":2338},"\u002Fproject-setup-dependency-management\u002Fci-cd-pipelines-for-python-clis\u002Fautomating-releases-from-git-tags","Automating Python CLI Releases from Git Tags",{"path":2340,"title":2341},"\u002Fproject-setup-dependency-management\u002Fci-cd-pipelines-for-python-clis\u002Fcaching-uv-dependencies-in-ci","Caching uv Dependencies in CI for Python CLIs",{"path":2343,"title":2344},"\u002Fproject-setup-dependency-management\u002Fci-cd-pipelines-for-python-clis","CI\u002FCD Pipelines for Python CLIs",{"path":2346,"title":2347},"\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":2349,"title":2350},"\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":2352,"title":2353},"\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":2355,"title":2356},"\u002Fproject-setup-dependency-management\u002Fcli-project-scaffolding-with-cookiecutter\u002Fbuilding-a-cookiecutter-template-for-typer-clis","Building a Cookiecutter Template for Typer CLIs",{"path":2358,"title":2359},"\u002Fproject-setup-dependency-management\u002Fcli-project-scaffolding-with-cookiecutter\u002Fcopier-vs-cookiecutter-for-cli-templates","Copier vs Cookiecutter for CLI Templates",{"path":2361,"title":2362},"\u002Fproject-setup-dependency-management\u002Fcli-project-scaffolding-with-cookiecutter","CLI Project Scaffolding with Cookiecutter",{"path":2364,"title":2365},"\u002Fproject-setup-dependency-management\u002Fcli-project-scaffolding-with-cookiecutter\u002Fpost-generation-hooks-in-cli-templates","Post-Generation Hooks in Python CLI Templates",{"path":2367,"title":2368},"\u002Fproject-setup-dependency-management\u002Fdistributing-clis-as-standalone-binaries\u002Fbuilding-cross-platform-release-binaries-in-ci","Building Cross-Platform Release Binaries in CI",{"path":2370,"title":2371},"\u002Fproject-setup-dependency-management\u002Fdistributing-clis-as-standalone-binaries\u002Fbundling-a-python-cli-with-pyinstaller","Bundling a Python CLI with PyInstaller",{"path":2373,"title":2374},"\u002Fproject-setup-dependency-management\u002Fdistributing-clis-as-standalone-binaries\u002Fhomebrew-and-scoop-packaging-for-python-clis","Homebrew and Scoop Packaging for Python CLIs",{"path":2376,"title":2377},"\u002Fproject-setup-dependency-management\u002Fdistributing-clis-as-standalone-binaries","Distributing CLIs as Standalone Binaries",{"path":2379,"title":2380},"\u002Fproject-setup-dependency-management\u002Fdistributing-clis-as-standalone-binaries\u002Fnuitka-vs-pyinstaller-for-python-clis","Nuitka vs PyInstaller for Python CLI Binaries",{"path":2382,"title":2383},"\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":2385,"title":2386},"\u002Fproject-setup-dependency-management","Project Setup & Dependency Management",{"path":2388,"title":2389},"\u002Fproject-setup-dependency-management\u002Flinting-and-type-checking-cli-code\u002Fconfiguring-ruff-for-a-cli-project","Configuring Ruff for a Python CLI Project",{"path":2391,"title":2392},"\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":2394,"title":2395},"\u002Fproject-setup-dependency-management\u002Flinting-and-type-checking-cli-code","Linting and Type-Checking Python CLI Code",{"path":2397,"title":2398},"\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":2400,"title":2401},"\u002Fproject-setup-dependency-management\u002Fmanaging-cli-versioning-changelogs\u002Fautomating-changelogs-with-conventional-commits","Automating Changelogs with Conventional Commits",{"path":2403,"title":2404},"\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":2406,"title":2407},"\u002Fproject-setup-dependency-management\u002Fmanaging-cli-versioning-changelogs\u002Fexposing-version-info-and-build-metadata","Exposing Version Info and Build Metadata",{"path":2409,"title":2410},"\u002Fproject-setup-dependency-management\u002Fmanaging-cli-versioning-changelogs","Managing CLI Versioning & Changelogs",{"path":2412,"title":2413},"\u002Fproject-setup-dependency-management\u002Fmanaging-cli-versioning-changelogs\u002Fsemantic-versioning-policy-for-cli-tools","A Semantic Versioning Policy for CLI Tools",{"path":2415,"title":2416},"\u002Fproject-setup-dependency-management\u002Fpackaging-python-clis-for-distribution\u002Fbuilding-wheels-and-sdists-for-python-clis","Building Wheels and sdists for Python CLIs",{"path":2418,"title":2419},"\u002Fproject-setup-dependency-management\u002Fpackaging-python-clis-for-distribution\u002Fbundling-data-files-with-importlib-resources","Bundling Data Files with importlib.resources in CLIs",{"path":2421,"title":2422},"\u002Fproject-setup-dependency-management\u002Fpackaging-python-clis-for-distribution","Packaging Python CLIs for Distribution",{"path":2424,"title":2425},"\u002Fproject-setup-dependency-management\u002Fpackaging-python-clis-for-distribution\u002Finstalling-and-distributing-clis-with-pipx","Installing and Distributing CLIs with pipx",{"path":2427,"title":2428},"\u002Fproject-setup-dependency-management\u002Fpackaging-python-clis-for-distribution\u002Fpublishing-a-python-cli-to-pypi","Publishing a Python CLI to PyPI",{"path":2430,"title":2431},"\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":2433,"title":2434},"\u002Fproject-setup-dependency-management\u002Fpoetry-workflows-for-cli-development","Poetry Workflows for CLI Development",{"path":2436,"title":2437},"\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":2439,"title":2440},"\u002Fproject-setup-dependency-management\u002Fpoetry-workflows-for-cli-development\u002Fpoetry-dependency-groups-for-cli-tooling","Poetry Dependency Groups for CLI Tooling",{"path":2442,"title":2443},"\u002Fproject-setup-dependency-management\u002Fpoetry-workflows-for-cli-development\u002Fpoetry-entry-points-and-scripts-for-clis","Poetry Entry Points and Scripts for CLIs",{"path":2445,"title":2446},"\u002Fproject-setup-dependency-management\u002Fpre-commit-hooks-for-cli-projects","Pre-commit Hooks for CLI Projects",{"path":2448,"title":2449},"\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":2451,"title":2452},"\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":2454,"title":2455},"\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":2457,"title":2458},"\u002Fproject-setup-dependency-management\u002Fuv-for-python-cli-dependency-management","uv for Python CLI Dependency Management",{"path":2460,"title":2461},"\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":2463,"title":2464},"\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":2466,"title":2467},"\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":2469,"title":2470},"\u002Fproject-setup-dependency-management\u002Fuv-for-python-cli-dependency-management\u002Fuv-workspaces-for-multi-package-clis","uv Workspaces for Multi-Package Python CLIs",{"path":2472,"title":2473},"\u002Fproject-setup-dependency-management\u002Fvirtual-environments-isolation-best-practices","Python CLI Env Isolation Best Practices",{"path":2475,"title":2476},"\u002Fproject-setup-dependency-management\u002Fvirtual-environments-isolation-best-practices\u002Fmanaging-virtual-environments-for-cross-platform-clis","Managing Python CLI Virtual Environments",{"path":2478,"title":2479},"\u002Fproject-setup-dependency-management\u002Fvirtual-environments-isolation-best-practices\u002Fpinning-the-python-version-for-a-cli","Pinning the Python Version for a CLI",{"path":2481,"title":2482},"\u002Fproject-setup-dependency-management\u002Fvirtual-environments-isolation-best-practices\u002Fsupporting-multiple-python-versions-with-nox","Supporting Multiple Python Versions with nox",1789736905043]