[{"data":1,"prerenderedAt":1812},["ShallowReactive",2],{"page-\u002Fproject-setup-dependency-management\u002Fmanaging-cli-versioning-changelogs\u002Fexposing-version-info-and-build-metadata\u002F":3,"content-directory":1566},{"id":4,"title":5,"body":6,"date":1550,"description":1551,"difficulty":1552,"draft":1553,"extension":1554,"meta":1555,"navigation":119,"path":1556,"seo":1557,"stem":1558,"tags":1559,"updated":1550,"__hash__":1565},"content\u002Fproject-setup-dependency-management\u002Fmanaging-cli-versioning-changelogs\u002Fexposing-version-info-and-build-metadata\u002Findex.md","Exposing Version Info and Build Metadata",{"type":7,"value":8,"toc":1526},"minimark",[9,17,22,62,66,78,82,86,186,196,203,207,210,446,449,452,455,459,621,627,637,641,644,790,804,808,811,941,948,952,955,961,1054,1060,1066,1153,1169,1173,1179,1185,1195,1199,1397,1403,1407,1410,1414,1422,1432,1436,1439,1443,1446,1450,1459,1467,1474,1478,1484,1488,1522],[10,11,12,16],"p",{},[13,14,15],"code",{},"--version"," is the first line of every bug report. A bare number answers one question and leaves\nthree unasked: which Python, installed how, and from where. Three lines of output turn a support\nround trip into a single paste.",[18,19,21],"h2",{"id":20},"tldr","TL;DR",[23,24,25,34,41,48,55],"ul",{},[26,27,28,29,33],"li",{},"Read the version from ",[30,31,32],"strong",{},"installed metadata",", never a hard-coded string.",[26,35,36,37,40],{},"Print the ",[30,38,39],{},"Python version and interpreter path"," too — it explains half of all environment bugs.",[26,42,43,44,47],{},"Say how the tool was installed: ",[30,45,46],{},"pipx, source, or frozen",".",[26,49,50,51,54],{},"Make the flag ",[30,52,53],{},"eager"," so it works when the rest of the command line is incomplete.",[26,56,57,58,61],{},"Offer ",[13,59,60],{},"--version --json"," for scripts that check compatibility.",[18,63,65],{"id":64},"prerequisites","Prerequisites",[10,67,68,69,72,73,47],{},"A packaged CLI with a version declared in ",[13,70,71],{},"pyproject.toml",", and the single-source approach from\n",[74,75,77],"a",{"href":76},"\u002Fproject-setup-dependency-management\u002Fmanaging-cli-versioning-changelogs\u002F","managing CLI versioning and changelogs",[18,79,81],{"id":80},"reading-the-version-from-the-right-place","Reading the version from the right place",[83,84],"inline-diagram",{"name":85},"version-source-flow",[87,88,93],"pre",{"className":89,"code":90,"language":91,"meta":92,"style":92},"language-python shiki shiki-themes github-light github-dark","from importlib.metadata import PackageNotFoundError, version\n\ndef get_version() -> str:\n    try:\n        return version(\"mytool\")\n    except PackageNotFoundError:          # running from a source checkout\n        return \"0.0.0+dev\"\n","python","",[13,94,95,114,121,141,149,165,178],{"__ignoreMap":92},[96,97,100,104,108,111],"span",{"class":98,"line":99},"line",1,[96,101,103],{"class":102},"szBVR","from",[96,105,107],{"class":106},"sVt8B"," importlib.metadata ",[96,109,110],{"class":102},"import",[96,112,113],{"class":106}," PackageNotFoundError, version\n",[96,115,117],{"class":98,"line":116},2,[96,118,120],{"emptyLinePlaceholder":119},true,"\n",[96,122,124,127,131,134,138],{"class":98,"line":123},3,[96,125,126],{"class":102},"def",[96,128,130],{"class":129},"sScJk"," get_version",[96,132,133],{"class":106},"() -> ",[96,135,137],{"class":136},"sj4cs","str",[96,139,140],{"class":106},":\n",[96,142,144,147],{"class":98,"line":143},4,[96,145,146],{"class":102},"    try",[96,148,140],{"class":106},[96,150,152,155,158,162],{"class":98,"line":151},5,[96,153,154],{"class":102},"        return",[96,156,157],{"class":106}," version(",[96,159,161],{"class":160},"sZZnC","\"mytool\"",[96,163,164],{"class":106},")\n",[96,166,168,171,174],{"class":98,"line":167},6,[96,169,170],{"class":102},"    except",[96,172,173],{"class":106}," PackageNotFoundError:          ",[96,175,177],{"class":176},"sJ8bj","# running from a source checkout\n",[96,179,181,183],{"class":98,"line":180},7,[96,182,154],{"class":102},[96,184,185],{"class":160}," \"0.0.0+dev\"\n",[10,187,188,189,192,193,195],{},"This reads what was actually packaged, so the reported number cannot disagree with the wheel a user\ninstalled. The alternative — a ",[13,190,191],{},"__version__"," constant maintained alongside the metadata — is the\narrangement that eventually ships a ",[13,194,15],{}," that lies, usually right after a release where\nsomebody bumped one and not the other.",[10,197,198,199,202],{},"The ",[13,200,201],{},"PackageNotFoundError"," branch matters during development, when the package may not be installed\nat all. Returning something clearly marked as a development build is better than crashing, and\nbetter than reporting a number that came from nowhere.",[18,204,206],{"id":205},"what-to-print","What to print",[83,208],{"name":209},"version-output-anatomy",[87,211,213],{"className":89,"code":212,"language":91,"meta":92,"style":92},"import platform\nimport sys\n\ndef version_lines() -> list[str]:\n    return [\n        f\"mytool {get_version()}\",\n        f\"python {platform.python_version()} ({sys.executable})\",\n        f\"install {install_form()}\",\n    ]\n\ndef install_form() -> str:\n    if getattr(sys, \"frozen\", False):\n        return \"frozen\"\n    if \"pipx\" in sys.prefix or \"uv\u002Ftools\" in sys.prefix:\n        return \"isolated (pipx \u002F uv tool)\"\n    if sys.prefix != sys.base_prefix:\n        return \"virtualenv\"\n    return \"system\"\n",[13,214,215,222,229,233,248,256,279,308,327,333,338,352,376,384,409,417,430,438],{"__ignoreMap":92},[96,216,217,219],{"class":98,"line":99},[96,218,110],{"class":102},[96,220,221],{"class":106}," platform\n",[96,223,224,226],{"class":98,"line":116},[96,225,110],{"class":102},[96,227,228],{"class":106}," sys\n",[96,230,231],{"class":98,"line":123},[96,232,120],{"emptyLinePlaceholder":119},[96,234,235,237,240,243,245],{"class":98,"line":143},[96,236,126],{"class":102},[96,238,239],{"class":129}," version_lines",[96,241,242],{"class":106},"() -> list[",[96,244,137],{"class":136},[96,246,247],{"class":106},"]:\n",[96,249,250,253],{"class":98,"line":151},[96,251,252],{"class":102},"    return",[96,254,255],{"class":106}," [\n",[96,257,258,261,264,267,270,273,276],{"class":98,"line":167},[96,259,260],{"class":102},"        f",[96,262,263],{"class":160},"\"mytool ",[96,265,266],{"class":136},"{",[96,268,269],{"class":106},"get_version()",[96,271,272],{"class":136},"}",[96,274,275],{"class":160},"\"",[96,277,278],{"class":106},",\n",[96,280,281,283,286,288,291,293,296,298,301,303,306],{"class":98,"line":180},[96,282,260],{"class":102},[96,284,285],{"class":160},"\"python ",[96,287,266],{"class":136},[96,289,290],{"class":106},"platform.python_version()",[96,292,272],{"class":136},[96,294,295],{"class":160}," (",[96,297,266],{"class":136},[96,299,300],{"class":106},"sys.executable",[96,302,272],{"class":136},[96,304,305],{"class":160},")\"",[96,307,278],{"class":106},[96,309,311,313,316,318,321,323,325],{"class":98,"line":310},8,[96,312,260],{"class":102},[96,314,315],{"class":160},"\"install ",[96,317,266],{"class":136},[96,319,320],{"class":106},"install_form()",[96,322,272],{"class":136},[96,324,275],{"class":160},[96,326,278],{"class":106},[96,328,330],{"class":98,"line":329},9,[96,331,332],{"class":106},"    ]\n",[96,334,336],{"class":98,"line":335},10,[96,337,120],{"emptyLinePlaceholder":119},[96,339,341,343,346,348,350],{"class":98,"line":340},11,[96,342,126],{"class":102},[96,344,345],{"class":129}," install_form",[96,347,133],{"class":106},[96,349,137],{"class":136},[96,351,140],{"class":106},[96,353,355,358,361,364,367,370,373],{"class":98,"line":354},12,[96,356,357],{"class":102},"    if",[96,359,360],{"class":136}," getattr",[96,362,363],{"class":106},"(sys, ",[96,365,366],{"class":160},"\"frozen\"",[96,368,369],{"class":106},", ",[96,371,372],{"class":136},"False",[96,374,375],{"class":106},"):\n",[96,377,379,381],{"class":98,"line":378},13,[96,380,154],{"class":102},[96,382,383],{"class":160}," \"frozen\"\n",[96,385,387,389,392,395,398,401,404,406],{"class":98,"line":386},14,[96,388,357],{"class":102},[96,390,391],{"class":160}," \"pipx\"",[96,393,394],{"class":102}," in",[96,396,397],{"class":106}," sys.prefix ",[96,399,400],{"class":102},"or",[96,402,403],{"class":160}," \"uv\u002Ftools\"",[96,405,394],{"class":102},[96,407,408],{"class":106}," sys.prefix:\n",[96,410,412,414],{"class":98,"line":411},15,[96,413,154],{"class":102},[96,415,416],{"class":160}," \"isolated (pipx \u002F uv tool)\"\n",[96,418,420,422,424,427],{"class":98,"line":419},16,[96,421,357],{"class":102},[96,423,397],{"class":106},[96,425,426],{"class":102},"!=",[96,428,429],{"class":106}," sys.base_prefix:\n",[96,431,433,435],{"class":98,"line":432},17,[96,434,154],{"class":102},[96,436,437],{"class":160}," \"virtualenv\"\n",[96,439,441,443],{"class":98,"line":440},18,[96,442,252],{"class":102},[96,444,445],{"class":160}," \"system\"\n",[83,447],{"name":448},"build-metadata-matrix",[10,450,451],{},"Three lines, and each answers a question that otherwise costs a message. The interpreter path is the\none people underestimate: \"I installed it but the command runs an old version\" is nearly always two\nenvironments, and the path says so immediately.",[10,453,454],{},"What to leave out is a build timestamp. It makes two builds of the same commit differ, which\nundermines reproducible builds and adds nothing a version and a commit do not already say.",[18,456,458],{"id":457},"making-the-flag-behave","Making the flag behave",[87,460,462],{"className":89,"code":461,"language":91,"meta":92,"style":92},"def version_callback(value: bool) -> None:\n    if value:\n        for line in version_lines():\n            typer.echo(line)\n        raise typer.Exit()\n\n@app.callback()\ndef main(\n    show_version: Annotated[\n        bool,\n        typer.Option(\"--version\", callback=version_callback, is_eager=True,\n                     help=\"Show version information and exit.\"),\n    ] = False,\n) -> None:\n    ...\n",[13,463,464,485,492,506,511,519,523,531,541,546,553,583,596,608,616],{"__ignoreMap":92},[96,465,466,468,471,474,477,480,483],{"class":98,"line":99},[96,467,126],{"class":102},[96,469,470],{"class":129}," version_callback",[96,472,473],{"class":106},"(value: ",[96,475,476],{"class":136},"bool",[96,478,479],{"class":106},") -> ",[96,481,482],{"class":136},"None",[96,484,140],{"class":106},[96,486,487,489],{"class":98,"line":116},[96,488,357],{"class":102},[96,490,491],{"class":106}," value:\n",[96,493,494,497,500,503],{"class":98,"line":123},[96,495,496],{"class":102},"        for",[96,498,499],{"class":106}," line ",[96,501,502],{"class":102},"in",[96,504,505],{"class":106}," version_lines():\n",[96,507,508],{"class":98,"line":143},[96,509,510],{"class":106},"            typer.echo(line)\n",[96,512,513,516],{"class":98,"line":151},[96,514,515],{"class":102},"        raise",[96,517,518],{"class":106}," typer.Exit()\n",[96,520,521],{"class":98,"line":167},[96,522,120],{"emptyLinePlaceholder":119},[96,524,525,528],{"class":98,"line":180},[96,526,527],{"class":129},"@app.callback",[96,529,530],{"class":106},"()\n",[96,532,533,535,538],{"class":98,"line":310},[96,534,126],{"class":102},[96,536,537],{"class":129}," main",[96,539,540],{"class":106},"(\n",[96,542,543],{"class":98,"line":329},[96,544,545],{"class":106},"    show_version: Annotated[\n",[96,547,548,551],{"class":98,"line":335},[96,549,550],{"class":136},"        bool",[96,552,278],{"class":106},[96,554,555,558,561,563,567,570,573,576,578,581],{"class":98,"line":340},[96,556,557],{"class":106},"        typer.Option(",[96,559,560],{"class":160},"\"--version\"",[96,562,369],{"class":106},[96,564,566],{"class":565},"s4XuR","callback",[96,568,569],{"class":102},"=",[96,571,572],{"class":106},"version_callback, ",[96,574,575],{"class":565},"is_eager",[96,577,569],{"class":102},[96,579,580],{"class":136},"True",[96,582,278],{"class":106},[96,584,585,588,590,593],{"class":98,"line":354},[96,586,587],{"class":565},"                     help",[96,589,569],{"class":102},[96,591,592],{"class":160},"\"Show version information and exit.\"",[96,594,595],{"class":106},"),\n",[96,597,598,601,603,606],{"class":98,"line":378},[96,599,600],{"class":106},"    ] ",[96,602,569],{"class":102},[96,604,605],{"class":136}," False",[96,607,278],{"class":106},[96,609,610,612,614],{"class":98,"line":386},[96,611,479],{"class":106},[96,613,482],{"class":136},[96,615,140],{"class":106},[96,617,618],{"class":98,"line":411},[96,619,620],{"class":136},"    ...\n",[10,622,623,626],{},[13,624,625],{},"is_eager=True"," is the important part. Without it the flag is processed in declaration order, so a\nmissing required argument raises a usage error before your callback runs — and a user trying to\nreport which version they have gets an error about something else entirely.",[10,628,629,630,633,634,47],{},"Print to ",[30,631,632],{},"stdout",", not stderr: version output is the result of the command the user asked for,\nand people pipe it into ",[13,635,636],{},"grep",[18,638,640],{"id":639},"a-machine-readable-form","A machine-readable form",[10,642,643],{},"Scripts check versions too — an installer verifying a minimum, a CI step branching on capability.\nGive them something better than parsing a sentence:",[87,645,647],{"className":89,"code":646,"language":91,"meta":92,"style":92},"@app.command()\ndef version(\n    json_output: Annotated[bool, typer.Option(\"--json\", help=\"Emit machine-readable output.\")] = False,\n) -> None:\n    \"\"\"Show version and environment information.\"\"\"\n    payload = {\n        \"version\": get_version(),\n        \"python\": platform.python_version(),\n        \"executable\": sys.executable,\n        \"install\": install_form(),\n    }\n    if json_output:\n        typer.echo(json.dumps(payload))\n        return\n    for line in version_lines():\n        typer.echo(line)\n",[13,648,649,656,665,697,705,710,720,728,736,744,752,757,764,769,774,785],{"__ignoreMap":92},[96,650,651,654],{"class":98,"line":99},[96,652,653],{"class":129},"@app.command",[96,655,530],{"class":106},[96,657,658,660,663],{"class":98,"line":116},[96,659,126],{"class":102},[96,661,662],{"class":129}," version",[96,664,540],{"class":106},[96,666,667,670,672,675,678,680,683,685,688,691,693,695],{"class":98,"line":123},[96,668,669],{"class":106},"    json_output: Annotated[",[96,671,476],{"class":136},[96,673,674],{"class":106},", typer.Option(",[96,676,677],{"class":160},"\"--json\"",[96,679,369],{"class":106},[96,681,682],{"class":565},"help",[96,684,569],{"class":102},[96,686,687],{"class":160},"\"Emit machine-readable output.\"",[96,689,690],{"class":106},")] ",[96,692,569],{"class":102},[96,694,605],{"class":136},[96,696,278],{"class":106},[96,698,699,701,703],{"class":98,"line":143},[96,700,479],{"class":106},[96,702,482],{"class":136},[96,704,140],{"class":106},[96,706,707],{"class":98,"line":151},[96,708,709],{"class":160},"    \"\"\"Show version and environment information.\"\"\"\n",[96,711,712,715,717],{"class":98,"line":167},[96,713,714],{"class":106},"    payload ",[96,716,569],{"class":102},[96,718,719],{"class":106}," {\n",[96,721,722,725],{"class":98,"line":180},[96,723,724],{"class":160},"        \"version\"",[96,726,727],{"class":106},": get_version(),\n",[96,729,730,733],{"class":98,"line":310},[96,731,732],{"class":160},"        \"python\"",[96,734,735],{"class":106},": platform.python_version(),\n",[96,737,738,741],{"class":98,"line":329},[96,739,740],{"class":160},"        \"executable\"",[96,742,743],{"class":106},": sys.executable,\n",[96,745,746,749],{"class":98,"line":335},[96,747,748],{"class":160},"        \"install\"",[96,750,751],{"class":106},": install_form(),\n",[96,753,754],{"class":98,"line":340},[96,755,756],{"class":106},"    }\n",[96,758,759,761],{"class":98,"line":354},[96,760,357],{"class":102},[96,762,763],{"class":106}," json_output:\n",[96,765,766],{"class":98,"line":378},[96,767,768],{"class":106},"        typer.echo(json.dumps(payload))\n",[96,770,771],{"class":98,"line":386},[96,772,773],{"class":102},"        return\n",[96,775,776,779,781,783],{"class":98,"line":411},[96,777,778],{"class":102},"    for",[96,780,499],{"class":106},[96,782,502],{"class":102},[96,784,505],{"class":106},[96,786,787],{"class":98,"line":419},[96,788,789],{"class":106},"        typer.echo(line)\n",[10,791,792,793,795,796,799,800,803],{},"Having both a ",[13,794,15],{}," flag and a ",[13,797,798],{},"version"," command is normal and worth doing: the flag is what\npeople type, and the command is where the richer output and the ",[13,801,802],{},"--json"," mode live.",[18,805,807],{"id":806},"extending-it-into-a-doctor-command","Extending it into a doctor command",[10,809,810],{},"Once you are reporting the environment, a slightly fuller diagnostic command is a small addition and\nremoves a large class of support question:",[87,812,814],{"className":89,"code":813,"language":91,"meta":92,"style":92},"@app.command()\ndef doctor() -> None:\n    \"\"\"Print everything useful for a bug report.\"\"\"\n    for line in version_lines():\n        typer.echo(line)\n    typer.echo(f\"config    {settings_path() or '(none found)'}\")\n    typer.echo(f\"plugins   {', '.join(loaded_plugins()) or '(none)'}\")\n    typer.echo(f\"colour    {'on' if presentation.colour else 'off'}\")\n",[13,815,816,822,835,840,850,854,881,909],{"__ignoreMap":92},[96,817,818,820],{"class":98,"line":99},[96,819,653],{"class":129},[96,821,530],{"class":106},[96,823,824,826,829,831,833],{"class":98,"line":116},[96,825,126],{"class":102},[96,827,828],{"class":129}," doctor",[96,830,133],{"class":106},[96,832,482],{"class":136},[96,834,140],{"class":106},[96,836,837],{"class":98,"line":123},[96,838,839],{"class":160},"    \"\"\"Print everything useful for a bug report.\"\"\"\n",[96,841,842,844,846,848],{"class":98,"line":143},[96,843,778],{"class":102},[96,845,499],{"class":106},[96,847,502],{"class":102},[96,849,505],{"class":106},[96,851,852],{"class":98,"line":151},[96,853,789],{"class":106},[96,855,856,859,862,865,867,870,872,875,877,879],{"class":98,"line":167},[96,857,858],{"class":106},"    typer.echo(",[96,860,861],{"class":102},"f",[96,863,864],{"class":160},"\"config    ",[96,866,266],{"class":136},[96,868,869],{"class":106},"settings_path() ",[96,871,400],{"class":102},[96,873,874],{"class":160}," '(none found)'",[96,876,272],{"class":136},[96,878,275],{"class":160},[96,880,164],{"class":106},[96,882,883,885,887,890,892,895,898,900,903,905,907],{"class":98,"line":180},[96,884,858],{"class":106},[96,886,861],{"class":102},[96,888,889],{"class":160},"\"plugins   ",[96,891,266],{"class":136},[96,893,894],{"class":160},"', '",[96,896,897],{"class":106},".join(loaded_plugins()) ",[96,899,400],{"class":102},[96,901,902],{"class":160}," '(none)'",[96,904,272],{"class":136},[96,906,275],{"class":160},[96,908,164],{"class":106},[96,910,911,913,915,918,920,923,926,929,932,935,937,939],{"class":98,"line":310},[96,912,858],{"class":106},[96,914,861],{"class":102},[96,916,917],{"class":160},"\"colour    ",[96,919,266],{"class":136},[96,921,922],{"class":160},"'on'",[96,924,925],{"class":102}," if",[96,927,928],{"class":106}," presentation.colour ",[96,930,931],{"class":102},"else",[96,933,934],{"class":160}," 'off'",[96,936,272],{"class":136},[96,938,275],{"class":160},[96,940,164],{"class":106},[10,942,943,944,947],{},"Four more lines, and \"why is it not using my config\" and \"why is my output plain\" both become\nself-service. Point at it in your issue template — \"please include the output of ",[13,945,946],{},"mytool doctor","\" —\nand most reports arrive complete.",[18,949,951],{"id":950},"reporting-what-else-is-installed","Reporting what else is installed",[10,953,954],{},"For a tool with plugins or optional extras, the version alone is not the whole environment. Two\nadditions cover the rest.",[10,956,957,960],{},[30,958,959],{},"Which extras are present."," A user reporting that a command is missing usually installed the base\npackage without the extra it needs:",[87,962,964],{"className":89,"code":963,"language":91,"meta":92,"style":92},"def installed_extras() -> list[str]:\n    present = []\n    for extra, module in {\"analysis\": \"pandas\", \"aws\": \"boto3\"}.items():\n        if importlib.util.find_spec(module) is not None:\n            present.append(extra)\n    return present\n",[13,965,966,979,989,1023,1042,1047],{"__ignoreMap":92},[96,967,968,970,973,975,977],{"class":98,"line":99},[96,969,126],{"class":102},[96,971,972],{"class":129}," installed_extras",[96,974,242],{"class":106},[96,976,137],{"class":136},[96,978,247],{"class":106},[96,980,981,984,986],{"class":98,"line":116},[96,982,983],{"class":106},"    present ",[96,985,569],{"class":102},[96,987,988],{"class":106}," []\n",[96,990,991,993,996,998,1001,1004,1007,1010,1012,1015,1017,1020],{"class":98,"line":123},[96,992,778],{"class":102},[96,994,995],{"class":106}," extra, module ",[96,997,502],{"class":102},[96,999,1000],{"class":106}," {",[96,1002,1003],{"class":160},"\"analysis\"",[96,1005,1006],{"class":106},": ",[96,1008,1009],{"class":160},"\"pandas\"",[96,1011,369],{"class":106},[96,1013,1014],{"class":160},"\"aws\"",[96,1016,1006],{"class":106},[96,1018,1019],{"class":160},"\"boto3\"",[96,1021,1022],{"class":106},"}.items():\n",[96,1024,1025,1028,1031,1034,1037,1040],{"class":98,"line":143},[96,1026,1027],{"class":102},"        if",[96,1029,1030],{"class":106}," importlib.util.find_spec(module) ",[96,1032,1033],{"class":102},"is",[96,1035,1036],{"class":102}," not",[96,1038,1039],{"class":136}," None",[96,1041,140],{"class":106},[96,1043,1044],{"class":98,"line":151},[96,1045,1046],{"class":106},"            present.append(extra)\n",[96,1048,1049,1051],{"class":98,"line":167},[96,1050,252],{"class":102},[96,1052,1053],{"class":106}," present\n",[10,1055,1056,1059],{},[13,1057,1058],{},"find_spec"," checks availability without importing, so this costs nothing at start-up — which\nmatters, because the whole point of an extra is that its import is expensive.",[10,1061,1062,1065],{},[30,1063,1064],{},"Which plugins loaded."," For a host CLI, the list of discovered plugins and their versions answers\n\"is this behaviour from the tool or from something I installed\":",[87,1067,1069],{"className":89,"code":1068,"language":91,"meta":92,"style":92},"def loaded_plugins() -> list[str]:\n    return [\n        f\"{ep.name} {version(ep.dist.name)}\"\n        for ep in entry_points(group=\"mytool.plugins\")\n        if ep.dist is not None\n    ]\n",[13,1070,1071,1084,1090,1113,1135,1149],{"__ignoreMap":92},[96,1072,1073,1075,1078,1080,1082],{"class":98,"line":99},[96,1074,126],{"class":102},[96,1076,1077],{"class":129}," loaded_plugins",[96,1079,242],{"class":106},[96,1081,137],{"class":136},[96,1083,247],{"class":106},[96,1085,1086,1088],{"class":98,"line":116},[96,1087,252],{"class":102},[96,1089,255],{"class":106},[96,1091,1092,1094,1096,1098,1101,1103,1105,1108,1110],{"class":98,"line":123},[96,1093,260],{"class":102},[96,1095,275],{"class":160},[96,1097,266],{"class":136},[96,1099,1100],{"class":106},"ep.name",[96,1102,272],{"class":136},[96,1104,1000],{"class":136},[96,1106,1107],{"class":106},"version(ep.dist.name)",[96,1109,272],{"class":136},[96,1111,1112],{"class":160},"\"\n",[96,1114,1115,1117,1120,1122,1125,1128,1130,1133],{"class":98,"line":143},[96,1116,496],{"class":102},[96,1118,1119],{"class":106}," ep ",[96,1121,502],{"class":102},[96,1123,1124],{"class":106}," entry_points(",[96,1126,1127],{"class":565},"group",[96,1129,569],{"class":102},[96,1131,1132],{"class":160},"\"mytool.plugins\"",[96,1134,164],{"class":106},[96,1136,1137,1139,1142,1144,1146],{"class":98,"line":151},[96,1138,1027],{"class":102},[96,1140,1141],{"class":106}," ep.dist ",[96,1143,1033],{"class":102},[96,1145,1036],{"class":102},[96,1147,1148],{"class":136}," None\n",[96,1150,1151],{"class":98,"line":167},[96,1152,332],{"class":106},[10,1154,1155,1156,1159,1160,1162,1163,1165,1166,1168],{},"Both belong in the fuller ",[13,1157,1158],{},"doctor"," output rather than in ",[13,1161,15],{},", which should stay short. The\ndivision that works: ",[13,1164,15],{}," is what people paste into a message, and ",[13,1167,1158],{}," is what you ask\nfor when the first three lines were not enough.",[18,1170,1172],{"id":1171},"ux-considerations","UX considerations",[10,1174,1175,1178],{},[30,1176,1177],{},"Keep the default output short."," Three lines, plain text, no colour. This output is pasted into\nissue trackers and chat, where escape sequences render as noise.",[10,1180,1181,1184],{},[30,1182,1183],{},"Do not phone home."," A version check that contacts a server on every invocation adds latency,\nfails offline, and surprises people. If you want to notify about upgrades, do it at most once a day,\ncache the result, and provide a way to switch it off.",[10,1186,1187,1190,1191,1194],{},[30,1188,1189],{},"Match what the package manager reports."," If ",[13,1192,1193],{},"pipx list"," says 1.4.0 and your tool says 1.3.2,\nsomething is wrong — usually two installs. Reading the installed metadata is what keeps them in\nagreement.",[18,1196,1198],{"id":1197},"testing-the-behaviour","Testing the behaviour",[87,1200,1202],{"className":89,"code":1201,"language":91,"meta":92,"style":92},"def test_version_reports_the_installed_version(cli):\n    result = cli.invoke(app, [\"--version\"])\n\n    assert result.exit_code == 0\n    assert version(\"mytool\") in result.stdout\n\ndef test_version_works_without_configuration(cli, tmp_path, monkeypatch):\n    monkeypatch.chdir(tmp_path)          # no config file anywhere\n    assert cli.invoke(app, [\"--version\"]).exit_code == 0\n\ndef test_version_is_eager(cli):\n    # --version must win even though 'sync' is missing its required argument\n    result = cli.invoke(app, [\"--version\", \"sync\"])\n    assert result.exit_code == 0\n\ndef test_json_version_is_parseable(cli):\n    payload = json.loads(cli.invoke(app, [\"version\", \"--json\"]).stdout)\n    assert payload[\"version\"] == version(\"mytool\")\n",[13,1203,1204,1214,1229,1233,1247,1263,1267,1277,1285,1300,1304,1313,1318,1335,1345,1349,1358,1377],{"__ignoreMap":92},[96,1205,1206,1208,1211],{"class":98,"line":99},[96,1207,126],{"class":102},[96,1209,1210],{"class":129}," test_version_reports_the_installed_version",[96,1212,1213],{"class":106},"(cli):\n",[96,1215,1216,1219,1221,1224,1226],{"class":98,"line":116},[96,1217,1218],{"class":106},"    result ",[96,1220,569],{"class":102},[96,1222,1223],{"class":106}," cli.invoke(app, [",[96,1225,560],{"class":160},[96,1227,1228],{"class":106},"])\n",[96,1230,1231],{"class":98,"line":123},[96,1232,120],{"emptyLinePlaceholder":119},[96,1234,1235,1238,1241,1244],{"class":98,"line":143},[96,1236,1237],{"class":102},"    assert",[96,1239,1240],{"class":106}," result.exit_code ",[96,1242,1243],{"class":102},"==",[96,1245,1246],{"class":136}," 0\n",[96,1248,1249,1251,1253,1255,1258,1260],{"class":98,"line":151},[96,1250,1237],{"class":102},[96,1252,157],{"class":106},[96,1254,161],{"class":160},[96,1256,1257],{"class":106},") ",[96,1259,502],{"class":102},[96,1261,1262],{"class":106}," result.stdout\n",[96,1264,1265],{"class":98,"line":167},[96,1266,120],{"emptyLinePlaceholder":119},[96,1268,1269,1271,1274],{"class":98,"line":180},[96,1270,126],{"class":102},[96,1272,1273],{"class":129}," test_version_works_without_configuration",[96,1275,1276],{"class":106},"(cli, tmp_path, monkeypatch):\n",[96,1278,1279,1282],{"class":98,"line":310},[96,1280,1281],{"class":106},"    monkeypatch.chdir(tmp_path)          ",[96,1283,1284],{"class":176},"# no config file anywhere\n",[96,1286,1287,1289,1291,1293,1296,1298],{"class":98,"line":329},[96,1288,1237],{"class":102},[96,1290,1223],{"class":106},[96,1292,560],{"class":160},[96,1294,1295],{"class":106},"]).exit_code ",[96,1297,1243],{"class":102},[96,1299,1246],{"class":136},[96,1301,1302],{"class":98,"line":335},[96,1303,120],{"emptyLinePlaceholder":119},[96,1305,1306,1308,1311],{"class":98,"line":340},[96,1307,126],{"class":102},[96,1309,1310],{"class":129}," test_version_is_eager",[96,1312,1213],{"class":106},[96,1314,1315],{"class":98,"line":354},[96,1316,1317],{"class":176},"    # --version must win even though 'sync' is missing its required argument\n",[96,1319,1320,1322,1324,1326,1328,1330,1333],{"class":98,"line":378},[96,1321,1218],{"class":106},[96,1323,569],{"class":102},[96,1325,1223],{"class":106},[96,1327,560],{"class":160},[96,1329,369],{"class":106},[96,1331,1332],{"class":160},"\"sync\"",[96,1334,1228],{"class":106},[96,1336,1337,1339,1341,1343],{"class":98,"line":386},[96,1338,1237],{"class":102},[96,1340,1240],{"class":106},[96,1342,1243],{"class":102},[96,1344,1246],{"class":136},[96,1346,1347],{"class":98,"line":411},[96,1348,120],{"emptyLinePlaceholder":119},[96,1350,1351,1353,1356],{"class":98,"line":419},[96,1352,126],{"class":102},[96,1354,1355],{"class":129}," test_json_version_is_parseable",[96,1357,1213],{"class":106},[96,1359,1360,1362,1364,1367,1370,1372,1374],{"class":98,"line":432},[96,1361,714],{"class":106},[96,1363,569],{"class":102},[96,1365,1366],{"class":106}," json.loads(cli.invoke(app, [",[96,1368,1369],{"class":160},"\"version\"",[96,1371,369],{"class":106},[96,1373,677],{"class":160},[96,1375,1376],{"class":106},"]).stdout)\n",[96,1378,1379,1381,1384,1386,1389,1391,1393,1395],{"class":98,"line":440},[96,1380,1237],{"class":102},[96,1382,1383],{"class":106}," payload[",[96,1385,1369],{"class":160},[96,1387,1388],{"class":106},"] ",[96,1390,1243],{"class":102},[96,1392,157],{"class":106},[96,1394,161],{"class":160},[96,1396,164],{"class":106},[10,1398,1399,1400,1402],{},"The second and third are the ones that catch real regressions. A ",[13,1401,15],{}," that needs a valid\nconfiguration file, or that loses to a usage error, is broken in exactly the situation where someone\nis trying to tell you what they are running.",[18,1404,1406],{"id":1405},"conclusion","Conclusion",[10,1408,1409],{},"Read the version from the installed metadata, print the interpreter alongside it, say how the tool\nwas installed, and make the flag eager. Four small decisions, three lines of output, and most\n\"works on my machine\" conversations end before they start.",[18,1411,1413],{"id":1412},"frequently-asked-questions","Frequently asked questions",[1415,1416,1418,1419,1421],"h3",{"id":1417},"why-not-just-hard-code-__version__","Why not just hard-code ",[13,1420,191],{},"?",[10,1423,1424,1425,1428,1429,1431],{},"Because it can disagree with the packaged metadata, and eventually will. ",[13,1426,1427],{},"importlib.metadata","\nreads what the installer recorded, which is what the user actually has. If you want a\n",[13,1430,191],{}," attribute for convenience, derive it from the metadata rather than the other way\nround.",[1415,1433,1435],{"id":1434},"does-reading-metadata-slow-start-up","Does reading metadata slow start-up?",[10,1437,1438],{},"Very slightly — a few milliseconds on first call, since it reads the distribution's metadata files.\nCall it lazily inside the version callback rather than at module import, and it costs nothing on\nevery other invocation.",[1415,1440,1442],{"id":1441},"should-i-include-the-git-commit","Should I include the git commit?",[10,1444,1445],{},"For pre-releases and development builds, yes: it pins an exact build when the version number cannot.\nFor tagged releases it is redundant, and if you include it you need the build to know it, which\nusually means a build backend that derives the version from git anyway.",[1415,1447,1449],{"id":1448},"what-if-my-tool-is-installed-as-a-frozen-binary","What if my tool is installed as a frozen binary?",[10,1451,1452,1455,1456,1458],{},[13,1453,1454],{},"sys.frozen"," is set, and ",[13,1457,1427],{}," may not find the distribution inside the bundle — so\nbake the version in at build time as a fallback and report the install form as \"frozen\". Users of a\nfrozen binary are the most likely to have lost track of where it came from.",[1415,1460,1462,1463,1466],{"id":1461},"is-v-worth-adding-as-a-short-flag","Is ",[13,1464,1465],{},"-V"," worth adding as a short flag?",[10,1468,1469,1470,1473],{},"Yes, it is a widespread convention and costs one string in the option declaration. Avoid lowercase\n",[13,1471,1472],{},"-v",", which almost every tool uses for verbosity — the collision confuses more people than the\nshortcut helps.",[1415,1475,1477],{"id":1476},"should-the-version-output-be-stable-enough-to-snapshot-in-tests","Should the version output be stable enough to snapshot in tests?",[10,1479,1480,1481,1483],{},"Only the shape, not the values. The version number and interpreter path change legitimately between\nmachines and releases, so pin the structure — three lines, each starting with a known label — and\nassert the actual version against ",[13,1482,1427],{}," rather than against a literal.",[18,1485,1487],{"id":1486},"related","Related",[23,1489,1490,1496,1503,1509,1516],{},[26,1491,1492,1493],{},"Up: ",[74,1494,1495],{"href":76},"Managing CLI versioning and changelogs",[26,1497,1498,1499],{},"Sideways: ",[74,1500,1502],{"href":1501},"\u002Fproject-setup-dependency-management\u002Fmanaging-cli-versioning-changelogs\u002Fautomating-changelogs-with-conventional-commits\u002F","Automating changelogs with Conventional Commits",[26,1504,1498,1505],{},[74,1506,1508],{"href":1507},"\u002Fproject-setup-dependency-management\u002Fvirtual-environments-isolation-best-practices\u002Fpinning-the-python-version-for-a-cli\u002F","Pinning the Python version for a CLI",[26,1510,1511,1512],{},"Related: ",[74,1513,1515],{"href":1514},"\u002Fmodern-python-cli-frameworks-architecture\u002Fstructuring-multi-command-python-clis\u002Fbest-practices-for-python-cli-entry-points\u002F","Best practices for Python CLI entry points",[26,1517,1511,1518],{},[74,1519,1521],{"href":1520},"\u002Fmodern-python-cli-frameworks-architecture\u002Ftyper-vs-click-when-to-use-each\u002Ftyper-callback-functions-explained\u002F","Typer callback functions explained",[1523,1524,1525],"style",{},"html pre.shiki code .szBVR, html code.shiki .szBVR{--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .sVt8B, html code.shiki .sVt8B{--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .sScJk, html code.shiki .sScJk{--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sj4cs, html code.shiki .sj4cs{--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .sZZnC, html code.shiki .sZZnC{--shiki-default:#032F62;--shiki-dark:#9ECBFF}html pre.shiki code .sJ8bj, html code.shiki .sJ8bj{--shiki-default:#6A737D;--shiki-dark:#6A737D}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":92,"searchDepth":116,"depth":116,"links":1527},[1528,1529,1530,1531,1532,1533,1534,1535,1536,1537,1538,1539,1549],{"id":20,"depth":116,"text":21},{"id":64,"depth":116,"text":65},{"id":80,"depth":116,"text":81},{"id":205,"depth":116,"text":206},{"id":457,"depth":116,"text":458},{"id":639,"depth":116,"text":640},{"id":806,"depth":116,"text":807},{"id":950,"depth":116,"text":951},{"id":1171,"depth":116,"text":1172},{"id":1197,"depth":116,"text":1198},{"id":1405,"depth":116,"text":1406},{"id":1412,"depth":116,"text":1413,"children":1540},[1541,1543,1544,1545,1546,1548],{"id":1417,"depth":123,"text":1542},"Why not just hard-code __version__?",{"id":1434,"depth":123,"text":1435},{"id":1441,"depth":123,"text":1442},{"id":1448,"depth":123,"text":1449},{"id":1461,"depth":123,"text":1547},"Is -V worth adding as a short flag?",{"id":1476,"depth":123,"text":1477},{"id":1486,"depth":116,"text":1487},"2026-08-01","Make --version useful - read the installed metadata, report the interpreter and install form, and give bug reports everything they need in three lines.","beginner",false,"md",{},"\u002Fproject-setup-dependency-management\u002Fmanaging-cli-versioning-changelogs\u002Fexposing-version-info-and-build-metadata",{"title":5,"description":1551},"project-setup-dependency-management\u002Fmanaging-cli-versioning-changelogs\u002Fexposing-version-info-and-build-metadata\u002Findex",[1560,1561,1562,1563,1564],"versioning","metadata","debugging","packaging","ux","h_CfDU7eYeIGS03loksRR1oUmMB1kboHnGmqKrfUlOs",[1567,1570,1573,1576,1579,1582,1585,1588,1591,1594,1597,1600,1603,1606,1609,1612,1615,1618,1621,1624,1627,1630,1633,1636,1639,1642,1645,1648,1651,1654,1657,1660,1663,1666,1669,1672,1675,1678,1681,1684,1687,1690,1693,1696,1698,1701,1704,1707,1710,1713,1716,1719,1722,1725,1728,1731,1734,1737,1739,1742,1745,1748,1751,1754,1757,1760,1763,1766,1767,1770,1773,1776,1779,1782,1785,1788,1791,1794,1797,1800,1803,1806,1809],{"path":1568,"title":1569},"\u002Fabout","About Python CLI Toolcraft",{"path":1571,"title":1572},"\u002Fadvanced-input-parsing-user-experience\u002Fadvanced-argument-validation-strategies","Advanced Argument Validation Strategies",{"path":1574,"title":1575},"\u002Fadvanced-input-parsing-user-experience\u002Fadvanced-argument-validation-strategies\u002Fparsing-nested-json-arguments-in-python-clis","Parsing Nested JSON Args in Python CLIs",{"path":1577,"title":1578},"\u002Fadvanced-input-parsing-user-experience\u002Fadvanced-argument-validation-strategies\u002Fvalidating-file-and-directory-paths-in-clis","Validating File and Directory Paths in CLIs",{"path":1580,"title":1581},"\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":1583,"title":1584},"\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":1586,"title":1587},"\u002Fadvanced-input-parsing-user-experience\u002Fcli-help-output-and-documentation","CLI Help Output and Documentation",{"path":1589,"title":1590},"\u002Fadvanced-input-parsing-user-experience\u002Fcli-help-output-and-documentation\u002Fversioning-and-deprecating-cli-flags","Versioning and Deprecating CLI Flags",{"path":1592,"title":1593},"\u002Fadvanced-input-parsing-user-experience\u002Fcli-help-output-and-documentation\u002Fwriting-help-text-users-actually-read","Writing Help Text Users Actually Read",{"path":1595,"title":1596},"\u002Fadvanced-input-parsing-user-experience\u002Ferror-handling-and-exit-codes\u002Fchoosing-exit-codes-for-cli-tools","Choosing Exit Codes for CLI Tools",{"path":1598,"title":1599},"\u002Fadvanced-input-parsing-user-experience\u002Ferror-handling-and-exit-codes\u002Ffriendly-error-messages-and-tracebacks","Friendly Error Messages and Tracebacks",{"path":1601,"title":1602},"\u002Fadvanced-input-parsing-user-experience\u002Ferror-handling-and-exit-codes\u002Fhandling-keyboard-interrupt-cleanly","Handling Keyboard Interrupt Cleanly",{"path":1604,"title":1605},"\u002Fadvanced-input-parsing-user-experience\u002Ferror-handling-and-exit-codes","Error Handling and Exit Codes for CLIs",{"path":1607,"title":1608},"\u002Fadvanced-input-parsing-user-experience\u002Fhandling-configuration-files-env-vars\u002Fconfig-precedence-flags-env-files-defaults","Config Precedence: Flags, Env, Files, Defaults",{"path":1610,"title":1611},"\u002Fadvanced-input-parsing-user-experience\u002Fhandling-configuration-files-env-vars","Handling Config Files and Env Vars in CLIs",{"path":1613,"title":1614},"\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":1616,"title":1617},"\u002Fadvanced-input-parsing-user-experience","Advanced Input Parsing for Python CLIs",{"path":1619,"title":1620},"\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":1622,"title":1623},"\u002Fadvanced-input-parsing-user-experience\u002Finteractive-terminal-ui-with-rich","Interactive Terminal UI with Rich",{"path":1625,"title":1626},"\u002Fadvanced-input-parsing-user-experience\u002Finteractive-terminal-ui-with-rich\u002Frendering-tables-and-json-with-rich","Rendering Tables and JSON with Rich",{"path":1628,"title":1629},"\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":1631,"title":1632},"\u002Fadvanced-input-parsing-user-experience\u002Fshell-completion-for-python-clis","Shell Completion for Python CLIs",{"path":1634,"title":1635},"\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":1637,"title":1638},"\u002Fadvanced-input-parsing-user-experience\u002Fstructured-logging-for-cli-apps\u002Fadding-verbose-and-quiet-logging-flags","Adding Verbose and Quiet Logging Flags",{"path":1640,"title":1641},"\u002Fadvanced-input-parsing-user-experience\u002Fstructured-logging-for-cli-apps","Structured Logging for CLI Apps",{"path":1643,"title":1644},"\u002Fadvanced-input-parsing-user-experience\u002Fstructured-logging-for-cli-apps\u002Fstructured-json-logging-in-python-clis","Structured JSON Logging in Python CLIs",{"path":1646,"title":1647},"\u002Fadvanced-input-parsing-user-experience\u002Fworking-with-stdin-stdout-and-pipes\u002Fdetecting-tty-and-adapting-output","Detecting a TTY and Adapting Output",{"path":1649,"title":1650},"\u002Fadvanced-input-parsing-user-experience\u002Fworking-with-stdin-stdout-and-pipes\u002Femitting-json-output-for-scripting","Emitting JSON Output for Scripting",{"path":1652,"title":1653},"\u002Fadvanced-input-parsing-user-experience\u002Fworking-with-stdin-stdout-and-pipes\u002Fhandling-broken-pipe-and-sigpipe","Handling Broken Pipe and SIGPIPE",{"path":1655,"title":1656},"\u002Fadvanced-input-parsing-user-experience\u002Fworking-with-stdin-stdout-and-pipes","Working with stdin, stdout and Pipes",{"path":1658,"title":1659},"\u002Fadvanced-input-parsing-user-experience\u002Fworking-with-stdin-stdout-and-pipes\u002Freading-piped-input-in-python-clis","Reading Piped Input in Python CLIs",{"path":1661,"title":1662},"\u002F","Python CLI Toolcraft",{"path":1664,"title":1665},"\u002Fmodern-python-cli-frameworks-architecture\u002Fcli-startup-performance-and-lazy-loading","CLI Startup Performance and Lazy Loading",{"path":1667,"title":1668},"\u002Fmodern-python-cli-frameworks-architecture\u002Fcli-startup-performance-and-lazy-loading\u002Flazy-loading-subcommands-for-faster-startup","Lazy Loading Subcommands for Faster Startup",{"path":1670,"title":1671},"\u002Fmodern-python-cli-frameworks-architecture\u002Fcli-startup-performance-and-lazy-loading\u002Fprofiling-python-cli-startup-time","Profiling Python CLI Startup Time",{"path":1673,"title":1674},"\u002Fmodern-python-cli-frameworks-architecture\u002Fcli-startup-performance-and-lazy-loading\u002Freducing-cli-dependency-weight","Reducing CLI Dependency Weight",{"path":1676,"title":1677},"\u002Fmodern-python-cli-frameworks-architecture\u002Fcommand-line-parsing-with-argparse\u002Fargparse-subparsers-for-subcommands","argparse Subparsers for Subcommands",{"path":1679,"title":1680},"\u002Fmodern-python-cli-frameworks-architecture\u002Fcommand-line-parsing-with-argparse\u002Fargparse-vs-click-vs-typer-comparison","argparse vs Click vs Typer Compared",{"path":1682,"title":1683},"\u002Fmodern-python-cli-frameworks-architecture\u002Fcommand-line-parsing-with-argparse","Command-Line Parsing with argparse",{"path":1685,"title":1686},"\u002Fmodern-python-cli-frameworks-architecture\u002Fcommand-line-parsing-with-argparse\u002Fmigrating-from-argparse-to-typer","Migrating from argparse to Typer",{"path":1688,"title":1689},"\u002Fmodern-python-cli-frameworks-architecture","Python CLI Frameworks and Architecture",{"path":1691,"title":1692},"\u002Fmodern-python-cli-frameworks-architecture\u002Fplugin-architectures-for-extensible-clis","Plugin Architectures for Extensible CLIs",{"path":1694,"title":1695},"\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":1697,"title":1515},"\u002Fmodern-python-cli-frameworks-architecture\u002Fstructuring-multi-command-python-clis\u002Fbest-practices-for-python-cli-entry-points",{"path":1699,"title":1700},"\u002Fmodern-python-cli-frameworks-architecture\u002Fstructuring-multi-command-python-clis\u002Fdependency-injection-patterns-for-cli-commands","Dependency Injection Patterns for CLI Commands",{"path":1702,"title":1703},"\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":1705,"title":1706},"\u002Fmodern-python-cli-frameworks-architecture\u002Fstructuring-multi-command-python-clis","Structuring Multi-Command Python CLIs",{"path":1708,"title":1709},"\u002Fmodern-python-cli-frameworks-architecture\u002Fstructuring-multi-command-python-clis\u002Fsharing-state-with-click-context-objects","Sharing State with Click Context Objects",{"path":1711,"title":1712},"\u002Fmodern-python-cli-frameworks-architecture\u002Ftesting-python-cli-applications","Testing Python CLI Applications",{"path":1714,"title":1715},"\u002Fmodern-python-cli-frameworks-architecture\u002Ftesting-python-cli-applications\u002Fmeasuring-cli-test-coverage","Measuring CLI Test Coverage",{"path":1717,"title":1718},"\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":1720,"title":1721},"\u002Fmodern-python-cli-frameworks-architecture\u002Ftesting-python-cli-applications\u002Fsnapshot-testing-cli-output","Snapshot Testing CLI Output",{"path":1723,"title":1724},"\u002Fmodern-python-cli-frameworks-architecture\u002Ftesting-python-cli-applications\u002Ftesting-click-commands-with-clirunner","Testing Click Commands with CliRunner",{"path":1726,"title":1727},"\u002Fmodern-python-cli-frameworks-architecture\u002Ftesting-python-cli-applications\u002Ftesting-interactive-prompts-and-stdin","Testing Interactive Prompts and stdin",{"path":1729,"title":1730},"\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":1732,"title":1733},"\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":1735,"title":1736},"\u002Fmodern-python-cli-frameworks-architecture\u002Ftyper-vs-click-when-to-use-each","Typer vs Click: When to Use Each",{"path":1738,"title":1521},"\u002Fmodern-python-cli-frameworks-architecture\u002Ftyper-vs-click-when-to-use-each\u002Ftyper-callback-functions-explained",{"path":1740,"title":1741},"\u002Fproject-setup-dependency-management\u002Fcli-project-scaffolding-with-cookiecutter\u002Fcopier-vs-cookiecutter-for-cli-templates","Copier vs Cookiecutter for CLI Templates",{"path":1743,"title":1744},"\u002Fproject-setup-dependency-management\u002Fcli-project-scaffolding-with-cookiecutter","CLI Project Scaffolding with Cookiecutter",{"path":1746,"title":1747},"\u002Fproject-setup-dependency-management\u002Fdistributing-clis-as-standalone-binaries\u002Fbuilding-cross-platform-release-binaries-in-ci","Building Cross-Platform Release Binaries in CI",{"path":1749,"title":1750},"\u002Fproject-setup-dependency-management\u002Fdistributing-clis-as-standalone-binaries\u002Fbundling-a-python-cli-with-pyinstaller","Bundling a Python CLI with PyInstaller",{"path":1752,"title":1753},"\u002Fproject-setup-dependency-management\u002Fdistributing-clis-as-standalone-binaries\u002Fhomebrew-and-scoop-packaging-for-python-clis","Homebrew and Scoop Packaging for Python CLIs",{"path":1755,"title":1756},"\u002Fproject-setup-dependency-management\u002Fdistributing-clis-as-standalone-binaries","Distributing CLIs as Standalone Binaries",{"path":1758,"title":1759},"\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":1761,"title":1762},"\u002Fproject-setup-dependency-management","Project Setup & Dependency Management",{"path":1764,"title":1765},"\u002Fproject-setup-dependency-management\u002Fmanaging-cli-versioning-changelogs\u002Fautomating-changelogs-with-conventional-commits","Automating Changelogs with Conventional Commits",{"path":1556,"title":5},{"path":1768,"title":1769},"\u002Fproject-setup-dependency-management\u002Fmanaging-cli-versioning-changelogs","Managing CLI Versioning & Changelogs",{"path":1771,"title":1772},"\u002Fproject-setup-dependency-management\u002Fpackaging-python-clis-for-distribution\u002Fbuilding-wheels-and-sdists-for-python-clis","Building Wheels and sdists for Python CLIs",{"path":1774,"title":1775},"\u002Fproject-setup-dependency-management\u002Fpackaging-python-clis-for-distribution","Packaging Python CLIs for Distribution",{"path":1777,"title":1778},"\u002Fproject-setup-dependency-management\u002Fpackaging-python-clis-for-distribution\u002Finstalling-and-distributing-clis-with-pipx","Installing and Distributing CLIs with pipx",{"path":1780,"title":1781},"\u002Fproject-setup-dependency-management\u002Fpackaging-python-clis-for-distribution\u002Fpublishing-a-python-cli-to-pypi","Publishing a Python CLI to PyPI",{"path":1783,"title":1784},"\u002Fproject-setup-dependency-management\u002Fpoetry-workflows-for-cli-development","Poetry Workflows for CLI Development",{"path":1786,"title":1787},"\u002Fproject-setup-dependency-management\u002Fpoetry-workflows-for-cli-development\u002Fpoetry-entry-points-and-scripts-for-clis","Poetry Entry Points and Scripts for CLIs",{"path":1789,"title":1790},"\u002Fproject-setup-dependency-management\u002Fpre-commit-hooks-for-cli-projects","Pre-commit Hooks for CLI Projects",{"path":1792,"title":1793},"\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":1795,"title":1796},"\u002Fproject-setup-dependency-management\u002Fuv-for-python-cli-dependency-management","uv for Python CLI Dependency Management",{"path":1798,"title":1799},"\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":1801,"title":1802},"\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":1804,"title":1805},"\u002Fproject-setup-dependency-management\u002Fvirtual-environments-isolation-best-practices","Python CLI Env Isolation Best Practices",{"path":1807,"title":1808},"\u002Fproject-setup-dependency-management\u002Fvirtual-environments-isolation-best-practices\u002Fmanaging-virtual-environments-for-cross-platform-clis","Managing Python CLI Virtual Environments",{"path":1810,"title":1811},"\u002Fproject-setup-dependency-management\u002Fvirtual-environments-isolation-best-practices\u002Fpinning-the-python-version-for-a-cli","Pinning the Python Version for a CLI",1785614690034]