[{"data":1,"prerenderedAt":3077},["ShallowReactive",2],{"page-\u002Fcli-runtime-systems-integration\u002Fconcurrency-and-async-in-python-clis\u002Fparallelising-cli-work-with-thread-pools\u002F":3,"content-directory":2530},{"id":4,"title":5,"body":6,"date":2515,"description":2516,"difficulty":2517,"draft":2518,"extension":2519,"meta":2520,"navigation":158,"path":2521,"seo":2522,"stem":2523,"tags":2524,"updated":2515,"__hash__":2529},"content\u002Fcli-runtime-systems-integration\u002Fconcurrency-and-async-in-python-clis\u002Fparallelising-cli-work-with-thread-pools\u002Findex.md","Parallelising CLI Work with Thread Pools",{"type":7,"value":8,"toc":2494},"minimark",[9,19,24,56,60,75,79,86,89,92,110,114,117,937,1510,1515,1533,1547,1559,1576,1582,1589,1592,1607,1611,1658,1662,1669,2368,2377,2381,2394,2398,2406,2409,2417,2420,2424,2440,2444,2456,2460,2490],[10,11,12,13,18],"p",{},"Your command loops over a list — files to upload, hosts to check, repositories to clone, API records to fetch — and each iteration spends most of its time waiting on the network or disk. With 400 items at 300 ms each, the user waits two minutes while the CPU sits idle. A thread pool is the smallest change that fixes it: your existing synchronous code runs in several threads at once, and blocking I\u002FO releases Python's global interpreter lock so the waits overlap. Done carelessly, though, it produces interleaved output, loses exceptions, ignores Ctrl+C and hammers whatever it talks to. This guide builds a thread-pool pattern for CLI commands that is bounded, reports progress, collects every failure, stops cleanly and prints deterministic results. It is part of the ",[14,15,17],"a",{"href":16},"\u002Fcli-runtime-systems-integration\u002Fconcurrency-and-async-in-python-clis\u002F","concurrency and async topic",".",[20,21,23],"h2",{"id":22},"prerequisites","Prerequisites",[25,26,27,31,44],"ul",{},[28,29,30],"li",{},"Python 3.10+, Typer and Rich.",[28,32,33,34,38,39,43],{},"Work that is ",[35,36,37],"strong",{},"I\u002FO-bound",": network calls, subprocesses, file operations. For CPU-bound Python, see ",[14,40,42],{"href":41},"\u002Fcli-runtime-systems-integration\u002Fconcurrency-and-async-in-python-clis\u002Fmultiprocessing-for-cpu-bound-cli-tasks\u002F","multiprocessing for CPU-bound CLI tasks"," instead.",[28,45,46,47,51,52,55],{},"Thread-safe clients for anything shared between workers. ",[48,49,50],"code",{},"httpx.Client",", ",[48,53,54],{},"logging"," and Rich consoles are; many SDK clients and database connections are not.",[20,57,59],{"id":58},"how-a-pool-works","How a pool works",[10,61,62,63,66,67,70,71,74],{},"A ",[48,64,65],{},"ThreadPoolExecutor"," starts a fixed number of worker threads and a queue. Each ",[48,68,69],{},"submit()"," puts a call on the queue and returns a ",[48,72,73],{},"Future"," immediately; workers pull calls off the queue and run them; the future completes with the return value or the exception.",[76,77],"inline-diagram",{"name":78},"cc-threadpool-flow",[10,80,81,82,85],{},"The pool size is your concurrency limit: with ",[48,83,84],{},"max_workers=8",", at most eight items are in progress at any moment, however many you submit. That is the property that keeps you from opening 400 connections at once.",[10,87,88],{},"There are two ways to get results back, and for CLIs the choice matters:",[76,90],{"name":91},"cc-map-vs-completed",[10,93,94,97,98,101,102,105,106,109],{},[48,95,96],{},"executor.map(fn, items)"," is a one-liner that yields results ",[35,99,100],{},"in input order",". If item 3 is slow, results for items 4–400 wait behind it, so a progress bar jumps in bursts; and the first exception is raised when the iteration reaches it, abandoning the rest. ",[48,103,104],{},"as_completed(futures)"," yields futures ",[35,107,108],{},"as they finish",", which gives smooth progress and lets you handle each failure individually. It is the better default for commands.",[20,111,113],{"id":112},"the-recipe","The recipe",[10,115,116],{},"The example command uploads every file in a directory to an HTTP endpoint. The same structure fits any per-item I\u002FO task.",[118,119,124],"pre",{"className":120,"code":121,"language":122,"meta":123,"style":123},"language-python shiki shiki-themes github-light github-dark","# src\u002Fmytool\u002Fupload.py\nfrom __future__ import annotations\n\nimport threading\nfrom concurrent.futures import Future, ThreadPoolExecutor, as_completed\nfrom dataclasses import dataclass\nfrom pathlib import Path\n\nimport httpx\nfrom rich.progress import BarColumn, MofNCompleteColumn, Progress, TextColumn, TimeElapsedColumn\n\n\n@dataclass(frozen=True)\nclass Result:\n    path: Path\n    status: int | None = None\n    error: str | None = None\n\n\ndef upload_one(client: httpx.Client, base: Path, path: Path, stop: threading.Event) -> Result:\n    if stop.is_set():                       # cancelled while queued behind others\n        return Result(path, error=\"cancelled\")\n    try:\n        with path.open(\"rb\") as fh:\n            r = client.put(f\"\u002Ffiles\u002F{path.relative_to(base).as_posix()}\", content=fh)\n        r.raise_for_status()\n        return Result(path, status=r.status_code)\n    except (httpx.HTTPError, OSError) as exc:\n        return Result(path, error=str(exc) or type(exc).__name__)\n\n\ndef upload_all(client: httpx.Client, base: Path, files: list[Path], *,\n               jobs: int, show_progress: bool) -> list[Result]:\n    results: list[Result] = []\n    stop = threading.Event()\n    progress = Progress(TextColumn(\"uploading\"), BarColumn(), MofNCompleteColumn(),\n                        TextColumn(\"[red]{task.fields[failed]} failed\"), TimeElapsedColumn(),\n                        disable=not show_progress, transient=True)\n    with progress, ThreadPoolExecutor(max_workers=jobs, thread_name_prefix=\"upload\") as pool:\n        task = progress.add_task(\"upload\", total=len(files), failed=0)\n        futures: dict[Future[Result], Path] = {\n            pool.submit(upload_one, client, base, f, stop): f for f in files\n        }\n        failed = 0\n        try:\n            for future in as_completed(futures):\n                result = future.result()     # upload_one never raises for item errors\n                results.append(result)\n                if result.error:\n                    failed += 1\n                    progress.console.print(f\"[red]✗[\u002Fred] {result.path}: {result.error}\")\n                progress.update(task, advance=1, failed=failed)\n        except KeyboardInterrupt:\n            stop.set()\n            pool.shutdown(wait=True, cancel_futures=True)\n            raise\n    return sorted(results, key=lambda r: r.path)\n","python","",[48,125,126,135,153,160,169,182,195,208,213,221,234,239,244,267,279,285,306,323,328,333,345,357,377,385,406,445,451,466,485,515,520,525,542,559,570,581,598,616,637,669,705,716,734,740,751,759,773,787,793,802,814,846,869,880,886,910,916],{"__ignoreMap":123},[127,128,131],"span",{"class":129,"line":130},"line",1,[127,132,134],{"class":133},"sJ8bj","# src\u002Fmytool\u002Fupload.py\n",[127,136,138,142,146,149],{"class":129,"line":137},2,[127,139,141],{"class":140},"szBVR","from",[127,143,145],{"class":144},"sj4cs"," __future__",[127,147,148],{"class":140}," import",[127,150,152],{"class":151},"sVt8B"," annotations\n",[127,154,156],{"class":129,"line":155},3,[127,157,159],{"emptyLinePlaceholder":158},true,"\n",[127,161,163,166],{"class":129,"line":162},4,[127,164,165],{"class":140},"import",[127,167,168],{"class":151}," threading\n",[127,170,172,174,177,179],{"class":129,"line":171},5,[127,173,141],{"class":140},[127,175,176],{"class":151}," concurrent.futures ",[127,178,165],{"class":140},[127,180,181],{"class":151}," Future, ThreadPoolExecutor, as_completed\n",[127,183,185,187,190,192],{"class":129,"line":184},6,[127,186,141],{"class":140},[127,188,189],{"class":151}," dataclasses ",[127,191,165],{"class":140},[127,193,194],{"class":151}," dataclass\n",[127,196,198,200,203,205],{"class":129,"line":197},7,[127,199,141],{"class":140},[127,201,202],{"class":151}," pathlib ",[127,204,165],{"class":140},[127,206,207],{"class":151}," Path\n",[127,209,211],{"class":129,"line":210},8,[127,212,159],{"emptyLinePlaceholder":158},[127,214,216,218],{"class":129,"line":215},9,[127,217,165],{"class":140},[127,219,220],{"class":151}," httpx\n",[127,222,224,226,229,231],{"class":129,"line":223},10,[127,225,141],{"class":140},[127,227,228],{"class":151}," rich.progress ",[127,230,165],{"class":140},[127,232,233],{"class":151}," BarColumn, MofNCompleteColumn, Progress, TextColumn, TimeElapsedColumn\n",[127,235,237],{"class":129,"line":236},11,[127,238,159],{"emptyLinePlaceholder":158},[127,240,242],{"class":129,"line":241},12,[127,243,159],{"emptyLinePlaceholder":158},[127,245,247,251,254,258,261,264],{"class":129,"line":246},13,[127,248,250],{"class":249},"sScJk","@dataclass",[127,252,253],{"class":151},"(",[127,255,257],{"class":256},"s4XuR","frozen",[127,259,260],{"class":140},"=",[127,262,263],{"class":144},"True",[127,265,266],{"class":151},")\n",[127,268,270,273,276],{"class":129,"line":269},14,[127,271,272],{"class":140},"class",[127,274,275],{"class":249}," Result",[127,277,278],{"class":151},":\n",[127,280,282],{"class":129,"line":281},15,[127,283,284],{"class":151},"    path: Path\n",[127,286,288,291,294,297,300,303],{"class":129,"line":287},16,[127,289,290],{"class":151},"    status: ",[127,292,293],{"class":144},"int",[127,295,296],{"class":140}," |",[127,298,299],{"class":144}," None",[127,301,302],{"class":140}," =",[127,304,305],{"class":144}," None\n",[127,307,309,312,315,317,319,321],{"class":129,"line":308},17,[127,310,311],{"class":151},"    error: ",[127,313,314],{"class":144},"str",[127,316,296],{"class":140},[127,318,299],{"class":144},[127,320,302],{"class":140},[127,322,305],{"class":144},[127,324,326],{"class":129,"line":325},18,[127,327,159],{"emptyLinePlaceholder":158},[127,329,331],{"class":129,"line":330},19,[127,332,159],{"emptyLinePlaceholder":158},[127,334,336,339,342],{"class":129,"line":335},20,[127,337,338],{"class":140},"def",[127,340,341],{"class":249}," upload_one",[127,343,344],{"class":151},"(client: httpx.Client, base: Path, path: Path, stop: threading.Event) -> Result:\n",[127,346,348,351,354],{"class":129,"line":347},21,[127,349,350],{"class":140},"    if",[127,352,353],{"class":151}," stop.is_set():                       ",[127,355,356],{"class":133},"# cancelled while queued behind others\n",[127,358,360,363,366,369,371,375],{"class":129,"line":359},22,[127,361,362],{"class":140},"        return",[127,364,365],{"class":151}," Result(path, ",[127,367,368],{"class":256},"error",[127,370,260],{"class":140},[127,372,374],{"class":373},"sZZnC","\"cancelled\"",[127,376,266],{"class":151},[127,378,380,383],{"class":129,"line":379},23,[127,381,382],{"class":140},"    try",[127,384,278],{"class":151},[127,386,388,391,394,397,400,403],{"class":129,"line":387},24,[127,389,390],{"class":140},"        with",[127,392,393],{"class":151}," path.open(",[127,395,396],{"class":373},"\"rb\"",[127,398,399],{"class":151},") ",[127,401,402],{"class":140},"as",[127,404,405],{"class":151}," fh:\n",[127,407,409,412,414,417,420,423,426,429,432,435,437,440,442],{"class":129,"line":408},25,[127,410,411],{"class":151},"            r ",[127,413,260],{"class":140},[127,415,416],{"class":151}," client.put(",[127,418,419],{"class":140},"f",[127,421,422],{"class":373},"\"\u002Ffiles\u002F",[127,424,425],{"class":144},"{",[127,427,428],{"class":151},"path.relative_to(base).as_posix()",[127,430,431],{"class":144},"}",[127,433,434],{"class":373},"\"",[127,436,51],{"class":151},[127,438,439],{"class":256},"content",[127,441,260],{"class":140},[127,443,444],{"class":151},"fh)\n",[127,446,448],{"class":129,"line":447},26,[127,449,450],{"class":151},"        r.raise_for_status()\n",[127,452,454,456,458,461,463],{"class":129,"line":453},27,[127,455,362],{"class":140},[127,457,365],{"class":151},[127,459,460],{"class":256},"status",[127,462,260],{"class":140},[127,464,465],{"class":151},"r.status_code)\n",[127,467,469,472,475,478,480,482],{"class":129,"line":468},28,[127,470,471],{"class":140},"    except",[127,473,474],{"class":151}," (httpx.HTTPError, ",[127,476,477],{"class":144},"OSError",[127,479,399],{"class":151},[127,481,402],{"class":140},[127,483,484],{"class":151}," exc:\n",[127,486,488,490,492,494,496,498,501,504,507,510,513],{"class":129,"line":487},29,[127,489,362],{"class":140},[127,491,365],{"class":151},[127,493,368],{"class":256},[127,495,260],{"class":140},[127,497,314],{"class":144},[127,499,500],{"class":151},"(exc) ",[127,502,503],{"class":140},"or",[127,505,506],{"class":144}," type",[127,508,509],{"class":151},"(exc).",[127,511,512],{"class":144},"__name__",[127,514,266],{"class":151},[127,516,518],{"class":129,"line":517},30,[127,519,159],{"emptyLinePlaceholder":158},[127,521,523],{"class":129,"line":522},31,[127,524,159],{"emptyLinePlaceholder":158},[127,526,528,530,533,536,539],{"class":129,"line":527},32,[127,529,338],{"class":140},[127,531,532],{"class":249}," upload_all",[127,534,535],{"class":151},"(client: httpx.Client, base: Path, files: list[Path], ",[127,537,538],{"class":140},"*",[127,540,541],{"class":151},",\n",[127,543,545,548,550,553,556],{"class":129,"line":544},33,[127,546,547],{"class":151},"               jobs: ",[127,549,293],{"class":144},[127,551,552],{"class":151},", show_progress: ",[127,554,555],{"class":144},"bool",[127,557,558],{"class":151},") -> list[Result]:\n",[127,560,562,565,567],{"class":129,"line":561},34,[127,563,564],{"class":151},"    results: list[Result] ",[127,566,260],{"class":140},[127,568,569],{"class":151}," []\n",[127,571,573,576,578],{"class":129,"line":572},35,[127,574,575],{"class":151},"    stop ",[127,577,260],{"class":140},[127,579,580],{"class":151}," threading.Event()\n",[127,582,584,587,589,592,595],{"class":129,"line":583},36,[127,585,586],{"class":151},"    progress ",[127,588,260],{"class":140},[127,590,591],{"class":151}," Progress(TextColumn(",[127,593,594],{"class":373},"\"uploading\"",[127,596,597],{"class":151},"), BarColumn(), MofNCompleteColumn(),\n",[127,599,601,604,607,610,613],{"class":129,"line":600},37,[127,602,603],{"class":151},"                        TextColumn(",[127,605,606],{"class":373},"\"[red]",[127,608,609],{"class":144},"{task.fields[failed]}",[127,611,612],{"class":373}," failed\"",[127,614,615],{"class":151},"), TimeElapsedColumn(),\n",[127,617,619,622,625,628,631,633,635],{"class":129,"line":618},38,[127,620,621],{"class":256},"                        disable",[127,623,624],{"class":140},"=not",[127,626,627],{"class":151}," show_progress, ",[127,629,630],{"class":256},"transient",[127,632,260],{"class":140},[127,634,263],{"class":144},[127,636,266],{"class":151},[127,638,640,643,646,649,651,654,657,659,662,664,666],{"class":129,"line":639},39,[127,641,642],{"class":140},"    with",[127,644,645],{"class":151}," progress, ThreadPoolExecutor(",[127,647,648],{"class":256},"max_workers",[127,650,260],{"class":140},[127,652,653],{"class":151},"jobs, ",[127,655,656],{"class":256},"thread_name_prefix",[127,658,260],{"class":140},[127,660,661],{"class":373},"\"upload\"",[127,663,399],{"class":151},[127,665,402],{"class":140},[127,667,668],{"class":151}," pool:\n",[127,670,672,675,677,680,682,684,687,689,692,695,698,700,703],{"class":129,"line":671},40,[127,673,674],{"class":151},"        task ",[127,676,260],{"class":140},[127,678,679],{"class":151}," progress.add_task(",[127,681,661],{"class":373},[127,683,51],{"class":151},[127,685,686],{"class":256},"total",[127,688,260],{"class":140},[127,690,691],{"class":144},"len",[127,693,694],{"class":151},"(files), ",[127,696,697],{"class":256},"failed",[127,699,260],{"class":140},[127,701,702],{"class":144},"0",[127,704,266],{"class":151},[127,706,708,711,713],{"class":129,"line":707},41,[127,709,710],{"class":151},"        futures: dict[Future[Result], Path] ",[127,712,260],{"class":140},[127,714,715],{"class":151}," {\n",[127,717,719,722,725,728,731],{"class":129,"line":718},42,[127,720,721],{"class":151},"            pool.submit(upload_one, client, base, f, stop): f ",[127,723,724],{"class":140},"for",[127,726,727],{"class":151}," f ",[127,729,730],{"class":140},"in",[127,732,733],{"class":151}," files\n",[127,735,737],{"class":129,"line":736},43,[127,738,739],{"class":151},"        }\n",[127,741,743,746,748],{"class":129,"line":742},44,[127,744,745],{"class":151},"        failed ",[127,747,260],{"class":140},[127,749,750],{"class":144}," 0\n",[127,752,754,757],{"class":129,"line":753},45,[127,755,756],{"class":140},"        try",[127,758,278],{"class":151},[127,760,762,765,768,770],{"class":129,"line":761},46,[127,763,764],{"class":140},"            for",[127,766,767],{"class":151}," future ",[127,769,730],{"class":140},[127,771,772],{"class":151}," as_completed(futures):\n",[127,774,776,779,781,784],{"class":129,"line":775},47,[127,777,778],{"class":151},"                result ",[127,780,260],{"class":140},[127,782,783],{"class":151}," future.result()     ",[127,785,786],{"class":133},"# upload_one never raises for item errors\n",[127,788,790],{"class":129,"line":789},48,[127,791,792],{"class":151},"                results.append(result)\n",[127,794,796,799],{"class":129,"line":795},49,[127,797,798],{"class":140},"                if",[127,800,801],{"class":151}," result.error:\n",[127,803,805,808,811],{"class":129,"line":804},50,[127,806,807],{"class":151},"                    failed ",[127,809,810],{"class":140},"+=",[127,812,813],{"class":144}," 1\n",[127,815,817,820,822,825,827,830,832,835,837,840,842,844],{"class":129,"line":816},51,[127,818,819],{"class":151},"                    progress.console.print(",[127,821,419],{"class":140},[127,823,824],{"class":373},"\"[red]✗[\u002Fred] ",[127,826,425],{"class":144},[127,828,829],{"class":151},"result.path",[127,831,431],{"class":144},[127,833,834],{"class":373},": ",[127,836,425],{"class":144},[127,838,839],{"class":151},"result.error",[127,841,431],{"class":144},[127,843,434],{"class":373},[127,845,266],{"class":151},[127,847,849,852,855,857,860,862,864,866],{"class":129,"line":848},52,[127,850,851],{"class":151},"                progress.update(task, ",[127,853,854],{"class":256},"advance",[127,856,260],{"class":140},[127,858,859],{"class":144},"1",[127,861,51],{"class":151},[127,863,697],{"class":256},[127,865,260],{"class":140},[127,867,868],{"class":151},"failed)\n",[127,870,872,875,878],{"class":129,"line":871},53,[127,873,874],{"class":140},"        except",[127,876,877],{"class":144}," KeyboardInterrupt",[127,879,278],{"class":151},[127,881,883],{"class":129,"line":882},54,[127,884,885],{"class":151},"            stop.set()\n",[127,887,889,892,895,897,899,901,904,906,908],{"class":129,"line":888},55,[127,890,891],{"class":151},"            pool.shutdown(",[127,893,894],{"class":256},"wait",[127,896,260],{"class":140},[127,898,263],{"class":144},[127,900,51],{"class":151},[127,902,903],{"class":256},"cancel_futures",[127,905,260],{"class":140},[127,907,263],{"class":144},[127,909,266],{"class":151},[127,911,913],{"class":129,"line":912},56,[127,914,915],{"class":140},"            raise\n",[127,917,919,922,925,928,931,934],{"class":129,"line":918},57,[127,920,921],{"class":140},"    return",[127,923,924],{"class":144}," sorted",[127,926,927],{"class":151},"(results, ",[127,929,930],{"class":256},"key",[127,932,933],{"class":140},"=lambda",[127,935,936],{"class":151}," r: r.path)\n",[118,938,940],{"className":120,"code":939,"language":122,"meta":123,"style":123},"# src\u002Fmytool\u002Fcli.py\nimport sys\nfrom pathlib import Path\n\nimport httpx\nimport typer\n\nfrom mytool.upload import upload_all\n\napp = typer.Typer()\n\n\n@app.callback()\ndef main() -> None:\n    \"\"\"Artefact tools.\"\"\"\n\n\n@app.command()\ndef upload(\n    directory: Path = typer.Argument(..., exists=True, file_okay=False),\n    jobs: int = typer.Option(8, \"--jobs\", \"-j\", min=1, max=64, help=\"Uploads in parallel.\"),\n    server: str = typer.Option(\"https:\u002F\u002Ffiles.example.com\", envvar=\"MYTOOL_SERVER\"),\n) -> None:\n    \"\"\"Upload every file under DIRECTORY.\"\"\"\n    files = sorted(p for p in directory.rglob(\"*\") if p.is_file())\n    limits = httpx.Limits(max_connections=jobs, max_keepalive_connections=jobs)\n    with httpx.Client(base_url=server, limits=limits, timeout=httpx.Timeout(60.0, connect=5.0)) as client:\n        try:\n            results = upload_all(client, directory, files, jobs=jobs, show_progress=sys.stderr.isatty())\n        except KeyboardInterrupt:\n            typer.echo(\"interrupted — files already uploaded are kept\", err=True)\n            raise typer.Exit(130)\n    failed = [r for r in results if r.error]\n    typer.echo(f\"uploaded {len(results) - len(failed)}\u002F{len(files)} files\", err=True)\n    raise typer.Exit(1 if failed else 0)\n\n\nif __name__ == \"__main__\":\n    app()\n",[48,941,942,947,954,964,968,974,981,985,997,1001,1011,1015,1019,1027,1042,1047,1051,1055,1062,1072,1107,1163,1189,1198,1203,1236,1261,1313,1319,1344,1352,1371,1384,1409,1459,1482,1486,1490,1505],{"__ignoreMap":123},[127,943,944],{"class":129,"line":130},[127,945,946],{"class":133},"# src\u002Fmytool\u002Fcli.py\n",[127,948,949,951],{"class":129,"line":137},[127,950,165],{"class":140},[127,952,953],{"class":151}," sys\n",[127,955,956,958,960,962],{"class":129,"line":155},[127,957,141],{"class":140},[127,959,202],{"class":151},[127,961,165],{"class":140},[127,963,207],{"class":151},[127,965,966],{"class":129,"line":162},[127,967,159],{"emptyLinePlaceholder":158},[127,969,970,972],{"class":129,"line":171},[127,971,165],{"class":140},[127,973,220],{"class":151},[127,975,976,978],{"class":129,"line":184},[127,977,165],{"class":140},[127,979,980],{"class":151}," typer\n",[127,982,983],{"class":129,"line":197},[127,984,159],{"emptyLinePlaceholder":158},[127,986,987,989,992,994],{"class":129,"line":210},[127,988,141],{"class":140},[127,990,991],{"class":151}," mytool.upload ",[127,993,165],{"class":140},[127,995,996],{"class":151}," upload_all\n",[127,998,999],{"class":129,"line":215},[127,1000,159],{"emptyLinePlaceholder":158},[127,1002,1003,1006,1008],{"class":129,"line":223},[127,1004,1005],{"class":151},"app ",[127,1007,260],{"class":140},[127,1009,1010],{"class":151}," typer.Typer()\n",[127,1012,1013],{"class":129,"line":236},[127,1014,159],{"emptyLinePlaceholder":158},[127,1016,1017],{"class":129,"line":241},[127,1018,159],{"emptyLinePlaceholder":158},[127,1020,1021,1024],{"class":129,"line":246},[127,1022,1023],{"class":249},"@app.callback",[127,1025,1026],{"class":151},"()\n",[127,1028,1029,1031,1034,1037,1040],{"class":129,"line":269},[127,1030,338],{"class":140},[127,1032,1033],{"class":249}," main",[127,1035,1036],{"class":151},"() -> ",[127,1038,1039],{"class":144},"None",[127,1041,278],{"class":151},[127,1043,1044],{"class":129,"line":281},[127,1045,1046],{"class":373},"    \"\"\"Artefact tools.\"\"\"\n",[127,1048,1049],{"class":129,"line":287},[127,1050,159],{"emptyLinePlaceholder":158},[127,1052,1053],{"class":129,"line":308},[127,1054,159],{"emptyLinePlaceholder":158},[127,1056,1057,1060],{"class":129,"line":325},[127,1058,1059],{"class":249},"@app.command",[127,1061,1026],{"class":151},[127,1063,1064,1066,1069],{"class":129,"line":330},[127,1065,338],{"class":140},[127,1067,1068],{"class":249}," upload",[127,1070,1071],{"class":151},"(\n",[127,1073,1074,1077,1079,1082,1085,1087,1090,1092,1094,1096,1099,1101,1104],{"class":129,"line":335},[127,1075,1076],{"class":151},"    directory: Path ",[127,1078,260],{"class":140},[127,1080,1081],{"class":151}," typer.Argument(",[127,1083,1084],{"class":144},"...",[127,1086,51],{"class":151},[127,1088,1089],{"class":256},"exists",[127,1091,260],{"class":140},[127,1093,263],{"class":144},[127,1095,51],{"class":151},[127,1097,1098],{"class":256},"file_okay",[127,1100,260],{"class":140},[127,1102,1103],{"class":144},"False",[127,1105,1106],{"class":151},"),\n",[127,1108,1109,1112,1114,1116,1119,1122,1124,1127,1129,1132,1134,1137,1139,1141,1143,1146,1148,1151,1153,1156,1158,1161],{"class":129,"line":347},[127,1110,1111],{"class":151},"    jobs: ",[127,1113,293],{"class":144},[127,1115,302],{"class":140},[127,1117,1118],{"class":151}," typer.Option(",[127,1120,1121],{"class":144},"8",[127,1123,51],{"class":151},[127,1125,1126],{"class":373},"\"--jobs\"",[127,1128,51],{"class":151},[127,1130,1131],{"class":373},"\"-j\"",[127,1133,51],{"class":151},[127,1135,1136],{"class":256},"min",[127,1138,260],{"class":140},[127,1140,859],{"class":144},[127,1142,51],{"class":151},[127,1144,1145],{"class":256},"max",[127,1147,260],{"class":140},[127,1149,1150],{"class":144},"64",[127,1152,51],{"class":151},[127,1154,1155],{"class":256},"help",[127,1157,260],{"class":140},[127,1159,1160],{"class":373},"\"Uploads in parallel.\"",[127,1162,1106],{"class":151},[127,1164,1165,1168,1170,1172,1174,1177,1179,1182,1184,1187],{"class":129,"line":359},[127,1166,1167],{"class":151},"    server: ",[127,1169,314],{"class":144},[127,1171,302],{"class":140},[127,1173,1118],{"class":151},[127,1175,1176],{"class":373},"\"https:\u002F\u002Ffiles.example.com\"",[127,1178,51],{"class":151},[127,1180,1181],{"class":256},"envvar",[127,1183,260],{"class":140},[127,1185,1186],{"class":373},"\"MYTOOL_SERVER\"",[127,1188,1106],{"class":151},[127,1190,1191,1194,1196],{"class":129,"line":379},[127,1192,1193],{"class":151},") -> ",[127,1195,1039],{"class":144},[127,1197,278],{"class":151},[127,1199,1200],{"class":129,"line":387},[127,1201,1202],{"class":373},"    \"\"\"Upload every file under DIRECTORY.\"\"\"\n",[127,1204,1205,1208,1210,1212,1215,1217,1220,1222,1225,1228,1230,1233],{"class":129,"line":408},[127,1206,1207],{"class":151},"    files ",[127,1209,260],{"class":140},[127,1211,924],{"class":144},[127,1213,1214],{"class":151},"(p ",[127,1216,724],{"class":140},[127,1218,1219],{"class":151}," p ",[127,1221,730],{"class":140},[127,1223,1224],{"class":151}," directory.rglob(",[127,1226,1227],{"class":373},"\"*\"",[127,1229,399],{"class":151},[127,1231,1232],{"class":140},"if",[127,1234,1235],{"class":151}," p.is_file())\n",[127,1237,1238,1241,1243,1246,1249,1251,1253,1256,1258],{"class":129,"line":447},[127,1239,1240],{"class":151},"    limits ",[127,1242,260],{"class":140},[127,1244,1245],{"class":151}," httpx.Limits(",[127,1247,1248],{"class":256},"max_connections",[127,1250,260],{"class":140},[127,1252,653],{"class":151},[127,1254,1255],{"class":256},"max_keepalive_connections",[127,1257,260],{"class":140},[127,1259,1260],{"class":151},"jobs)\n",[127,1262,1263,1265,1268,1271,1273,1276,1279,1281,1284,1287,1289,1292,1295,1297,1300,1302,1305,1308,1310],{"class":129,"line":453},[127,1264,642],{"class":140},[127,1266,1267],{"class":151}," httpx.Client(",[127,1269,1270],{"class":256},"base_url",[127,1272,260],{"class":140},[127,1274,1275],{"class":151},"server, ",[127,1277,1278],{"class":256},"limits",[127,1280,260],{"class":140},[127,1282,1283],{"class":151},"limits, ",[127,1285,1286],{"class":256},"timeout",[127,1288,260],{"class":140},[127,1290,1291],{"class":151},"httpx.Timeout(",[127,1293,1294],{"class":144},"60.0",[127,1296,51],{"class":151},[127,1298,1299],{"class":256},"connect",[127,1301,260],{"class":140},[127,1303,1304],{"class":144},"5.0",[127,1306,1307],{"class":151},")) ",[127,1309,402],{"class":140},[127,1311,1312],{"class":151}," client:\n",[127,1314,1315,1317],{"class":129,"line":468},[127,1316,756],{"class":140},[127,1318,278],{"class":151},[127,1320,1321,1324,1326,1329,1332,1334,1336,1339,1341],{"class":129,"line":487},[127,1322,1323],{"class":151},"            results ",[127,1325,260],{"class":140},[127,1327,1328],{"class":151}," upload_all(client, directory, files, ",[127,1330,1331],{"class":256},"jobs",[127,1333,260],{"class":140},[127,1335,653],{"class":151},[127,1337,1338],{"class":256},"show_progress",[127,1340,260],{"class":140},[127,1342,1343],{"class":151},"sys.stderr.isatty())\n",[127,1345,1346,1348,1350],{"class":129,"line":517},[127,1347,874],{"class":140},[127,1349,877],{"class":144},[127,1351,278],{"class":151},[127,1353,1354,1357,1360,1362,1365,1367,1369],{"class":129,"line":522},[127,1355,1356],{"class":151},"            typer.echo(",[127,1358,1359],{"class":373},"\"interrupted — files already uploaded are kept\"",[127,1361,51],{"class":151},[127,1363,1364],{"class":256},"err",[127,1366,260],{"class":140},[127,1368,263],{"class":144},[127,1370,266],{"class":151},[127,1372,1373,1376,1379,1382],{"class":129,"line":527},[127,1374,1375],{"class":140},"            raise",[127,1377,1378],{"class":151}," typer.Exit(",[127,1380,1381],{"class":144},"130",[127,1383,266],{"class":151},[127,1385,1386,1389,1391,1394,1396,1399,1401,1404,1406],{"class":129,"line":544},[127,1387,1388],{"class":151},"    failed ",[127,1390,260],{"class":140},[127,1392,1393],{"class":151}," [r ",[127,1395,724],{"class":140},[127,1397,1398],{"class":151}," r ",[127,1400,730],{"class":140},[127,1402,1403],{"class":151}," results ",[127,1405,1232],{"class":140},[127,1407,1408],{"class":151}," r.error]\n",[127,1410,1411,1414,1416,1419,1422,1425,1428,1431,1434,1436,1439,1441,1444,1446,1449,1451,1453,1455,1457],{"class":129,"line":561},[127,1412,1413],{"class":151},"    typer.echo(",[127,1415,419],{"class":140},[127,1417,1418],{"class":373},"\"uploaded ",[127,1420,1421],{"class":144},"{len",[127,1423,1424],{"class":151},"(results) ",[127,1426,1427],{"class":140},"-",[127,1429,1430],{"class":144}," len",[127,1432,1433],{"class":151},"(failed)",[127,1435,431],{"class":144},[127,1437,1438],{"class":373},"\u002F",[127,1440,1421],{"class":144},[127,1442,1443],{"class":151},"(files)",[127,1445,431],{"class":144},[127,1447,1448],{"class":373}," files\"",[127,1450,51],{"class":151},[127,1452,1364],{"class":256},[127,1454,260],{"class":140},[127,1456,263],{"class":144},[127,1458,266],{"class":151},[127,1460,1461,1464,1466,1468,1471,1474,1477,1480],{"class":129,"line":572},[127,1462,1463],{"class":140},"    raise",[127,1465,1378],{"class":151},[127,1467,859],{"class":144},[127,1469,1470],{"class":140}," if",[127,1472,1473],{"class":151}," failed ",[127,1475,1476],{"class":140},"else",[127,1478,1479],{"class":144}," 0",[127,1481,266],{"class":151},[127,1483,1484],{"class":129,"line":583},[127,1485,159],{"emptyLinePlaceholder":158},[127,1487,1488],{"class":129,"line":600},[127,1489,159],{"emptyLinePlaceholder":158},[127,1491,1492,1494,1497,1500,1503],{"class":129,"line":618},[127,1493,1232],{"class":140},[127,1495,1496],{"class":144}," __name__",[127,1498,1499],{"class":140}," ==",[127,1501,1502],{"class":373}," \"__main__\"",[127,1504,278],{"class":151},[127,1506,1507],{"class":129,"line":639},[127,1508,1509],{"class":151},"    app()\n",[1511,1512,1514],"h3",{"id":1513},"the-decisions-behind-it","The decisions behind it",[10,1516,1517,1520,1521,1524,1525,1528,1529,1532],{},[35,1518,1519],{},"Workers return values instead of raising."," ",[48,1522,1523],{},"upload_one"," catches the expected failures (HTTP and file errors) and returns them in a ",[48,1526,1527],{},"Result",". Unexpected exceptions — programming errors — still propagate through ",[48,1530,1531],{},"future.result()"," and crash loudly, which is what you want for bugs.",[10,1534,1535,1538,1539,1542,1543,1546],{},[35,1536,1537],{},"Printing happens on the main thread."," Only the ",[48,1540,1541],{},"as_completed"," loop prints or updates the progress bar. Failures are printed through ",[48,1544,1545],{},"progress.console"," so they appear above the bar rather than tearing it. Workers never touch the terminal.",[10,1548,1549,1520,1552,1554,1555,1558],{},[35,1550,1551],{},"One shared client, sized to the pool.",[48,1553,50],{}," is thread-safe; sharing it shares the connection pool. ",[48,1556,1557],{},"httpx.Limits(max_connections=jobs)"," makes sure eight workers are not queueing for the default pool of connections, and that you never open more connections than workers.",[10,1560,1561,1564,1565,1568,1569,1572,1573,18],{},[35,1562,1563],{},"Ctrl+C sets a flag and cancels the queue."," Threads cannot be killed from outside, so cancellation is cooperative: ",[48,1566,1567],{},"cancel_futures=True"," drops everything not yet started, and the ",[48,1570,1571],{},"stop"," event lets queued-but-already-dequeued work bail out. Items in flight finish their current request. The command then exits 130, the convention for ",[48,1574,1575],{},"SIGINT",[10,1577,1578,1581],{},[35,1579,1580],{},"Results are sorted."," Completion order changes from run to run. Sorting before returning keeps any per-file output and JSON reports deterministic.",[20,1583,1585,1586],{"id":1584},"choosing-jobs","Choosing ",[48,1587,1588],{},"--jobs",[76,1590],{"name":1591},"cc-worker-count",[10,1593,1594,1595,1599,1600,1602,1603,1606],{},"For network-bound work, a default of 8 is conservative and safe for most services; 16–32 is reasonable for internal APIs you know can take it. Beyond that, the server's limits dominate — pair a larger pool with a rate limiter, as described in ",[14,1596,1598],{"href":1597},"\u002Fcli-runtime-systems-integration\u002Fconcurrency-and-async-in-python-clis\u002Frate-limiting-concurrent-requests-in-clis\u002F","rate-limiting concurrent requests in CLIs",". Always set a ",[48,1601,1145],{},": a user typing ",[48,1604,1605],{},"--jobs 1000"," should get a validation error, not 1,000 threads.",[20,1608,1610],{"id":1609},"ux-considerations","UX considerations",[25,1612,1613,1619,1629,1638,1644],{},[28,1614,1615,1618],{},[35,1616,1617],{},"Progress by count, not by line."," One bar with \"37\u002F400 · 2 failed\" is more readable than 400 log lines. Print individual lines only for failures.",[28,1620,1621,1624,1625,1628],{},[35,1622,1623],{},"Errors do not stop the batch."," Users would rather see \"398\u002F400 uploaded, 2 failed\" than an abort at the first problem. Make fail-fast an explicit ",[48,1626,1627],{},"--fail-fast"," option if some users need it.",[28,1630,1631,1637],{},[35,1632,1633,1636],{},[48,1634,1635],{},"--jobs 1"," is a debugging mode."," Sequential execution makes output ordered and tracebacks easy to follow. Document it.",[28,1639,1640,1643],{},[35,1641,1642],{},"Summarise at the end, on stderr."," The count line and the exit code (non-zero if anything failed) are what scripts and people check.",[28,1645,1646,1649,1650,1653,1654,1657],{},[35,1647,1648],{},"Watch out for thread-unsafe libraries."," If an SDK client is not thread-safe, give each worker its own via ",[48,1651,1652],{},"ThreadPoolExecutor(initializer=...)"," and ",[48,1655,1656],{},"threading.local()",", rather than sharing one.",[20,1659,1661],{"id":1660},"testing-the-behaviour","Testing the behaviour",[10,1663,1664,1665,1668],{},"Test the batch function with a ",[48,1666,1667],{},"MockTransport"," server that can fail selectively, and assert on the set of results, the failure reporting and the ordering:",[118,1670,1672],{"className":120,"code":1671,"language":122,"meta":123,"style":123},"# tests\u002Ftest_upload.py\nfrom pathlib import Path\n\nimport httpx\n\nfrom mytool.upload import upload_all\n\n\ndef make_files(tmp_path: Path, n: int) -> list[Path]:\n    for i in range(n):\n        (tmp_path \u002F f\"f{i:03}.txt\").write_text(str(i))\n    return sorted(tmp_path.iterdir())\n\n\ndef client_for(handler) -> httpx.Client:\n    return httpx.Client(base_url=\"https:\u002F\u002Ffiles.test\", transport=httpx.MockTransport(handler))\n\n\ndef test_all_uploaded_and_sorted(tmp_path):\n    files = make_files(tmp_path, 40)\n    seen = []\n\n    def handler(request):\n        seen.append(request.url.path)\n        return httpx.Response(201)\n\n    results = upload_all(client_for(handler), tmp_path, files, jobs=8, show_progress=False)\n    assert [r.path for r in results] == files\n    assert all(r.status == 201 for r in results)\n    assert len(seen) == 40\n\n\ndef test_failures_are_collected_not_raised(tmp_path):\n    files = make_files(tmp_path, 10)\n\n    def handler(request):\n        return httpx.Response(500 if request.url.path.endswith(\"f007.txt\") else 201)\n\n    results = upload_all(client_for(handler), tmp_path, files, jobs=4, show_progress=False)\n    failed = [r for r in results if r.error]\n    assert [r.path.name for r in failed] == [\"f007.txt\"]\n    assert len(results) == 10\n\n\ndef test_concurrency_is_bounded(tmp_path):\n    import threading\n    import time\n\n    files = make_files(tmp_path, 30)\n    active = 0\n    peak = 0\n    lock = threading.Lock()\n\n    def handler(request):\n        nonlocal active, peak\n        with lock:\n            active += 1\n            peak = max(peak, active)\n        time.sleep(0.01)\n        with lock:\n            active -= 1\n        return httpx.Response(201)\n\n    upload_all(client_for(handler), tmp_path, files, jobs=5, show_progress=False)\n    assert 1 \u003C peak \u003C= 5\n",[48,1673,1674,1679,1689,1693,1699,1703,1713,1717,1721,1736,1752,1786,1795,1799,1803,1813,1836,1840,1844,1854,1868,1877,1881,1892,1897,1909,1913,1939,1961,1986,2000,2004,2008,2017,2030,2034,2042,2067,2071,2096,2116,2142,2155,2159,2163,2172,2179,2186,2190,2203,2212,2221,2231,2235,2243,2251,2258,2267,2281,2292,2299,2309,2320,2325,2348],{"__ignoreMap":123},[127,1675,1676],{"class":129,"line":130},[127,1677,1678],{"class":133},"# tests\u002Ftest_upload.py\n",[127,1680,1681,1683,1685,1687],{"class":129,"line":137},[127,1682,141],{"class":140},[127,1684,202],{"class":151},[127,1686,165],{"class":140},[127,1688,207],{"class":151},[127,1690,1691],{"class":129,"line":155},[127,1692,159],{"emptyLinePlaceholder":158},[127,1694,1695,1697],{"class":129,"line":162},[127,1696,165],{"class":140},[127,1698,220],{"class":151},[127,1700,1701],{"class":129,"line":171},[127,1702,159],{"emptyLinePlaceholder":158},[127,1704,1705,1707,1709,1711],{"class":129,"line":184},[127,1706,141],{"class":140},[127,1708,991],{"class":151},[127,1710,165],{"class":140},[127,1712,996],{"class":151},[127,1714,1715],{"class":129,"line":197},[127,1716,159],{"emptyLinePlaceholder":158},[127,1718,1719],{"class":129,"line":210},[127,1720,159],{"emptyLinePlaceholder":158},[127,1722,1723,1725,1728,1731,1733],{"class":129,"line":215},[127,1724,338],{"class":140},[127,1726,1727],{"class":249}," make_files",[127,1729,1730],{"class":151},"(tmp_path: Path, n: ",[127,1732,293],{"class":144},[127,1734,1735],{"class":151},") -> list[Path]:\n",[127,1737,1738,1741,1744,1746,1749],{"class":129,"line":223},[127,1739,1740],{"class":140},"    for",[127,1742,1743],{"class":151}," i ",[127,1745,730],{"class":140},[127,1747,1748],{"class":144}," range",[127,1750,1751],{"class":151},"(n):\n",[127,1753,1754,1757,1759,1762,1765,1767,1770,1773,1775,1778,1781,1783],{"class":129,"line":236},[127,1755,1756],{"class":151},"        (tmp_path ",[127,1758,1438],{"class":140},[127,1760,1761],{"class":140}," f",[127,1763,1764],{"class":373},"\"f",[127,1766,425],{"class":144},[127,1768,1769],{"class":151},"i",[127,1771,1772],{"class":140},":03",[127,1774,431],{"class":144},[127,1776,1777],{"class":373},".txt\"",[127,1779,1780],{"class":151},").write_text(",[127,1782,314],{"class":144},[127,1784,1785],{"class":151},"(i))\n",[127,1787,1788,1790,1792],{"class":129,"line":241},[127,1789,921],{"class":140},[127,1791,924],{"class":144},[127,1793,1794],{"class":151},"(tmp_path.iterdir())\n",[127,1796,1797],{"class":129,"line":246},[127,1798,159],{"emptyLinePlaceholder":158},[127,1800,1801],{"class":129,"line":269},[127,1802,159],{"emptyLinePlaceholder":158},[127,1804,1805,1807,1810],{"class":129,"line":281},[127,1806,338],{"class":140},[127,1808,1809],{"class":249}," client_for",[127,1811,1812],{"class":151},"(handler) -> httpx.Client:\n",[127,1814,1815,1817,1819,1821,1823,1826,1828,1831,1833],{"class":129,"line":287},[127,1816,921],{"class":140},[127,1818,1267],{"class":151},[127,1820,1270],{"class":256},[127,1822,260],{"class":140},[127,1824,1825],{"class":373},"\"https:\u002F\u002Ffiles.test\"",[127,1827,51],{"class":151},[127,1829,1830],{"class":256},"transport",[127,1832,260],{"class":140},[127,1834,1835],{"class":151},"httpx.MockTransport(handler))\n",[127,1837,1838],{"class":129,"line":308},[127,1839,159],{"emptyLinePlaceholder":158},[127,1841,1842],{"class":129,"line":325},[127,1843,159],{"emptyLinePlaceholder":158},[127,1845,1846,1848,1851],{"class":129,"line":330},[127,1847,338],{"class":140},[127,1849,1850],{"class":249}," test_all_uploaded_and_sorted",[127,1852,1853],{"class":151},"(tmp_path):\n",[127,1855,1856,1858,1860,1863,1866],{"class":129,"line":335},[127,1857,1207],{"class":151},[127,1859,260],{"class":140},[127,1861,1862],{"class":151}," make_files(tmp_path, ",[127,1864,1865],{"class":144},"40",[127,1867,266],{"class":151},[127,1869,1870,1873,1875],{"class":129,"line":347},[127,1871,1872],{"class":151},"    seen ",[127,1874,260],{"class":140},[127,1876,569],{"class":151},[127,1878,1879],{"class":129,"line":359},[127,1880,159],{"emptyLinePlaceholder":158},[127,1882,1883,1886,1889],{"class":129,"line":379},[127,1884,1885],{"class":140},"    def",[127,1887,1888],{"class":249}," handler",[127,1890,1891],{"class":151},"(request):\n",[127,1893,1894],{"class":129,"line":387},[127,1895,1896],{"class":151},"        seen.append(request.url.path)\n",[127,1898,1899,1901,1904,1907],{"class":129,"line":408},[127,1900,362],{"class":140},[127,1902,1903],{"class":151}," httpx.Response(",[127,1905,1906],{"class":144},"201",[127,1908,266],{"class":151},[127,1910,1911],{"class":129,"line":447},[127,1912,159],{"emptyLinePlaceholder":158},[127,1914,1915,1918,1920,1923,1925,1927,1929,1931,1933,1935,1937],{"class":129,"line":453},[127,1916,1917],{"class":151},"    results ",[127,1919,260],{"class":140},[127,1921,1922],{"class":151}," upload_all(client_for(handler), tmp_path, files, ",[127,1924,1331],{"class":256},[127,1926,260],{"class":140},[127,1928,1121],{"class":144},[127,1930,51],{"class":151},[127,1932,1338],{"class":256},[127,1934,260],{"class":140},[127,1936,1103],{"class":144},[127,1938,266],{"class":151},[127,1940,1941,1944,1947,1949,1951,1953,1956,1959],{"class":129,"line":468},[127,1942,1943],{"class":140},"    assert",[127,1945,1946],{"class":151}," [r.path ",[127,1948,724],{"class":140},[127,1950,1398],{"class":151},[127,1952,730],{"class":140},[127,1954,1955],{"class":151}," results] ",[127,1957,1958],{"class":140},"==",[127,1960,733],{"class":151},[127,1962,1963,1965,1968,1971,1973,1976,1979,1981,1983],{"class":129,"line":487},[127,1964,1943],{"class":140},[127,1966,1967],{"class":144}," all",[127,1969,1970],{"class":151},"(r.status ",[127,1972,1958],{"class":140},[127,1974,1975],{"class":144}," 201",[127,1977,1978],{"class":140}," for",[127,1980,1398],{"class":151},[127,1982,730],{"class":140},[127,1984,1985],{"class":151}," results)\n",[127,1987,1988,1990,1992,1995,1997],{"class":129,"line":517},[127,1989,1943],{"class":140},[127,1991,1430],{"class":144},[127,1993,1994],{"class":151},"(seen) ",[127,1996,1958],{"class":140},[127,1998,1999],{"class":144}," 40\n",[127,2001,2002],{"class":129,"line":522},[127,2003,159],{"emptyLinePlaceholder":158},[127,2005,2006],{"class":129,"line":527},[127,2007,159],{"emptyLinePlaceholder":158},[127,2009,2010,2012,2015],{"class":129,"line":544},[127,2011,338],{"class":140},[127,2013,2014],{"class":249}," test_failures_are_collected_not_raised",[127,2016,1853],{"class":151},[127,2018,2019,2021,2023,2025,2028],{"class":129,"line":561},[127,2020,1207],{"class":151},[127,2022,260],{"class":140},[127,2024,1862],{"class":151},[127,2026,2027],{"class":144},"10",[127,2029,266],{"class":151},[127,2031,2032],{"class":129,"line":572},[127,2033,159],{"emptyLinePlaceholder":158},[127,2035,2036,2038,2040],{"class":129,"line":583},[127,2037,1885],{"class":140},[127,2039,1888],{"class":249},[127,2041,1891],{"class":151},[127,2043,2044,2046,2048,2051,2053,2056,2059,2061,2063,2065],{"class":129,"line":600},[127,2045,362],{"class":140},[127,2047,1903],{"class":151},[127,2049,2050],{"class":144},"500",[127,2052,1470],{"class":140},[127,2054,2055],{"class":151}," request.url.path.endswith(",[127,2057,2058],{"class":373},"\"f007.txt\"",[127,2060,399],{"class":151},[127,2062,1476],{"class":140},[127,2064,1975],{"class":144},[127,2066,266],{"class":151},[127,2068,2069],{"class":129,"line":618},[127,2070,159],{"emptyLinePlaceholder":158},[127,2072,2073,2075,2077,2079,2081,2083,2086,2088,2090,2092,2094],{"class":129,"line":639},[127,2074,1917],{"class":151},[127,2076,260],{"class":140},[127,2078,1922],{"class":151},[127,2080,1331],{"class":256},[127,2082,260],{"class":140},[127,2084,2085],{"class":144},"4",[127,2087,51],{"class":151},[127,2089,1338],{"class":256},[127,2091,260],{"class":140},[127,2093,1103],{"class":144},[127,2095,266],{"class":151},[127,2097,2098,2100,2102,2104,2106,2108,2110,2112,2114],{"class":129,"line":671},[127,2099,1388],{"class":151},[127,2101,260],{"class":140},[127,2103,1393],{"class":151},[127,2105,724],{"class":140},[127,2107,1398],{"class":151},[127,2109,730],{"class":140},[127,2111,1403],{"class":151},[127,2113,1232],{"class":140},[127,2115,1408],{"class":151},[127,2117,2118,2120,2123,2125,2127,2129,2132,2134,2137,2139],{"class":129,"line":707},[127,2119,1943],{"class":140},[127,2121,2122],{"class":151}," [r.path.name ",[127,2124,724],{"class":140},[127,2126,1398],{"class":151},[127,2128,730],{"class":140},[127,2130,2131],{"class":151}," failed] ",[127,2133,1958],{"class":140},[127,2135,2136],{"class":151}," [",[127,2138,2058],{"class":373},[127,2140,2141],{"class":151},"]\n",[127,2143,2144,2146,2148,2150,2152],{"class":129,"line":718},[127,2145,1943],{"class":140},[127,2147,1430],{"class":144},[127,2149,1424],{"class":151},[127,2151,1958],{"class":140},[127,2153,2154],{"class":144}," 10\n",[127,2156,2157],{"class":129,"line":736},[127,2158,159],{"emptyLinePlaceholder":158},[127,2160,2161],{"class":129,"line":742},[127,2162,159],{"emptyLinePlaceholder":158},[127,2164,2165,2167,2170],{"class":129,"line":753},[127,2166,338],{"class":140},[127,2168,2169],{"class":249}," test_concurrency_is_bounded",[127,2171,1853],{"class":151},[127,2173,2174,2177],{"class":129,"line":761},[127,2175,2176],{"class":140},"    import",[127,2178,168],{"class":151},[127,2180,2181,2183],{"class":129,"line":775},[127,2182,2176],{"class":140},[127,2184,2185],{"class":151}," time\n",[127,2187,2188],{"class":129,"line":789},[127,2189,159],{"emptyLinePlaceholder":158},[127,2191,2192,2194,2196,2198,2201],{"class":129,"line":795},[127,2193,1207],{"class":151},[127,2195,260],{"class":140},[127,2197,1862],{"class":151},[127,2199,2200],{"class":144},"30",[127,2202,266],{"class":151},[127,2204,2205,2208,2210],{"class":129,"line":804},[127,2206,2207],{"class":151},"    active ",[127,2209,260],{"class":140},[127,2211,750],{"class":144},[127,2213,2214,2217,2219],{"class":129,"line":816},[127,2215,2216],{"class":151},"    peak ",[127,2218,260],{"class":140},[127,2220,750],{"class":144},[127,2222,2223,2226,2228],{"class":129,"line":848},[127,2224,2225],{"class":151},"    lock ",[127,2227,260],{"class":140},[127,2229,2230],{"class":151}," threading.Lock()\n",[127,2232,2233],{"class":129,"line":871},[127,2234,159],{"emptyLinePlaceholder":158},[127,2236,2237,2239,2241],{"class":129,"line":882},[127,2238,1885],{"class":140},[127,2240,1888],{"class":249},[127,2242,1891],{"class":151},[127,2244,2245,2248],{"class":129,"line":888},[127,2246,2247],{"class":140},"        nonlocal",[127,2249,2250],{"class":151}," active, peak\n",[127,2252,2253,2255],{"class":129,"line":912},[127,2254,390],{"class":140},[127,2256,2257],{"class":151}," lock:\n",[127,2259,2260,2263,2265],{"class":129,"line":918},[127,2261,2262],{"class":151},"            active ",[127,2264,810],{"class":140},[127,2266,813],{"class":144},[127,2268,2270,2273,2275,2278],{"class":129,"line":2269},58,[127,2271,2272],{"class":151},"            peak ",[127,2274,260],{"class":140},[127,2276,2277],{"class":144}," max",[127,2279,2280],{"class":151},"(peak, active)\n",[127,2282,2284,2287,2290],{"class":129,"line":2283},59,[127,2285,2286],{"class":151},"        time.sleep(",[127,2288,2289],{"class":144},"0.01",[127,2291,266],{"class":151},[127,2293,2295,2297],{"class":129,"line":2294},60,[127,2296,390],{"class":140},[127,2298,2257],{"class":151},[127,2300,2302,2304,2307],{"class":129,"line":2301},61,[127,2303,2262],{"class":151},[127,2305,2306],{"class":140},"-=",[127,2308,813],{"class":144},[127,2310,2312,2314,2316,2318],{"class":129,"line":2311},62,[127,2313,362],{"class":140},[127,2315,1903],{"class":151},[127,2317,1906],{"class":144},[127,2319,266],{"class":151},[127,2321,2323],{"class":129,"line":2322},63,[127,2324,159],{"emptyLinePlaceholder":158},[127,2326,2328,2331,2333,2335,2338,2340,2342,2344,2346],{"class":129,"line":2327},64,[127,2329,2330],{"class":151},"    upload_all(client_for(handler), tmp_path, files, ",[127,2332,1331],{"class":256},[127,2334,260],{"class":140},[127,2336,2337],{"class":144},"5",[127,2339,51],{"class":151},[127,2341,1338],{"class":256},[127,2343,260],{"class":140},[127,2345,1103],{"class":144},[127,2347,266],{"class":151},[127,2349,2351,2353,2356,2359,2362,2365],{"class":129,"line":2350},65,[127,2352,1943],{"class":140},[127,2354,2355],{"class":144}," 1",[127,2357,2358],{"class":140}," \u003C",[127,2360,2361],{"class":151}," peak ",[127,2363,2364],{"class":140},"\u003C=",[127,2366,2367],{"class":144}," 5\n",[10,2369,2370,2371,2373,2374,2376],{},"The bounded-concurrency test is the one that proves ",[48,2372,1588],{}," means what it says: it measures the peak number of simultaneous requests the fake server observed. ",[48,2375,1667],{}," handlers run on the worker threads, which is why the counter needs a lock.",[20,2378,2380],{"id":2379},"conclusion","Conclusion",[10,2382,2383,2384,2386,2387,2389,2390,18],{},"A thread pool is the lowest-effort, highest-return concurrency upgrade for an I\u002FO-bound CLI: the worker code stays synchronous, and a bounded ",[48,2385,65],{}," with ",[48,2388,1541],{}," gives parallelism, smooth progress and per-item error handling. Keep printing on the main thread, share only thread-safe clients sized to the pool, cancel cooperatively on Ctrl+C, and sort results before output. When you outgrow it — hundreds of concurrent requests, or fine-grained cancellation — the same shape carries over to ",[14,2391,2393],{"href":2392},"\u002Fcli-runtime-systems-integration\u002Fconcurrency-and-async-in-python-clis\u002Frunning-async-code-in-typer-and-click\u002F","asyncio",[20,2395,2397],{"id":2396},"frequently-asked-questions","Frequently asked questions",[1511,2399,2401,2402,2405],{"id":2400},"why-not-just-start-a-threadingthread-per-item","Why not just start a ",[48,2403,2404],{},"threading.Thread"," per item?",[10,2407,2408],{},"Unbounded threads mean unbounded connections, memory and server load, and you have to collect results and exceptions yourself. The executor gives you a bound, a queue, futures and clean shutdown for free.",[1511,2410,2412,2413,2416],{"id":2411},"do-i-need-locks-around-resultsappend","Do I need locks around ",[48,2414,2415],{},"results.append","?",[10,2418,2419],{},"Not in this design, because only the main thread appends — workers return values. Locks become necessary only when workers mutate shared state directly, which is worth avoiding.",[1511,2421,2423],{"id":2422},"how-do-i-add-a-per-item-timeout","How do I add a per-item timeout?",[10,2425,2426,2427,2430,2431,2434,2435,2439],{},"Set timeouts on the I\u002FO itself (httpx timeouts, subprocess ",[48,2428,2429],{},"timeout=","). ",[48,2432,2433],{},"future.result(timeout=...)"," only stops ",[2436,2437,2438],"em",{},"waiting"," — the thread keeps running — so it cannot enforce a deadline on the work.",[1511,2441,2443],{"id":2442},"can-i-use-this-with-subprocesses","Can I use this with subprocesses?",[10,2445,2446,2447,2450,2451,2455],{},"Yes, and it works well: each worker calls ",[48,2448,2449],{},"subprocess.run",", which releases the GIL while the child runs. Combine it with the helper from ",[14,2452,2454],{"href":2453},"\u002Fcli-runtime-systems-integration\u002Frunning-subprocesses-from-python-clis\u002Fcalling-external-commands-safely-with-subprocess\u002F","calling external commands safely with subprocess"," to run, for example, eight linters in parallel.",[20,2457,2459],{"id":2458},"related","Related",[25,2461,2462,2468,2473,2478,2484],{},[28,2463,2464,2465],{},"Up: ",[14,2466,2467],{"href":16},"Concurrency and async in Python CLIs",[28,2469,2470],{},[14,2471,2472],{"href":41},"Multiprocessing for CPU-bound CLI tasks",[28,2474,2475],{},[14,2476,2477],{"href":1597},"Rate-limiting concurrent requests in CLIs",[28,2479,2480],{},[14,2481,2483],{"href":2482},"\u002Fadvanced-input-parsing-user-experience\u002Finteractive-terminal-ui-with-rich\u002Fadding-progress-bars-and-spinners-to-python-clis\u002F","Adding progress bars and spinners to Python CLIs",[28,2485,2486],{},[14,2487,2489],{"href":2488},"\u002Fcli-runtime-systems-integration\u002Fcalling-http-apis-from-python-clis\u002Fdownloading-files-with-progress-in-python\u002F","Downloading files with progress in Python",[2491,2492,2493],"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 .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);}",{"title":123,"searchDepth":137,"depth":137,"links":2495},[2496,2497,2498,2501,2503,2504,2505,2506,2514],{"id":22,"depth":137,"text":23},{"id":58,"depth":137,"text":59},{"id":112,"depth":137,"text":113,"children":2499},[2500],{"id":1513,"depth":155,"text":1514},{"id":1584,"depth":137,"text":2502},"Choosing --jobs",{"id":1609,"depth":137,"text":1610},{"id":1660,"depth":137,"text":1661},{"id":2379,"depth":137,"text":2380},{"id":2396,"depth":137,"text":2397,"children":2507},[2508,2510,2512,2513],{"id":2400,"depth":155,"text":2509},"Why not just start a threading.Thread per item?",{"id":2411,"depth":155,"text":2511},"Do I need locks around results.append?",{"id":2422,"depth":155,"text":2423},{"id":2442,"depth":155,"text":2443},{"id":2458,"depth":137,"text":2459},"2026-09-18","Speed up I\u002FO-heavy Python CLI commands with ThreadPoolExecutor: bounded --jobs, as_completed progress, per-item errors, clean Ctrl+C and deterministic output.","intermediate",false,"md",{},"\u002Fcli-runtime-systems-integration\u002Fconcurrency-and-async-in-python-clis\u002Fparallelising-cli-work-with-thread-pools",{"title":5,"description":2516},"cli-runtime-systems-integration\u002Fconcurrency-and-async-in-python-clis\u002Fparallelising-cli-work-with-thread-pools\u002Findex",[2525,2526,2527,2528],"concurrency","threads","performance","rich","o5-7vuYWdyhl7laAYXYXhRkVtOyr-DVSo1cqLPc1J7U",[2531,2534,2537,2540,2543,2546,2549,2552,2555,2558,2561,2564,2567,2570,2573,2576,2579,2582,2585,2588,2591,2594,2597,2600,2603,2606,2609,2612,2615,2618,2621,2624,2627,2630,2633,2636,2639,2642,2645,2648,2651,2654,2657,2660,2663,2666,2669,2672,2675,2678,2681,2684,2687,2690,2693,2696,2699,2702,2705,2708,2711,2714,2717,2720,2723,2724,2727,2730,2733,2736,2739,2742,2745,2748,2751,2754,2757,2760,2763,2766,2769,2772,2775,2778,2781,2784,2787,2790,2793,2796,2799,2802,2804,2807,2810,2813,2816,2819,2822,2825,2828,2831,2834,2837,2840,2843,2846,2849,2852,2855,2858,2861,2864,2867,2870,2873,2876,2879,2882,2885,2888,2891,2894,2897,2900,2903,2906,2909,2912,2915,2918,2921,2924,2927,2930,2933,2936,2939,2942,2945,2948,2951,2954,2957,2960,2963,2966,2969,2972,2975,2978,2981,2984,2987,2990,2993,2996,2999,3002,3005,3008,3011,3014,3017,3020,3023,3026,3029,3032,3035,3038,3041,3044,3047,3050,3053,3056,3059,3062,3065,3068,3071,3074],{"path":2532,"title":2533},"\u002Fabout","About Python CLI Toolcraft",{"path":2535,"title":2536},"\u002Fadvanced-input-parsing-user-experience\u002Fadvanced-argument-validation-strategies","Advanced Argument Validation Strategies",{"path":2538,"title":2539},"\u002Fadvanced-input-parsing-user-experience\u002Fadvanced-argument-validation-strategies\u002Fparsing-nested-json-arguments-in-python-clis","Parsing Nested JSON Args in Python CLIs",{"path":2541,"title":2542},"\u002Fadvanced-input-parsing-user-experience\u002Fadvanced-argument-validation-strategies\u002Fvalidating-dependent-and-conflicting-options","Validating Dependent and Conflicting CLI Options",{"path":2544,"title":2545},"\u002Fadvanced-input-parsing-user-experience\u002Fadvanced-argument-validation-strategies\u002Fvalidating-file-and-directory-paths-in-clis","Validating File and Directory Paths in CLIs",{"path":2547,"title":2548},"\u002Fadvanced-input-parsing-user-experience\u002Fadvanced-argument-validation-strategies\u002Fwriting-custom-click-parameter-types","Writing Custom Click Parameter Types",{"path":2550,"title":2551},"\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":2553,"title":2554},"\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":2556,"title":2557},"\u002Fadvanced-input-parsing-user-experience\u002Fbuilding-terminal-uis-with-textual","Building Terminal UIs with Textual for Python CLIs",{"path":2559,"title":2560},"\u002Fadvanced-input-parsing-user-experience\u002Fbuilding-terminal-uis-with-textual\u002Ftesting-textual-apps-with-pilot","Testing Textual Apps with Pilot",{"path":2562,"title":2563},"\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":2565,"title":2566},"\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":2568,"title":2569},"\u002Fadvanced-input-parsing-user-experience\u002Fcli-help-output-and-documentation","CLI Help Output and Documentation",{"path":2571,"title":2572},"\u002Fadvanced-input-parsing-user-experience\u002Fcli-help-output-and-documentation\u002Fversioning-and-deprecating-cli-flags","Versioning and Deprecating CLI Flags",{"path":2574,"title":2575},"\u002Fadvanced-input-parsing-user-experience\u002Fcli-help-output-and-documentation\u002Fwriting-help-text-users-actually-read","Writing Help Text Users Actually Read",{"path":2577,"title":2578},"\u002Fadvanced-input-parsing-user-experience\u002Fcross-platform-terminal-compatibility\u002Fadapting-output-to-terminal-width","Adapting Python CLI Output to Terminal Width",{"path":2580,"title":2581},"\u002Fadvanced-input-parsing-user-experience\u002Fcross-platform-terminal-compatibility\u002Fdetecting-ci-environments-and-non-interactive-shells","Detecting CI Environments and Non-Interactive Shells",{"path":2583,"title":2584},"\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":2586,"title":2587},"\u002Fadvanced-input-parsing-user-experience\u002Fcross-platform-terminal-compatibility","Cross-Platform Terminal Compatibility for Python CLIs",{"path":2589,"title":2590},"\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":2592,"title":2593},"\u002Fadvanced-input-parsing-user-experience\u002Ferror-handling-and-exit-codes\u002Fchoosing-exit-codes-for-cli-tools","Choosing Exit Codes for CLI Tools",{"path":2595,"title":2596},"\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":2598,"title":2599},"\u002Fadvanced-input-parsing-user-experience\u002Ferror-handling-and-exit-codes\u002Ffriendly-error-messages-and-tracebacks","Friendly Error Messages and Tracebacks",{"path":2601,"title":2602},"\u002Fadvanced-input-parsing-user-experience\u002Ferror-handling-and-exit-codes\u002Fhandling-keyboard-interrupt-cleanly","Handling Keyboard Interrupt Cleanly",{"path":2604,"title":2605},"\u002Fadvanced-input-parsing-user-experience\u002Ferror-handling-and-exit-codes","Error Handling and Exit Codes for CLIs",{"path":2607,"title":2608},"\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":2610,"title":2611},"\u002Fadvanced-input-parsing-user-experience\u002Fhandling-configuration-files-env-vars\u002Fconfig-precedence-flags-env-files-defaults","Config Precedence: Flags, Env, Files, Defaults",{"path":2613,"title":2614},"\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":2616,"title":2617},"\u002Fadvanced-input-parsing-user-experience\u002Fhandling-configuration-files-env-vars","Handling Config Files and Env Vars in CLIs",{"path":2619,"title":2620},"\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":2622,"title":2623},"\u002Fadvanced-input-parsing-user-experience\u002Fhandling-configuration-files-env-vars\u002Freading-toml-config-with-tomllib","Reading TOML Config with tomllib in Python CLIs",{"path":2625,"title":2626},"\u002Fadvanced-input-parsing-user-experience\u002Fhandling-configuration-files-env-vars\u002Ftyped-settings-with-pydantic-settings","Typed Settings with pydantic-settings in Python CLIs",{"path":2628,"title":2629},"\u002Fadvanced-input-parsing-user-experience","Advanced Input Parsing for Python CLIs",{"path":2631,"title":2632},"\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":2634,"title":2635},"\u002Fadvanced-input-parsing-user-experience\u002Finteractive-terminal-ui-with-rich\u002Fbuilding-interactive-prompts-and-menus","Building Interactive Prompts and Menus in Python CLIs",{"path":2637,"title":2638},"\u002Fadvanced-input-parsing-user-experience\u002Finteractive-terminal-ui-with-rich","Interactive Terminal UI with Rich",{"path":2640,"title":2641},"\u002Fadvanced-input-parsing-user-experience\u002Finteractive-terminal-ui-with-rich\u002Flive-dashboards-with-rich-live","Live Dashboards with Rich Live in Python CLIs",{"path":2643,"title":2644},"\u002Fadvanced-input-parsing-user-experience\u002Finteractive-terminal-ui-with-rich\u002Frendering-tables-and-json-with-rich","Rendering Tables and JSON with Rich",{"path":2646,"title":2647},"\u002Fadvanced-input-parsing-user-experience\u002Finteractive-terminal-ui-with-rich\u002Ftheming-rich-output-consistently","Theming Rich Output Consistently in Python CLIs",{"path":2649,"title":2650},"\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":2652,"title":2653},"\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":2655,"title":2656},"\u002Fadvanced-input-parsing-user-experience\u002Fshell-completion-for-python-clis","Shell Completion for Python CLIs",{"path":2658,"title":2659},"\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":2661,"title":2662},"\u002Fadvanced-input-parsing-user-experience\u002Fshell-completion-for-python-clis\u002Ftesting-shell-completion-in-python-clis","Testing Shell Completion in Python CLIs",{"path":2664,"title":2665},"\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":2667,"title":2668},"\u002Fadvanced-input-parsing-user-experience\u002Fstructured-logging-for-cli-apps\u002Fadding-verbose-and-quiet-logging-flags","Adding Verbose and Quiet Logging Flags",{"path":2670,"title":2671},"\u002Fadvanced-input-parsing-user-experience\u002Fstructured-logging-for-cli-apps","Structured Logging for CLI Apps",{"path":2673,"title":2674},"\u002Fadvanced-input-parsing-user-experience\u002Fstructured-logging-for-cli-apps\u002Fstructured-json-logging-in-python-clis","Structured JSON Logging in Python CLIs",{"path":2676,"title":2677},"\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":2679,"title":2680},"\u002Fadvanced-input-parsing-user-experience\u002Fworking-with-stdin-stdout-and-pipes\u002Fdetecting-tty-and-adapting-output","Detecting a TTY and Adapting Output",{"path":2682,"title":2683},"\u002Fadvanced-input-parsing-user-experience\u002Fworking-with-stdin-stdout-and-pipes\u002Femitting-json-output-for-scripting","Emitting JSON Output for Scripting",{"path":2685,"title":2686},"\u002Fadvanced-input-parsing-user-experience\u002Fworking-with-stdin-stdout-and-pipes\u002Fhandling-broken-pipe-and-sigpipe","Handling Broken Pipe and SIGPIPE",{"path":2688,"title":2689},"\u002Fadvanced-input-parsing-user-experience\u002Fworking-with-stdin-stdout-and-pipes","Working with stdin, stdout and Pipes",{"path":2691,"title":2692},"\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":2694,"title":2695},"\u002Fadvanced-input-parsing-user-experience\u002Fworking-with-stdin-stdout-and-pipes\u002Freading-piped-input-in-python-clis","Reading Piped Input in Python CLIs",{"path":2697,"title":2698},"\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":2700,"title":2701},"\u002Fcli-runtime-systems-integration\u002Fcalling-http-apis-from-python-clis\u002Fdownloading-files-with-progress-in-python","Downloading Files with Progress in Python CLIs",{"path":2703,"title":2704},"\u002Fcli-runtime-systems-integration\u002Fcalling-http-apis-from-python-clis","Calling HTTP APIs from Python CLIs",{"path":2706,"title":2707},"\u002Fcli-runtime-systems-integration\u002Fcalling-http-apis-from-python-clis\u002Foauth-device-flow-login-for-clis","OAuth Device Flow Login for Python CLIs",{"path":2709,"title":2710},"\u002Fcli-runtime-systems-integration\u002Fcalling-http-apis-from-python-clis\u002Fpaginating-api-results-in-a-cli","Paginating API Results in a Python CLI",{"path":2712,"title":2713},"\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":2715,"title":2716},"\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":2718,"title":2719},"\u002Fcli-runtime-systems-integration\u002Fconcurrency-and-async-in-python-clis","Concurrency and Async in Python CLIs",{"path":2721,"title":2722},"\u002Fcli-runtime-systems-integration\u002Fconcurrency-and-async-in-python-clis\u002Fmultiprocessing-for-cpu-bound-cli-tasks","Multiprocessing for CPU-Bound CLI Tasks",{"path":2521,"title":5},{"path":2725,"title":2726},"\u002Fcli-runtime-systems-integration\u002Fconcurrency-and-async-in-python-clis\u002Frate-limiting-concurrent-requests-in-clis","Rate-Limiting Concurrent Requests in Python CLIs",{"path":2728,"title":2729},"\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":2731,"title":2732},"\u002Fcli-runtime-systems-integration\u002Ffilesystem-paths-and-atomic-writes\u002Fcross-platform-paths-with-pathlib","Cross-Platform Paths with pathlib in CLIs",{"path":2734,"title":2735},"\u002Fcli-runtime-systems-integration\u002Ffilesystem-paths-and-atomic-writes\u002Ffile-locking-for-concurrent-cli-runs","File Locking for Concurrent CLI Runs in Python",{"path":2737,"title":2738},"\u002Fcli-runtime-systems-integration\u002Ffilesystem-paths-and-atomic-writes","Filesystem Paths and Atomic Writes for CLIs",{"path":2740,"title":2741},"\u002Fcli-runtime-systems-integration\u002Ffilesystem-paths-and-atomic-writes\u002Fsafe-temporary-files-and-directories","Safe Temporary Files and Directories in CLIs",{"path":2743,"title":2744},"\u002Fcli-runtime-systems-integration\u002Ffilesystem-paths-and-atomic-writes\u002Fstoring-app-data-with-platformdirs","Storing CLI App Data with platformdirs",{"path":2746,"title":2747},"\u002Fcli-runtime-systems-integration\u002Ffilesystem-paths-and-atomic-writes\u002Fwriting-files-atomically-in-python-clis","Writing Files Atomically in Python CLIs",{"path":2749,"title":2750},"\u002Fcli-runtime-systems-integration","CLI Runtime & Systems Integration for Python",{"path":2752,"title":2753},"\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":2755,"title":2756},"\u002Fcli-runtime-systems-integration\u002Flong-running-and-watch-mode-clis\u002Fhandling-sigterm-and-graceful-shutdown","Handling SIGTERM and Graceful Shutdown in CLIs",{"path":2758,"title":2759},"\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":2761,"title":2762},"\u002Fcli-runtime-systems-integration\u002Flong-running-and-watch-mode-clis","Long-Running and Watch-Mode Python CLIs",{"path":2764,"title":2765},"\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":2767,"title":2768},"\u002Fcli-runtime-systems-integration\u002Frunning-subprocesses-from-python-clis\u002Favoiding-shell-injection-in-python-clis","Avoiding Shell Injection in Python CLIs",{"path":2770,"title":2771},"\u002Fcli-runtime-systems-integration\u002Frunning-subprocesses-from-python-clis\u002Fcalling-external-commands-safely-with-subprocess","Calling External Commands Safely with subprocess",{"path":2773,"title":2774},"\u002Fcli-runtime-systems-integration\u002Frunning-subprocesses-from-python-clis\u002Fhandling-subprocess-timeouts-and-exit-codes","Handling Subprocess Timeouts and Exit Codes",{"path":2776,"title":2777},"\u002Fcli-runtime-systems-integration\u002Frunning-subprocesses-from-python-clis","Running Subprocesses from Python CLIs",{"path":2779,"title":2780},"\u002Fcli-runtime-systems-integration\u002Frunning-subprocesses-from-python-clis\u002Fstreaming-subprocess-output-in-real-time","Streaming Subprocess Output in Real Time",{"path":2782,"title":2783},"\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":2785,"title":2786},"\u002Fcli-runtime-systems-integration\u002Fsecrets-and-credentials-in-python-clis","Secrets and Credentials in Python CLIs",{"path":2788,"title":2789},"\u002Fcli-runtime-systems-integration\u002Fsecrets-and-credentials-in-python-clis\u002Fprompting-for-passwords-securely","Prompting for Passwords Securely in Python CLIs",{"path":2791,"title":2792},"\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":2794,"title":2795},"\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":2797,"title":2798},"\u002Fcli-runtime-systems-integration\u002Fsecrets-and-credentials-in-python-clis\u002Fstoring-tokens-with-keyring","Storing CLI Tokens Securely with keyring",{"path":2800,"title":2801},"\u002Fcli-runtime-systems-integration\u002Fsecrets-and-credentials-in-python-clis\u002Fsupporting-multiple-profiles-and-accounts","Supporting Multiple Profiles and Accounts in CLIs",{"path":1438,"title":2803},"Python CLI Toolcraft",{"path":2805,"title":2806},"\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":2808,"title":2809},"\u002Fmodern-python-cli-frameworks-architecture\u002Fcli-startup-performance-and-lazy-loading","CLI Startup Performance and Lazy Loading",{"path":2811,"title":2812},"\u002Fmodern-python-cli-frameworks-architecture\u002Fcli-startup-performance-and-lazy-loading\u002Flazy-loading-subcommands-for-faster-startup","Lazy Loading Subcommands for Faster Startup",{"path":2814,"title":2815},"\u002Fmodern-python-cli-frameworks-architecture\u002Fcli-startup-performance-and-lazy-loading\u002Fprofiling-python-cli-startup-time","Profiling Python CLI Startup Time",{"path":2817,"title":2818},"\u002Fmodern-python-cli-frameworks-architecture\u002Fcli-startup-performance-and-lazy-loading\u002Freducing-cli-dependency-weight","Reducing CLI Dependency Weight",{"path":2820,"title":2821},"\u002Fmodern-python-cli-frameworks-architecture\u002Fcommand-line-parsing-with-argparse\u002Fargparse-subparsers-for-subcommands","argparse Subparsers for Subcommands",{"path":2823,"title":2824},"\u002Fmodern-python-cli-frameworks-architecture\u002Fcommand-line-parsing-with-argparse\u002Fargparse-vs-click-vs-typer-comparison","argparse vs Click vs Typer Compared",{"path":2826,"title":2827},"\u002Fmodern-python-cli-frameworks-architecture\u002Fcommand-line-parsing-with-argparse","Command-Line Parsing with argparse",{"path":2829,"title":2830},"\u002Fmodern-python-cli-frameworks-architecture\u002Fcommand-line-parsing-with-argparse\u002Fmigrating-from-argparse-to-typer","Migrating from argparse to Typer",{"path":2832,"title":2833},"\u002Fmodern-python-cli-frameworks-architecture\u002Fcommand-line-parsing-with-argparse\u002Fmutually-exclusive-options-in-argparse","Mutually Exclusive Options in argparse",{"path":2835,"title":2836},"\u002Fmodern-python-cli-frameworks-architecture\u002Fcommand-line-parsing-with-argparse\u002Fwriting-custom-argparse-actions","Writing Custom argparse Actions in Python",{"path":2838,"title":2839},"\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":2841,"title":2842},"\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":2844,"title":2845},"\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":2847,"title":2848},"\u002Fmodern-python-cli-frameworks-architecture\u002Fdesigning-cli-interfaces-and-conventions","Designing CLI Interfaces and Conventions in Python",{"path":2850,"title":2851},"\u002Fmodern-python-cli-frameworks-architecture\u002Fdesigning-cli-interfaces-and-conventions\u002Fnaming-commands-and-flags-consistently","Naming Commands and Flags Consistently in Python CLIs",{"path":2853,"title":2854},"\u002Fmodern-python-cli-frameworks-architecture","Python CLI Frameworks and Architecture",{"path":2856,"title":2857},"\u002Fmodern-python-cli-frameworks-architecture\u002Fplugin-architectures-for-extensible-clis\u002Fdiscovering-plugins-with-entry-points","Discovering Plugins with Entry Points in Python CLIs",{"path":2859,"title":2860},"\u002Fmodern-python-cli-frameworks-architecture\u002Fplugin-architectures-for-extensible-clis\u002Fhook-based-plugins-with-pluggy","Hook-Based Plugins for Python CLIs with pluggy",{"path":2862,"title":2863},"\u002Fmodern-python-cli-frameworks-architecture\u002Fplugin-architectures-for-extensible-clis","Plugin Architectures for Extensible CLIs",{"path":2865,"title":2866},"\u002Fmodern-python-cli-frameworks-architecture\u002Fplugin-architectures-for-extensible-clis\u002Fversioning-a-plugin-api","Versioning a Plugin API for a Python CLI",{"path":2868,"title":2869},"\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":2871,"title":2872},"\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":2874,"title":2875},"\u002Fmodern-python-cli-frameworks-architecture\u002Fstructuring-multi-command-python-clis\u002Fdependency-injection-patterns-for-cli-commands","Dependency Injection Patterns for CLI Commands",{"path":2877,"title":2878},"\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":2880,"title":2881},"\u002Fmodern-python-cli-frameworks-architecture\u002Fstructuring-multi-command-python-clis","Structuring Multi-Command Python CLIs",{"path":2883,"title":2884},"\u002Fmodern-python-cli-frameworks-architecture\u002Fstructuring-multi-command-python-clis\u002Fsharing-common-options-across-commands","Sharing Common Options Across Python CLI Commands",{"path":2886,"title":2887},"\u002Fmodern-python-cli-frameworks-architecture\u002Fstructuring-multi-command-python-clis\u002Fsharing-state-with-click-context-objects","Sharing State with Click Context Objects",{"path":2889,"title":2890},"\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":2892,"title":2893},"\u002Fmodern-python-cli-frameworks-architecture\u002Ftesting-python-cli-applications","Testing Python CLI Applications",{"path":2895,"title":2896},"\u002Fmodern-python-cli-frameworks-architecture\u002Ftesting-python-cli-applications\u002Fmeasuring-cli-test-coverage","Measuring CLI Test Coverage",{"path":2898,"title":2899},"\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":2901,"title":2902},"\u002Fmodern-python-cli-frameworks-architecture\u002Ftesting-python-cli-applications\u002Fproperty-based-testing-cli-arguments-with-hypothesis","Property-Based Testing CLI Arguments with Hypothesis",{"path":2904,"title":2905},"\u002Fmodern-python-cli-frameworks-architecture\u002Ftesting-python-cli-applications\u002Fsnapshot-testing-cli-output","Snapshot Testing CLI Output",{"path":2907,"title":2908},"\u002Fmodern-python-cli-frameworks-architecture\u002Ftesting-python-cli-applications\u002Ftesting-click-commands-with-clirunner","Testing Click Commands with CliRunner",{"path":2910,"title":2911},"\u002Fmodern-python-cli-frameworks-architecture\u002Ftesting-python-cli-applications\u002Ftesting-interactive-prompts-and-stdin","Testing Interactive Prompts and stdin",{"path":2913,"title":2914},"\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":2916,"title":2917},"\u002Fmodern-python-cli-frameworks-architecture\u002Ftyper-vs-click-when-to-use-each\u002Fbuilding-dynamic-commands-in-click","Building Dynamic Commands in Click",{"path":2919,"title":2920},"\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":2922,"title":2923},"\u002Fmodern-python-cli-frameworks-architecture\u002Ftyper-vs-click-when-to-use-each","Typer vs Click: When to Use Each",{"path":2925,"title":2926},"\u002Fmodern-python-cli-frameworks-architecture\u002Ftyper-vs-click-when-to-use-each\u002Ftyper-callback-functions-explained","Typer callback functions explained",{"path":2928,"title":2929},"\u002Fmodern-python-cli-frameworks-architecture\u002Ftyper-vs-click-when-to-use-each\u002Fusing-annotated-options-in-typer","Using Annotated Options in Typer",{"path":2931,"title":2932},"\u002Fproject-setup-dependency-management\u002Fci-cd-pipelines-for-python-clis\u002Fautomating-releases-from-git-tags","Automating Python CLI Releases from Git Tags",{"path":2934,"title":2935},"\u002Fproject-setup-dependency-management\u002Fci-cd-pipelines-for-python-clis\u002Fcaching-uv-dependencies-in-ci","Caching uv Dependencies in CI for Python CLIs",{"path":2937,"title":2938},"\u002Fproject-setup-dependency-management\u002Fci-cd-pipelines-for-python-clis","CI\u002FCD Pipelines for Python CLIs",{"path":2940,"title":2941},"\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":2943,"title":2944},"\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":2946,"title":2947},"\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":2949,"title":2950},"\u002Fproject-setup-dependency-management\u002Fcli-project-scaffolding-with-cookiecutter\u002Fbuilding-a-cookiecutter-template-for-typer-clis","Building a Cookiecutter Template for Typer CLIs",{"path":2952,"title":2953},"\u002Fproject-setup-dependency-management\u002Fcli-project-scaffolding-with-cookiecutter\u002Fcopier-vs-cookiecutter-for-cli-templates","Copier vs Cookiecutter for CLI Templates",{"path":2955,"title":2956},"\u002Fproject-setup-dependency-management\u002Fcli-project-scaffolding-with-cookiecutter","CLI Project Scaffolding with Cookiecutter",{"path":2958,"title":2959},"\u002Fproject-setup-dependency-management\u002Fcli-project-scaffolding-with-cookiecutter\u002Fpost-generation-hooks-in-cli-templates","Post-Generation Hooks in Python CLI Templates",{"path":2961,"title":2962},"\u002Fproject-setup-dependency-management\u002Fdistributing-clis-as-standalone-binaries\u002Fbuilding-cross-platform-release-binaries-in-ci","Building Cross-Platform Release Binaries in CI",{"path":2964,"title":2965},"\u002Fproject-setup-dependency-management\u002Fdistributing-clis-as-standalone-binaries\u002Fbundling-a-python-cli-with-pyinstaller","Bundling a Python CLI with PyInstaller",{"path":2967,"title":2968},"\u002Fproject-setup-dependency-management\u002Fdistributing-clis-as-standalone-binaries\u002Fhomebrew-and-scoop-packaging-for-python-clis","Homebrew and Scoop Packaging for Python CLIs",{"path":2970,"title":2971},"\u002Fproject-setup-dependency-management\u002Fdistributing-clis-as-standalone-binaries","Distributing CLIs as Standalone Binaries",{"path":2973,"title":2974},"\u002Fproject-setup-dependency-management\u002Fdistributing-clis-as-standalone-binaries\u002Fnuitka-vs-pyinstaller-for-python-clis","Nuitka vs PyInstaller for Python CLI Binaries",{"path":2976,"title":2977},"\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":2979,"title":2980},"\u002Fproject-setup-dependency-management","Project Setup & Dependency Management",{"path":2982,"title":2983},"\u002Fproject-setup-dependency-management\u002Flinting-and-type-checking-cli-code\u002Fconfiguring-ruff-for-a-cli-project","Configuring Ruff for a Python CLI Project",{"path":2985,"title":2986},"\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":2988,"title":2989},"\u002Fproject-setup-dependency-management\u002Flinting-and-type-checking-cli-code","Linting and Type-Checking Python CLI Code",{"path":2991,"title":2992},"\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":2994,"title":2995},"\u002Fproject-setup-dependency-management\u002Fmanaging-cli-versioning-changelogs\u002Fautomating-changelogs-with-conventional-commits","Automating Changelogs with Conventional Commits",{"path":2997,"title":2998},"\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":3000,"title":3001},"\u002Fproject-setup-dependency-management\u002Fmanaging-cli-versioning-changelogs\u002Fexposing-version-info-and-build-metadata","Exposing Version Info and Build Metadata",{"path":3003,"title":3004},"\u002Fproject-setup-dependency-management\u002Fmanaging-cli-versioning-changelogs","Managing CLI Versioning & Changelogs",{"path":3006,"title":3007},"\u002Fproject-setup-dependency-management\u002Fmanaging-cli-versioning-changelogs\u002Fsemantic-versioning-policy-for-cli-tools","A Semantic Versioning Policy for CLI Tools",{"path":3009,"title":3010},"\u002Fproject-setup-dependency-management\u002Fpackaging-python-clis-for-distribution\u002Fbuilding-wheels-and-sdists-for-python-clis","Building Wheels and sdists for Python CLIs",{"path":3012,"title":3013},"\u002Fproject-setup-dependency-management\u002Fpackaging-python-clis-for-distribution\u002Fbundling-data-files-with-importlib-resources","Bundling Data Files with importlib.resources in CLIs",{"path":3015,"title":3016},"\u002Fproject-setup-dependency-management\u002Fpackaging-python-clis-for-distribution","Packaging Python CLIs for Distribution",{"path":3018,"title":3019},"\u002Fproject-setup-dependency-management\u002Fpackaging-python-clis-for-distribution\u002Finstalling-and-distributing-clis-with-pipx","Installing and Distributing CLIs with pipx",{"path":3021,"title":3022},"\u002Fproject-setup-dependency-management\u002Fpackaging-python-clis-for-distribution\u002Fpublishing-a-python-cli-to-pypi","Publishing a Python CLI to PyPI",{"path":3024,"title":3025},"\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":3027,"title":3028},"\u002Fproject-setup-dependency-management\u002Fpoetry-workflows-for-cli-development","Poetry Workflows for CLI Development",{"path":3030,"title":3031},"\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":3033,"title":3034},"\u002Fproject-setup-dependency-management\u002Fpoetry-workflows-for-cli-development\u002Fpoetry-dependency-groups-for-cli-tooling","Poetry Dependency Groups for CLI Tooling",{"path":3036,"title":3037},"\u002Fproject-setup-dependency-management\u002Fpoetry-workflows-for-cli-development\u002Fpoetry-entry-points-and-scripts-for-clis","Poetry Entry Points and Scripts for CLIs",{"path":3039,"title":3040},"\u002Fproject-setup-dependency-management\u002Fpre-commit-hooks-for-cli-projects","Pre-commit Hooks for CLI Projects",{"path":3042,"title":3043},"\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":3045,"title":3046},"\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":3048,"title":3049},"\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":3051,"title":3052},"\u002Fproject-setup-dependency-management\u002Fuv-for-python-cli-dependency-management","uv for Python CLI Dependency Management",{"path":3054,"title":3055},"\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":3057,"title":3058},"\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":3060,"title":3061},"\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":3063,"title":3064},"\u002Fproject-setup-dependency-management\u002Fuv-for-python-cli-dependency-management\u002Fuv-workspaces-for-multi-package-clis","uv Workspaces for Multi-Package Python CLIs",{"path":3066,"title":3067},"\u002Fproject-setup-dependency-management\u002Fvirtual-environments-isolation-best-practices","Python CLI Env Isolation Best Practices",{"path":3069,"title":3070},"\u002Fproject-setup-dependency-management\u002Fvirtual-environments-isolation-best-practices\u002Fmanaging-virtual-environments-for-cross-platform-clis","Managing Python CLI Virtual Environments",{"path":3072,"title":3073},"\u002Fproject-setup-dependency-management\u002Fvirtual-environments-isolation-best-practices\u002Fpinning-the-python-version-for-a-cli","Pinning the Python Version for a CLI",{"path":3075,"title":3076},"\u002Fproject-setup-dependency-management\u002Fvirtual-environments-isolation-best-practices\u002Fsupporting-multiple-python-versions-with-nox","Supporting Multiple Python Versions with nox",1789736905048]