https://github.com/python/cpython/commit/ef6f0635ce07e6785a78aef0c58649c2e8e832ba
commit: ef6f0635ce07e6785a78aef0c58649c2e8e832ba
branch: main
author: Hugo van Kemenade <[email protected]>
committer: hugovk <[email protected]>
date: 2026-05-04T22:23:18Z
summary:

gh-142389: Add backticks to stdlib argparse help to display in colour (#149384)

Co-authored-by: Savannah Ostrowski <[email protected]>

files:
A Misc/NEWS.d/next/Library/2026-05-05-00-30-04.gh-issue-142389.4daLzc.rst
M Lib/ast.py
M Lib/asyncio/__main__.py
M Lib/calendar.py
M Lib/code.py
M Lib/compileall.py
M Lib/dis.py
M Lib/doctest.py
M Lib/ensurepip/__init__.py
M Lib/gzip.py
M Lib/http/server.py
M Lib/inspect.py
M Lib/json/tool.py
M Lib/mimetypes.py
M Lib/pdb.py
M Lib/pickle.py
M Lib/pickletools.py
M Lib/platform.py
M Lib/profiling/sampling/cli.py
M Lib/py_compile.py
M Lib/random.py
M Lib/sqlite3/__main__.py
M Lib/tarfile.py
M Lib/test/libregrtest/cmdline.py
M Lib/timeit.py
M Lib/tokenize.py
M Lib/trace.py
M Lib/unittest/main.py
M Lib/uuid.py
M Lib/venv/__init__.py
M Lib/webbrowser.py
M Lib/zipapp.py
M Lib/zipfile/__init__.py

diff --git a/Lib/ast.py b/Lib/ast.py
index a7997c4b740635..4f88a554344cc9 100644
--- a/Lib/ast.py
+++ b/Lib/ast.py
@@ -666,7 +666,7 @@ def main(args=None):
 
     parser = 
argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
     parser.add_argument('infile', nargs='?', default='-',
-                        help='the file to parse; defaults to stdin')
+                        help='the file to parse; defaults to `stdin`')
     parser.add_argument('-m', '--mode', default='exec',
                         choices=('exec', 'single', 'eval', 'func_type'),
                         help='specify what kind of code must be parsed')
@@ -679,8 +679,8 @@ def main(args=None):
                         help='indentation of nodes (number of spaces)')
     parser.add_argument('--feature-version',
                         type=str, default=None, metavar='VERSION',
-                        help='Python version in the format 3.x '
-                             '(for example, 3.10)')
+                        help='Python version in the format `3.x` '
+                             '(for example, `3.10`)')
     parser.add_argument('-O', '--optimize',
                         type=int, default=-1, metavar='LEVEL',
                         help='optimization level for parser')
diff --git a/Lib/asyncio/__main__.py b/Lib/asyncio/__main__.py
index 37eba9657ac5a8..7f0565d0b8ddc7 100644
--- a/Lib/asyncio/__main__.py
+++ b/Lib/asyncio/__main__.py
@@ -159,7 +159,6 @@ def interrupt(self) -> None:
     parser = argparse.ArgumentParser(
         prog="python3 -m asyncio",
         description="Interactive asyncio shell and CLI tools",
-        color=True,
     )
     subparsers = parser.add_subparsers(help="sub-commands", dest="command")
     ps = subparsers.add_parser(
diff --git a/Lib/calendar.py b/Lib/calendar.py
index fa9775ab040b14..92fe6b7723fe26 100644
--- a/Lib/calendar.py
+++ b/Lib/calendar.py
@@ -922,7 +922,7 @@ def main(args=None):
         "-t", "--type",
         default="text",
         choices=("text", "html"),
-        help="output type (text or html)"
+        help="output type (`text` or `html`)"
     )
     parser.add_argument(
         "-f", "--first-weekday",
diff --git a/Lib/code.py b/Lib/code.py
index f7e275d8801b7c..df1d7199e33934 100644
--- a/Lib/code.py
+++ b/Lib/code.py
@@ -385,7 +385,7 @@ def interact(banner=None, readfunc=None, local=None, 
exitmsg=None, local_exit=Fa
 if __name__ == "__main__":
     import argparse
 
-    parser = argparse.ArgumentParser(color=True)
+    parser = argparse.ArgumentParser()
     parser.add_argument('-q', action='store_true',
                        help="don't print version and copyright messages")
     args = parser.parse_args()
diff --git a/Lib/compileall.py b/Lib/compileall.py
index c452aed135838f..812a496611e043 100644
--- a/Lib/compileall.py
+++ b/Lib/compileall.py
@@ -326,7 +326,6 @@ def main():
 
     parser = argparse.ArgumentParser(
         description='Utilities to support installing Python libraries.',
-        color=True,
     )
     parser.add_argument('-l', action='store_const', const=0,
                         default=None, dest='maxlevels',
@@ -338,10 +337,10 @@ def main():
     parser.add_argument('-f', action='store_true', dest='force',
                         help='force rebuild even if timestamps are up to date')
     parser.add_argument('-q', action='count', dest='quiet', default=0,
-                        help='output only error messages; -qq will suppress '
+                        help='output only error messages; `-qq` will suppress '
                              'the error messages as well.')
     parser.add_argument('-b', action='store_true', dest='legacy',
-                        help='use legacy (pre-PEP3147) compiled file 
locations')
+                        help='use legacy (pre-PEP 3147) compiled file 
locations')
     parser.add_argument('-d', metavar='DESTDIR',  dest='ddir', default=None,
                         help=('directory to prepend to file paths for use in '
                               'compile-time tracebacks and in runtime '
@@ -367,28 +366,28 @@ def main():
                               'of each file considered for compilation'))
     parser.add_argument('-i', metavar='FILE', dest='flist',
                         help=('add all the files and directories listed in '
-                              'FILE to the list considered for compilation; '
-                              'if "-", names are read from stdin'))
+                              '`FILE` to the list considered for compilation; '
+                              'if `"-"`, names are read from `stdin`'))
     parser.add_argument('compile_dest', metavar='FILE|DIR', nargs='*',
                         help=('zero or more file and directory names '
                               'to compile; if no arguments given, defaults '
-                              'to the equivalent of -l sys.path'))
+                              'to the equivalent of `-l` `sys.path`'))
     parser.add_argument('-j', '--workers', default=1,
                         type=int, help='Run compileall concurrently')
     invalidation_modes = [mode.name.lower().replace('_', '-')
                           for mode in py_compile.PycInvalidationMode]
     parser.add_argument('--invalidation-mode',
                         choices=sorted(invalidation_modes),
-                        help=('set .pyc invalidation mode; defaults to '
-                              '"checked-hash" if the SOURCE_DATE_EPOCH '
+                        help=('set `.pyc` invalidation mode; defaults to '
+                              '`"checked-hash"` if the `SOURCE_DATE_EPOCH` '
                               'environment variable is set, and '
-                              '"timestamp" otherwise.'))
+                              '`"timestamp"` otherwise.'))
     parser.add_argument('-o', action='append', type=int, dest='opt_levels',
                         help=('Optimization levels to run compilation with. '
-                              'Default is -1 which uses the optimization level 
'
-                              'of the Python interpreter itself (see -O).'))
+                              'Default is `-1` which uses the optimization 
level '
+                              'of the Python interpreter itself (see `-O`).'))
     parser.add_argument('-e', metavar='DIR', dest='limit_sl_dest',
-                        help='Ignore symlinks pointing outsite of the DIR')
+                        help='Ignore symlinks pointing outsite of the `DIR`')
     parser.add_argument('--hardlink-dupes', action='store_true',
                         dest='hardlink_dupes',
                         help='Hardlink duplicated pyc files')
diff --git a/Lib/dis.py b/Lib/dis.py
index 64f3450da3071b..d60507ae473453 100644
--- a/Lib/dis.py
+++ b/Lib/dis.py
@@ -1146,7 +1146,7 @@ def dis(self):
 def main(args=None):
     import argparse
 
-    parser = argparse.ArgumentParser(color=True)
+    parser = argparse.ArgumentParser()
     parser.add_argument('-C', '--show-caches', action='store_true',
                         help='show inline caches')
     parser.add_argument('-O', '--show-offsets', action='store_true',
diff --git a/Lib/doctest.py b/Lib/doctest.py
index 0fcfa1e3e97144..05acac1745ace9 100644
--- a/Lib/doctest.py
+++ b/Lib/doctest.py
@@ -2951,7 +2951,7 @@ def get(self):
 def _test():
     import argparse
 
-    parser = argparse.ArgumentParser(description="doctest runner", color=True)
+    parser = argparse.ArgumentParser(description="doctest runner")
     parser.add_argument('-v', '--verbose', action='store_true', default=False,
                         help='print very verbose output for all tests')
     parser.add_argument('-o', '--option', action='append',
@@ -2961,8 +2961,8 @@ def _test():
                               ' than once to apply multiple options'))
     parser.add_argument('-f', '--fail-fast', action='store_true',
                         help=('stop running tests after first failure (this'
-                              ' is a shorthand for -o FAIL_FAST, and is'
-                              ' in addition to any other -o options)'))
+                              ' is a shorthand for `-o FAIL_FAST`, and is'
+                              ' in addition to any other `-o` options)'))
     parser.add_argument('file', nargs='+',
                         help='file containing the tests to run')
     args = parser.parse_args()
diff --git a/Lib/ensurepip/__init__.py b/Lib/ensurepip/__init__.py
index 9077e84e958cce..ab6b95e0ba60c0 100644
--- a/Lib/ensurepip/__init__.py
+++ b/Lib/ensurepip/__init__.py
@@ -217,7 +217,7 @@ def _uninstall_helper(*, verbosity=0):
 
 def _main(argv=None):
     import argparse
-    parser = argparse.ArgumentParser(color=True)
+    parser = argparse.ArgumentParser()
     parser.add_argument(
         "--version",
         action="version",
diff --git a/Lib/gzip.py b/Lib/gzip.py
index 8a2faf846bf894..971063aa24f871 100644
--- a/Lib/gzip.py
+++ b/Lib/gzip.py
@@ -664,15 +664,14 @@ def decompress(data):
 def main():
     from argparse import ArgumentParser
     parser = ArgumentParser(description=
-        "A simple command line interface for the gzip module: act like gzip, "
+        "A simple command line interface for the `gzip` module: act like 
`gzip`, "
         "but do not delete the input file.",
-        color=True,
     )
     group = parser.add_mutually_exclusive_group()
     group.add_argument('--fast', action='store_true', help='compress faster')
     group.add_argument('--best', action='store_true', help='compress better')
     group.add_argument("-d", "--decompress", action="store_true",
-                        help="act like gunzip instead of gzip")
+                        help="act like `gunzip` instead of `gzip`")
 
     parser.add_argument("args", nargs="*", default=["-"], metavar='file')
     args = parser.parse_args()
diff --git a/Lib/http/server.py b/Lib/http/server.py
index 16ea7f3f93693f..ebc85052aecb90 100644
--- a/Lib/http/server.py
+++ b/Lib/http/server.py
@@ -1081,7 +1081,7 @@ def _main(args=None):
     import argparse
     import contextlib
 
-    parser = argparse.ArgumentParser(color=True)
+    parser = argparse.ArgumentParser()
     parser.add_argument('-b', '--bind', metavar='ADDRESS',
                         help='bind to this address '
                              '(default: all interfaces)')
diff --git a/Lib/inspect.py b/Lib/inspect.py
index af304f186a69bc..9eb87b0d277918 100644
--- a/Lib/inspect.py
+++ b/Lib/inspect.py
@@ -3445,11 +3445,11 @@ def _main():
     import argparse
     import importlib
 
-    parser = argparse.ArgumentParser(color=True)
+    parser = argparse.ArgumentParser()
     parser.add_argument(
         'object',
          help="The object to be analysed. "
-              "It supports the 'module:qualname' syntax")
+              "It supports the `module:qualname` syntax")
     parser.add_argument(
         '-d', '--details', action='store_true',
         help='Display info about the module rather than its source code')
diff --git a/Lib/json/tool.py b/Lib/json/tool.py
index e56a601c581ae5..6385d971f73304 100644
--- a/Lib/json/tool.py
+++ b/Lib/json/tool.py
@@ -44,13 +44,13 @@ def _replace_match_callback(match):
 def main():
     description = ('A simple command line interface for json module '
                    'to validate and pretty-print JSON objects.')
-    parser = argparse.ArgumentParser(description=description, color=True)
+    parser = argparse.ArgumentParser(description=description)
     parser.add_argument('infile', nargs='?',
                         help='a JSON file to be validated or pretty-printed; '
-                             'defaults to stdin',
+                             'defaults to `stdin`',
                         default='-')
     parser.add_argument('outfile', nargs='?',
-                        help='write the output of infile to outfile',
+                        help='write the output of `infile` to `outfile`',
                         default=None)
     parser.add_argument('--sort-keys', action='store_true', default=False,
                         help='sort the output of dictionaries alphabetically 
by key')
@@ -58,7 +58,7 @@ def main():
                         help='disable escaping of non-ASCII characters')
     parser.add_argument('--json-lines', action='store_true', default=False,
                         help='parse input using the JSON Lines format. '
-                        'Use with --no-indent or --compact to produce valid 
JSON Lines output.')
+                        'Use with `--no-indent` or `--compact` to produce 
valid JSON Lines output.')
     group = parser.add_mutually_exclusive_group()
     group.add_argument('--indent', default=4, type=int,
                        help='separate items with newlines and use this number '
diff --git a/Lib/mimetypes.py b/Lib/mimetypes.py
index ad18db09f6b340..6d9278bccf927e 100644
--- a/Lib/mimetypes.py
+++ b/Lib/mimetypes.py
@@ -712,7 +712,7 @@ def _parse_args(args):
     from argparse import ArgumentParser
 
     parser = ArgumentParser(
-        description='map filename extensions to MIME types', color=True
+        description='map filename extensions to MIME types',
     )
     parser.add_argument(
         '-e', '--extension',
diff --git a/Lib/pdb.py b/Lib/pdb.py
index 569599d349c49e..bdc9caf80ec26e 100644
--- a/Lib/pdb.py
+++ b/Lib/pdb.py
@@ -3757,13 +3757,12 @@ def parse_args():
         description=_usage,
         formatter_class=argparse.RawDescriptionHelpFormatter,
         allow_abbrev=False,
-        color=True,
     )
 
     # Get all the commands out first. For backwards compatibility, we allow
     # -c commands to be after the target.
     parser.add_argument('-c', '--command', action='append', default=[], 
metavar='command', dest='commands',
-                        help='pdb commands to execute as if given in a .pdbrc 
file')
+                        help='pdb commands to execute as if given in a 
`.pdbrc` file')
 
     opts, args = parser.parse_known_args()
 
diff --git a/Lib/pickle.py b/Lib/pickle.py
index 95836afdc2b43e..f92b1fde768fc7 100644
--- a/Lib/pickle.py
+++ b/Lib/pickle.py
@@ -1937,7 +1937,6 @@ def _main(args=None):
     import pprint
     parser = argparse.ArgumentParser(
         description='display contents of the pickle files',
-        color=True,
     )
     parser.add_argument(
         'pickle_file',
diff --git a/Lib/pickletools.py b/Lib/pickletools.py
index 976e218db19298..a9711538dae342 100644
--- a/Lib/pickletools.py
+++ b/Lib/pickletools.py
@@ -2899,7 +2899,7 @@ def _main(args=None):
         help='preserve memo between disassemblies')
     parser.add_argument(
         '-l', '--indentlevel', default=4, type=int,
-        help='the number of blanks by which to indent a new MARK level')
+        help='the number of blanks by which to indent a new `MARK` level')
     parser.add_argument(
         '-a', '--annotate',  action='store_true',
         help='annotate each line with a short opcode description')
diff --git a/Lib/platform.py b/Lib/platform.py
index 9d7aa5c66a91cb..36489d4fdd98ae 100644
--- a/Lib/platform.py
+++ b/Lib/platform.py
@@ -1400,7 +1400,7 @@ def invalidate_caches():
 def _parse_args(args: list[str] | None):
     import argparse
 
-    parser = argparse.ArgumentParser(color=True)
+    parser = argparse.ArgumentParser()
     parser.add_argument("args", nargs="*", choices=["nonaliased", "terse"])
     parser.add_argument(
         "--terse",
diff --git a/Lib/profiling/sampling/cli.py b/Lib/profiling/sampling/cli.py
index bc879c43e15965..9900415ae8a927 100644
--- a/Lib/profiling/sampling/cli.py
+++ b/Lib/profiling/sampling/cli.py
@@ -389,13 +389,13 @@ def _add_sampling_options(parser):
     sampling_group.add_argument(
         "--native",
         action="store_true",
-        help='Include artificial "<native>" frames to denote calls to 
non-Python code',
+        help='Include artificial `<native>` frames to denote calls to 
non-Python code',
     )
     sampling_group.add_argument(
         "--no-gc",
         action="store_false",
         dest="gc",
-        help='Don\'t include artificial "<GC>" frames to denote active garbage 
collection',
+        help='Don\'t include artificial `<GC>` frames to denote active garbage 
collection',
     )
     sampling_group.add_argument(
         "--opcodes",
@@ -432,14 +432,14 @@ def _add_mode_options(parser):
         help="Sampling mode: wall (all samples), cpu (only samples when thread 
is on CPU), "
         "gil (only samples when thread holds the GIL), "
         "exception (only samples when thread has an active exception). "
-        "Incompatible with --async-aware",
+        "Incompatible with `--async-aware`",
     )
     mode_group.add_argument(
         "--async-mode",
         choices=["running", "all"],
         default="running",
         help='Async profiling mode: "running" (only running task) '
-        'or "all" (all tasks including waiting). Requires --async-aware',
+        'or "all" (all tasks including waiting). Requires `--async-aware`',
     )
 
 
@@ -486,7 +486,7 @@ def _add_format_options(parser, include_compression=True, 
include_binary=True):
         "--diff-flamegraph",
         metavar="BASELINE",
         action=DiffFlamegraphAction,
-        help="Generate differential flamegraph comparing current profile to 
BASELINE binary file",
+        help="Generate differential flamegraph comparing current profile to 
`BASELINE` binary file",
     )
     if include_binary:
         format_group.add_argument(
@@ -494,7 +494,7 @@ def _add_format_options(parser, include_compression=True, 
include_binary=True):
             action="store_const",
             const="binary",
             dest="format",
-            help="Generate high-performance binary format (use 'replay' 
command to convert)",
+            help="Generate high-performance binary format (use `replay` 
command to convert)",
         )
     parser.set_defaults(format="pstats", diff_baseline=None)
 
@@ -510,14 +510,14 @@ def _add_format_options(parser, include_compression=True, 
include_binary=True):
         "-o",
         "--output",
         dest="outfile",
-        help="Output path (default: stdout for pstats text; with -o, pstats is 
binary). "
-        "Auto-generated for other formats. For heatmap: directory name 
(default: heatmap_PID)",
+        help="Output path (default: `stdout` for `pstats` text; with `-o`, 
`pstats` is binary). "
+        "Auto-generated for other formats. For heatmap: directory name 
(default: `heatmap_PID`)",
     )
     output_group.add_argument(
         "--browser",
         action="store_true",
         help="Automatically open HTML output (flamegraph, heatmap) in browser. 
"
-        "When using --subprocesses, only the main process opens the browser",
+        "When using `--subprocesses`, only the main process opens the browser",
     )
 
 
@@ -564,13 +564,13 @@ def _add_dump_options(parser):
     dump_group.add_argument(
         "--native",
         action="store_true",
-        help='Include artificial "<native>" frames to denote calls to 
non-Python code',
+        help='Include artificial `<native>` frames to denote calls to 
non-Python code',
     )
     dump_group.add_argument(
         "--no-gc",
         action="store_false",
         dest="gc",
-        help='Don\'t include artificial "<GC>" frames to denote active garbage 
collection',
+        help='Don\'t include artificial `<GC>` frames to denote active garbage 
collection',
     )
     dump_group.add_argument(
         "--opcodes",
@@ -588,7 +588,7 @@ def _add_dump_options(parser):
         default=argparse.SUPPRESS,
         help='Async stack mode: "running" (only running task) '
         'or "all" (all tasks including waiting, default for dump). '
-        "Requires --async-aware",
+        "Requires `--async-aware`",
     )
     dump_group.add_argument(
         "--blocking",
@@ -998,7 +998,7 @@ def _main():
         "-m",
         "--module",
         action="store_true",
-        help="Run target as a module (like python -m)",
+        help="Run target as a module (like `python -m`)",
     )
     run_parser.add_argument(
         "target",
diff --git a/Lib/py_compile.py b/Lib/py_compile.py
index 694ea9304da9f9..7ca479141e01e4 100644
--- a/Lib/py_compile.py
+++ b/Lib/py_compile.py
@@ -177,7 +177,7 @@ def main():
     import argparse
 
     description = 'A simple command-line interface for py_compile module.'
-    parser = argparse.ArgumentParser(description=description, color=True)
+    parser = argparse.ArgumentParser(description=description)
     parser.add_argument(
         '-q', '--quiet',
         action='store_true',
diff --git a/Lib/random.py b/Lib/random.py
index 726a71e782893c..4541267bab866a 100644
--- a/Lib/random.py
+++ b/Lib/random.py
@@ -1016,26 +1016,26 @@ def _test(N=10_000):
 def _parse_args(arg_list: list[str] | None):
     import argparse
     parser = argparse.ArgumentParser(
-        formatter_class=argparse.RawTextHelpFormatter, color=True)
+        formatter_class=argparse.RawTextHelpFormatter)
     group = parser.add_mutually_exclusive_group()
     group.add_argument(
         "-c", "--choice", nargs="+",
         help="print a random choice")
     group.add_argument(
         "-i", "--integer", type=int, metavar="N",
-        help="print a random integer between 1 and N inclusive")
+        help="print a random integer between 1 and `N` inclusive")
     group.add_argument(
         "-f", "--float", type=float, metavar="N",
-        help="print a random floating-point number between 0 and N inclusive")
+        help="print a random floating-point number between 0 and `N` 
inclusive")
     group.add_argument(
         "--test", type=int, const=10_000, nargs="?",
         help=argparse.SUPPRESS)
     parser.add_argument("input", nargs="*",
                         help="""\
 if no options given, output depends on the input
-    string or multiple: same as --choice
-    integer: same as --integer
-    float: same as --float""")
+    string or multiple: same as `--choice`
+    integer: same as `--integer`
+    float: same as `--float`""")
     args = parser.parse_args(arg_list)
     return args, parser.format_help()
 
diff --git a/Lib/sqlite3/__main__.py b/Lib/sqlite3/__main__.py
index 8805442b69e080..ec72c694390717 100644
--- a/Lib/sqlite3/__main__.py
+++ b/Lib/sqlite3/__main__.py
@@ -87,14 +87,11 @@ def runsource(self, source, filename="<input>", 
symbol="single"):
 
 
 def main(*args):
-    parser = ArgumentParser(
-        description="Python sqlite3 CLI",
-        color=True,
-    )
+    parser = ArgumentParser(description="Python sqlite3 CLI")
     parser.add_argument(
         "filename", type=str, default=":memory:", nargs="?",
         help=(
-            "SQLite database to open (defaults to ':memory:'). "
+            "SQLite database to open (defaults to `:memory:`). "
             "A new database is created if the file does not previously exist."
         ),
     )
@@ -102,7 +99,7 @@ def main(*args):
         "sql", type=str, nargs="?",
         help=(
             "An SQL query to execute. "
-            "Any returned rows are printed to stdout."
+            "Any returned rows are printed to `stdout`."
         ),
     )
     parser.add_argument(
diff --git a/Lib/tarfile.py b/Lib/tarfile.py
index 4f47aaab9028d0..d0e7dec5575047 100644
--- a/Lib/tarfile.py
+++ b/Lib/tarfile.py
@@ -3067,7 +3067,7 @@ def main():
     import argparse
 
     description = 'A simple command-line interface for tarfile module.'
-    parser = argparse.ArgumentParser(description=description, color=True)
+    parser = argparse.ArgumentParser(description=description)
     parser.add_argument('-v', '--verbose', action='store_true', default=False,
                         help='Verbose output')
     parser.add_argument('--filter', metavar='<filtername>',
diff --git a/Lib/test/libregrtest/cmdline.py b/Lib/test/libregrtest/cmdline.py
index 45e229eb19f0f9..64c035307e6654 100644
--- a/Lib/test/libregrtest/cmdline.py
+++ b/Lib/test/libregrtest/cmdline.py
@@ -245,7 +245,7 @@ def _create_parser():
                             'buildbot workers')
     group.add_argument('--timeout', metavar='TIMEOUT',
                         help='dump the traceback and exit if a test takes '
-                             'more than TIMEOUT seconds; disabled if TIMEOUT '
+                             'more than `TIMEOUT` seconds; disabled if 
`TIMEOUT` '
                              'is negative or equals to zero')
     group.add_argument('--wait', action='store_true',
                        help='wait for user input, e.g., allow a debugger '
@@ -261,11 +261,11 @@ def _create_parser():
 
     group = parser.add_argument_group('Verbosity')
     group.add_argument('-v', '--verbose', action='count',
-                       help='run tests in verbose mode with output to stdout')
+                       help='run tests in verbose mode with output to 
`stdout`')
     group.add_argument('-w', '--rerun', action='store_true',
                        help='re-run failed tests in verbose mode')
     group.add_argument('--verbose2', action='store_true', dest='rerun',
-                       help='deprecated alias to --rerun')
+                       help='deprecated alias to `--rerun`')
     group.add_argument('-W', '--verbose3', action='store_true',
                        help='display test output on failure')
     group.add_argument('-q', '--quiet', action='store_true',
@@ -295,22 +295,22 @@ def _create_parser():
                             more_details)
     group.add_argument('-m', '--match', metavar='PAT',
                        dest='match_tests', action=FilterAction, const=True,
-                       help='match test cases and methods with glob pattern 
PAT')
+                       help='match test cases and methods with glob pattern 
`PAT`')
     group.add_argument('-i', '--ignore', metavar='PAT',
                        dest='match_tests', action=FilterAction, const=False,
-                       help='ignore test cases and methods with glob pattern 
PAT')
+                       help='ignore test cases and methods with glob pattern 
`PAT`')
     group.add_argument('--matchfile', metavar='FILENAME',
                        dest='match_tests',
                        action=FromFileFilterAction, const=True,
-                       help='similar to --match but get patterns from a '
+                       help='similar to `--match` but get patterns from a '
                             'text file, one pattern per line')
     group.add_argument('--ignorefile', metavar='FILENAME',
                        dest='match_tests',
                        action=FromFileFilterAction, const=False,
-                       help='similar to --matchfile but it receives patterns '
+                       help='similar to `--matchfile` but it receives patterns 
'
                             'from text file to ignore')
     group.add_argument('-G', '--failfast', action='store_true',
-                       help='fail as soon as a test fails (only with -v or 
-W)')
+                       help='fail as soon as a test fails (only with `-v` or 
`-W`)')
     group.add_argument('-u', '--use', metavar='RES1,RES2,...',
                        action='extend', type=resources_list,
                        help='specify which special resource intensive tests '
@@ -325,7 +325,7 @@ def _create_parser():
 
     group = parser.add_argument_group('Special runs')
     group.add_argument('-L', '--runleaks', action='store_true',
-                       help='run the leaks(1) command just before exit.' +
+                       help='run the `leaks(1)` command just before exit.' +
                             more_details)
     group.add_argument('-R', '--huntrleaks', metavar='RUNCOUNTS',
                        type=huntrleaks,
@@ -333,20 +333,20 @@ def _create_parser():
                             'very slow).' + more_details)
     group.add_argument('-j', '--multiprocess', metavar='PROCESSES',
                        dest='use_mp', type=int,
-                       help='run PROCESSES processes at once')
+                       help='run `PROCESSES` processes at once')
     group.add_argument('--single-process', action='store_true',
                        dest='single_process',
                        help='always run all tests sequentially in '
-                            'a single process, ignore -jN option, '
+                            'a single process, ignore `-jN` option, '
                             'and failed tests are also rerun sequentially '
                             'in the same process')
     group.add_argument('--parallel-threads', metavar='PARALLEL_THREADS',
                        type=int,
-                       help='run copies of each test in PARALLEL_THREADS at '
+                       help='run copies of each test in `PARALLEL_THREADS` at '
                             'once')
     group.add_argument('-T', '--coverage', action='store_true',
                        dest='trace',
-                       help='turn on code coverage tracing using the trace '
+                       help='turn on code coverage tracing using the `trace` '
                             'module')
     group.add_argument('-D', '--coverdir', metavar='DIR',
                        type=relative_filename,
@@ -356,18 +356,18 @@ def _create_parser():
                        help='put coverage files alongside modules')
     group.add_argument('-t', '--threshold', metavar='THRESHOLD',
                        type=int,
-                       help='call gc.set_threshold(THRESHOLD)')
+                       help='call `gc.set_threshold(THRESHOLD)`')
     group.add_argument('-n', '--nowindows', action='store_true',
                        help='suppress error message boxes on Windows')
     group.add_argument('-F', '--forever', action='store_true',
                        help='run the specified tests in a loop, until an '
-                            'error happens; imply --failfast')
+                            'error happens; imply `--failfast`')
     group.add_argument('--list-tests', action='store_true',
                        help="only write the name of tests that will be run, "
                             "don't execute them")
     group.add_argument('--list-cases', action='store_true',
-                       help='only write the name of test cases that will be 
run'
-                            ' , don\'t execute them')
+                       help='only write the name of test cases that will be 
run, '
+                            'don\'t execute them')
     group.add_argument('-P', '--pgo', dest='pgo', action='store_true',
                        help='enable Profile Guided Optimization (PGO) 
training')
     group.add_argument('--pgo-extended', action='store_true',
@@ -390,11 +390,11 @@ def _create_parser():
     group.add_argument('--tempdir', metavar='PATH',
                        help='override the working directory for the test run')
     group.add_argument('--cleanup', action='store_true',
-                       help='remove old test_python_* directories')
+                       help='remove old `test_python_*` directories')
     group.add_argument('--bisect', action='store_true',
-                       help='if some tests fail, run test.bisect_cmd on them')
+                       help='if some tests fail, run `test.bisect_cmd` on 
them')
     group.add_argument('--pythoninfo', action='store_true',
-                       help="run python -m test.pythoninfo before tests")
+                       help="run `python -m test.pythoninfo` before tests")
     group.add_argument('--dont-add-python-opts', dest='_add_python_opts',
                        action='store_false',
                        help="internal option, don't use it")
diff --git a/Lib/timeit.py b/Lib/timeit.py
index a897d9663c24e2..01bdfd901e30d5 100644
--- a/Lib/timeit.py
+++ b/Lib/timeit.py
@@ -299,14 +299,14 @@ def main(args=None, *, _wrap_timer=None):
         "-p",
         "--process",
         action="store_true",
-        help="use time.process_time() (default is time.perf_counter())",
+        help="use `time.process_time()` (default is `time.perf_counter()`)",
     )
     parser.add_argument(
         "-t",
         "--target-time",
         type=float,
         default=default_target_time,
-        help="if --number is 0 the code will run until it takes "
+        help="if `--number` is 0 the code will run until it takes "
         "at least this many seconds (default %(default)s)",
     )
     parser.add_argument(
diff --git a/Lib/tokenize.py b/Lib/tokenize.py
index 52cf3f0b7ccaa9..3545d92c4f5d7f 100644
--- a/Lib/tokenize.py
+++ b/Lib/tokenize.py
@@ -578,7 +578,7 @@ def error(message, filename=None, location=None):
     parser = argparse.ArgumentParser()
     parser.add_argument(dest='filename', nargs='?',
                         metavar='filename.py',
-                        help='the file to tokenize; defaults to stdin')
+                        help='the file to tokenize; defaults to `stdin`')
     parser.add_argument('-e', '--exact', dest='exact', action='store_true',
                         help='display token names using the exact type')
     args = parser.parse_args(args)
diff --git a/Lib/trace.py b/Lib/trace.py
index cd3a6d30661da3..43ec201c4696d1 100644
--- a/Lib/trace.py
+++ b/Lib/trace.py
@@ -604,7 +604,7 @@ def results(self):
 def main():
     import argparse
 
-    parser = argparse.ArgumentParser(color=True)
+    parser = argparse.ArgumentParser()
     parser.add_argument('--version', action='version', version='trace 2.0')
 
     grp = parser.add_argument_group('Main options',
@@ -612,27 +612,27 @@ def main():
 
     grp.add_argument('-c', '--count', action='store_true',
             help='Count the number of times each line is executed and write '
-                 'the counts to <module>.cover for each module executed, in '
-                 'the module\'s directory. See also --coverdir, --file, '
-                 '--no-report below.')
+                 'the counts to `<module>.cover` for each module executed, in '
+                 'the module\'s directory. See also `--coverdir`, `--file`, '
+                 '`--no-report` below.')
     grp.add_argument('-t', '--trace', action='store_true',
-            help='Print each line to sys.stdout before it is executed')
+            help='Print each line to `sys.stdout` before it is executed')
     grp.add_argument('-l', '--listfuncs', action='store_true',
             help='Keep track of which functions are executed at least once '
-                 'and write the results to sys.stdout after the program exits. 
'
-                 'Cannot be specified alongside --trace or --count.')
+                 'and write the results to `sys.stdout` after the program 
exits. '
+                 'Cannot be specified alongside `--trace` or `--count`.')
     grp.add_argument('-T', '--trackcalls', action='store_true',
             help='Keep track of caller/called pairs and write the results to '
-                 'sys.stdout after the program exits.')
+                 '`sys.stdout` after the program exits.')
 
     grp = parser.add_argument_group('Modifiers')
 
     _grp = grp.add_mutually_exclusive_group()
     _grp.add_argument('-r', '--report', action='store_true',
             help='Generate a report from a counts file; does not execute any '
-                 'code. --file must specify the results file to read, which '
-                 'must have been created in a previous run with --count '
-                 '--file=FILE')
+                 'code. `--file` must specify the results file to read, which '
+                 'must have been created in a previous run with `--count` '
+                 '`--file=FILE`')
     _grp.add_argument('-R', '--no-report', action='store_true',
             help='Do not generate the coverage report files. '
                  'Useful if you want to accumulate over several runs.')
@@ -641,14 +641,14 @@ def main():
             help='File to accumulate counts over several runs')
     grp.add_argument('-C', '--coverdir',
             help='Directory where the report files go. The coverage report '
-                 'for <package>.<module> will be written to file '
-                 '<dir>/<package>/<module>.cover')
+                 'for `<package>.<module>` will be written to file '
+                 '`<dir>/<package>/<module>.cover`')
     grp.add_argument('-m', '--missing', action='store_true',
             help='Annotate executable lines that were not executed with '
                  '">>>>>> "')
     grp.add_argument('-s', '--summary', action='store_true',
-            help='Write a brief summary for each file to sys.stdout. '
-                 'Can only be used with --count or --report')
+            help='Write a brief summary for each file to `sys.stdout`. '
+                 'Can only be used with `--count` or `--report`')
     grp.add_argument('-g', '--timing', action='store_true',
             help='Prefix each line with the time since the program started. '
                  'Only used while tracing')
@@ -661,7 +661,7 @@ def main():
                  'module names.')
     grp.add_argument('--ignore-dir', action='append', default=[],
             help='Ignore files in the given directory '
-                 '(multiple directories can be joined by os.pathsep).')
+                 '(multiple directories can be joined by `os.pathsep`).')
 
     parser.add_argument('--module', action='store_true', default=False,
                         help='Trace a module. ')
diff --git a/Lib/unittest/main.py b/Lib/unittest/main.py
index be99d93c78cca6..6eeebf9657a3c7 100644
--- a/Lib/unittest/main.py
+++ b/Lib/unittest/main.py
@@ -172,7 +172,7 @@ def _getParentArgParser(self):
                             help='Show local variables in tracebacks')
         parser.add_argument('--durations', dest='durations', type=int,
                             default=None, metavar="N",
-                            help='Show the N slowest test cases (N=0 for all)')
+                            help='Show the `N` slowest test cases (`N=0` for 
all)')
         if self.failfast is None:
             parser.add_argument('-f', '--failfast', dest='failfast',
                                 action='store_true',
@@ -181,12 +181,12 @@ def _getParentArgParser(self):
         if self.catchbreak is None:
             parser.add_argument('-c', '--catch', dest='catchbreak',
                                 action='store_true',
-                                help='Catch Ctrl-C and display results so far')
+                                help='Catch `Ctrl-C` and display results so 
far')
             self.catchbreak = False
         if self.buffer is None:
             parser.add_argument('-b', '--buffer', dest='buffer',
                                 action='store_true',
-                                help='Buffer stdout and stderr during tests')
+                                help='Buffer `stdout` and `stderr` during 
tests')
             self.buffer = False
         if self.testNamePatterns is None:
             parser.add_argument('-k', dest='testNamePatterns',
@@ -197,7 +197,7 @@ def _getParentArgParser(self):
         return parser
 
     def _getMainArgParser(self, parent):
-        parser = argparse.ArgumentParser(parents=[parent], color=True)
+        parser = argparse.ArgumentParser(parents=[parent])
         parser.prog = self.progName
         parser.print_help = self._print_help
 
@@ -208,16 +208,16 @@ def _getMainArgParser(self, parent):
         return parser
 
     def _getDiscoveryArgParser(self, parent):
-        parser = argparse.ArgumentParser(parents=[parent], color=True)
+        parser = argparse.ArgumentParser(parents=[parent])
         parser.prog = '%s discover' % self.progName
         parser.epilog = ('For test discovery all test modules must be '
                          'importable from the top level directory of the '
                          'project.')
 
         parser.add_argument('-s', '--start-directory', dest='start',
-                            help="Directory to start discovery ('.' default)")
+                            help="Directory to start discovery (`.` default)")
         parser.add_argument('-p', '--pattern', dest='pattern',
-                            help="Pattern to match tests ('test*.py' default)")
+                            help="Pattern to match tests (`test*.py` default)")
         parser.add_argument('-t', '--top-level-directory', dest='top',
                             help='Top level directory of project (defaults to '
                                  'start directory)')
diff --git a/Lib/uuid.py b/Lib/uuid.py
index 8c59581464b0d0..4bdcb67775a2ea 100644
--- a/Lib/uuid.py
+++ b/Lib/uuid.py
@@ -955,7 +955,6 @@ def main():
     parser = argparse.ArgumentParser(
         formatter_class=argparse.ArgumentDefaultsHelpFormatter,
         description="Generate a UUID using the selected UUID function.",
-        color=True,
     )
     parser.add_argument("-u", "--uuid",
                         choices=uuid_funcs.keys(),
@@ -963,14 +962,14 @@ def main():
                         help="function to generate the UUID")
     parser.add_argument("-n", "--namespace",
                         metavar=f"{{any UUID,{','.join(namespaces)}}}",
-                        help="uuid3/uuid5 only: "
+                        help="`uuid3`/`uuid5` only: "
                         "a UUID, or a well-known predefined UUID addressed "
                         "by namespace name")
     parser.add_argument("-N", "--name",
-                        help="uuid3/uuid5 only: "
+                        help="`uuid3`/`uuid5` only: "
                         "name used as part of generating the UUID")
     parser.add_argument("-C", "--count", metavar="NUM", type=int, default=1,
-                        help="generate NUM fresh UUIDs")
+                        help="generate `NUM` fresh UUIDs")
 
     args = parser.parse_args()
     uuid_func = uuid_funcs[args.uuid]
diff --git a/Lib/venv/__init__.py b/Lib/venv/__init__.py
index 002f4ebc988a3b..0653a43a8b1776 100644
--- a/Lib/venv/__init__.py
+++ b/Lib/venv/__init__.py
@@ -621,7 +621,6 @@ def main(args=None):
                                             'activate it, e.g. by '
                                             'sourcing an activate script '
                                             'in its bin directory.',
-                                     color=True,
                                      )
     parser.add_argument('dirs', metavar='ENV_DIR', nargs='+',
                         help='A directory to create the environment in.')
diff --git a/Lib/webbrowser.py b/Lib/webbrowser.py
index 97aad6eea509eb..c2ee0df0ef8885 100644
--- a/Lib/webbrowser.py
+++ b/Lib/webbrowser.py
@@ -734,7 +734,7 @@ def open(self, url, new=0, autoraise=True):
 def parse_args(arg_list: list[str] | None):
     import argparse
     parser = argparse.ArgumentParser(
-        description="Open URL in a web browser.", color=True,
+        description="Open URL in a web browser.",
     )
     parser.add_argument("url", help="URL to open")
 
diff --git a/Lib/zipapp.py b/Lib/zipapp.py
index 7a4ef96ea0f077..a1cef18ada9d05 100644
--- a/Lib/zipapp.py
+++ b/Lib/zipapp.py
@@ -187,16 +187,16 @@ def main(args=None):
     """
     import argparse
 
-    parser = argparse.ArgumentParser(color=True)
+    parser = argparse.ArgumentParser()
     parser.add_argument('--output', '-o', default=None,
             help="The name of the output archive. "
-                 "Required if SOURCE is an archive.")
+                 "Required if `SOURCE` is an archive.")
     parser.add_argument('--python', '-p', default=None,
             help="The name of the Python interpreter to use "
                  "(default: no shebang line).")
     parser.add_argument('--main', '-m', default=None,
             help="The main function of the application "
-                 "(default: use an existing __main__.py).")
+                 "(default: use an existing `__main__.py`).")
     parser.add_argument('--compress', '-c', action='store_true',
             help="Compress files with the deflate method. "
                  "Files are stored uncompressed by default.")
diff --git a/Lib/zipfile/__init__.py b/Lib/zipfile/__init__.py
index 1e0cc5f6234f28..86c3bc36b695c7 100644
--- a/Lib/zipfile/__init__.py
+++ b/Lib/zipfile/__init__.py
@@ -2328,7 +2328,7 @@ def main(args=None):
     import argparse
 
     description = 'A simple command-line interface for zipfile module.'
-    parser = argparse.ArgumentParser(description=description, color=True)
+    parser = argparse.ArgumentParser(description=description)
     group = parser.add_mutually_exclusive_group(required=True)
     group.add_argument('-l', '--list', metavar='<zipfile>',
                        help='Show listing of a zipfile')
@@ -2341,7 +2341,7 @@ def main(args=None):
     group.add_argument('-t', '--test', metavar='<zipfile>',
                        help='Test if a zipfile is valid')
     parser.add_argument('--metadata-encoding', metavar='<encoding>',
-                        help='Specify encoding of member names for -l, -e and 
-t')
+                        help='Specify encoding of member names for `-l`, `-e` 
and `-t`')
     args = parser.parse_args(args)
 
     encoding = args.metadata_encoding
diff --git 
a/Misc/NEWS.d/next/Library/2026-05-05-00-30-04.gh-issue-142389.4daLzc.rst 
b/Misc/NEWS.d/next/Library/2026-05-05-00-30-04.gh-issue-142389.4daLzc.rst
new file mode 100644
index 00000000000000..4079854ef29349
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2026-05-05-00-30-04.gh-issue-142389.4daLzc.rst
@@ -0,0 +1,2 @@
+Add backticks to stdlib argparse help to display in colour. Patch by Hugo
+van Kemenade.

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to