1## Version 8.6.023Unreleased45- A parameter name that is not a valid Python identifier, or that is a Python6 keyword, is deprecated and raises `TypeError` in Click 9.0. {pr}`3866`7- An {class}`Option` name written as a Python identifier is deprecated when it8 is not already lower-cased. {pr}`3866`9- Add {attr}`Parameter.spec`, which returns how the user spells the parameter on10 the command line: `--times` for an option declared as `-t`, `--times`, and11 `FILENAME` for an argument declared as `filename`. {pr}`3877`12- Move {meth}`get_help_spec` from {class}`Option` to {class}`Parameter`, and give13 {class}`Argument` an override that returns its metavar. {pr}`3877`14- Error messages and deprecation warnings name an option by its spec instead of15 its internal name, so they read `The option '--my-option' is deprecated.` where16 they read `The option 'my_option' is deprecated.` before. {pr}`3877`17- {attr}`Parameter.human_readable_name` is deprecated and will be removed in18 Click 9.0. Use {attr}`Parameter.spec` instead. It returned the internal name19 for options, so its value changes from `my_option` to `--my-option`. Click no20 longer reads it, and a subclass that overrides it gets a warning when the class21 is defined. {pr}`3877`2223## Version 8.5.12425Unreleased2627- Fix `copy.deepcopy()` and `pickle` on a `Parameter`, `Option` or `Command`. {pr}`3805`28- A `KeyboardInterrupt` arriving while `Command.main()` reports an abort or an error,29 or while it exits, no longer escapes as an unhandled traceback. The command still30 exits with the intended code; only the message may be lost. {issue}`3802`31- Add {meth}`Option.get_help_spec`, which returns the option's left help32 column even when the option is hidden. {meth}`Option.get_help_record` still33 returns `None` for hidden options, so help screens are unchanged. {pr}`3821`34- The `Positional arguments` help section lists every argument of the command,35 not only the documented ones. An argument with no `help` gets an empty36 description, the same way an option with no `help` does. {pr}`3860`37- {meth}`Argument.get_help_record` always returns a tuple. It used to return38 `None` for an argument with no `help`. {pr}`3860`39- Document which types are inferred from `default`, and what an unrecognized40 `type` callable does to a command-line value. {issue}`3036` {pr}`3808`41- `path_type` narrows the converted value's type for `convert` and `prompt`.42 {issue}`3822` {pr}`3858`43- {class}`Parameter` accepts a new `help` argument and {class}`Option` and {class}`Argument`44 inherits it. {meth}`Parameter.to_info_dict` now reports `help` for every kind of parameter.45 {pr}`3861`46- A command's short help no longer stops at an abbreviation such as `vs.` or `e.g.`47 inside the first sentence. A period ends the sentence only when it closes the text48 or the next word does not start in lowercase. {pr}`3865`4950## Version 8.5.05152Released 2026-08-245354- Add built-in shell completion support for PowerShell (Windows PowerShell55 5.1+ and pwsh 7+) alongside the existing `bash`, `zsh`, and `fish`56 completers. Use `_FOO_BAR_COMPLETE=powershell_source foo-bar` to generate57 the completion script. {issue}`2672` {pr}`3637`58- Supported versions of Windows enable ANSI terminal styles by default.59 Colorama is no longer a dependency and is not used. {issue}`2986` {pr}`3505`60- {class}`Argument` accepts a `help` parameter, and help output includes61 a `Positional arguments` section when argument help is available. {issue}`2983` {pr}`3473`62- `confirm()` and `prompt()` strip ANSI color and style codes from the63 prompt when the output stream does not support them, matching `echo()`.64 This stripping was lost in `8.4.0` when {pr}`2969` began writing the65 prompt with `input()` directly. {issue}`3572` {pr}`3653`66- Fix test failures when using pytest >= 9.1. {pr}`3656`67- {class}`Path` with `allow_dash=True` no longer triggers a `BytesWarning`,68 an error under `python -bb`, when checking a value against the `-`69 convention. {issue}`2877` {pr}`3642`70- Add {func}`custom_version_option`, a `--version` option whose output is71 produced by a callback, covering cases {func}`version_option` intentionally72 does not. The feature set of {func}`version_option` is now frozen; see73 [discussion #3527](https://github.com/pallets/click/discussions/3527). {pr}`3581`74- `style()` and `secho()` no longer silently drop the 256-color index `0`75 (black) passed as `fg` or `bg`, and now validate color arguments. Invalid76 colors raise a `ValueError` instead of a `TypeError`. {pr}`3677`77- The automatic help option stores its value under the reserved name78 `_click_default_help` instead of `help`, so a parameter named `help` no79 longer breaks parsing. The new name is visible in80 {meth}`Command.to_info_dict` output. Parameters that overwrite each other's81 value trigger a warning: an argument sharing its name with another82 parameter, or any parameter claiming the reserved name. Options may still83 share a name to compete for the same value (feature switches).84 {issue}`2819` {pr}`3678`85- `unstyle` and the ANSI handling behind help-text wrapping now strip the full86 CSI escape-sequence grammar. {pr}`3681`87- Streamline `Option` flag handling: the flag-kind, type, lazy-default and88 validation steps in `Option.__init__` move into focused helpers, and89 `flag_value` and `default` keep their unset sentinel at construction90 (resolved lazily on read) so `is UNSET` reliably tells a user-supplied value91 from an auto-derived one. Runtime behavior is unchanged, but92 {meth}`Parameter.to_info_dict` now resolves `default=True` on a feature93 switch to its `flag_value`, matching what the function receives at call94 time. {pr}`3641`95- {func}`get_binary_stream` and {func}`get_text_stream` are deprecated and96 will be removed in Click 9.0. {issue}`3481` {pr}`3695`97- The following `click.utils` names were never intentionally public and are98 now private (`_`-prefixed). The old names remain available with a99 `DeprecationWarning` until Click 9.0: `LazyFile`, `KeepOpenFile`,100 `make_default_short_help`, `PacifyFlushWrapper`, and `safecall`.101 {issue}`3099` {pr}`3695`102- Deprecate {meth}`CliRunner.isolated_filesystem`. It relies on103 {func}`os.chdir`, which mutates process-global state and is not104 thread-safe. The helper predates Python 3 and modern pytest: use a105 temporary directory ({class}`tempfile.TemporaryDirectory` or pytest's106 `tmp_path` fixture) with absolute paths instead. For running tests in107 parallel, use process-based isolation (such as `pytest-xdist`) rather108 than threads, since {meth}`CliRunner.invoke` also redirects the109 process-global standard streams. {issue}`3501` {issue}`3700` {pr}`3704`110- `prompt()` is now generically typed and returns the type produced by111 `type`, `value_proc`, or a matching `default` instead of `Any`.112 {class}`ParamType` takes a second optional type parameter describing the113 input value it accepts (`ParamType[int, str]` for a type converting114 strings to integers), defaulting to `Any`. {pr}`3407`115- {meth}`Command.get_help_option_names` returns the help option names in the116 order they were declared. {pr}`3728`117- {func}`get_pager_file` yields a text stream on Windows again. The temporary118 file backend opened its file in binary mode, so writing a `str` to the pager119 raised `TypeError: a bytes-like object is required, not 'str'`, and the120 `color` argument was ignored on that path. Regression introduced in `8.4.0`121 by {pr}`1572`. {issue}`3731` {issue}`3732` {issue}`3740` {pr}`3739`122- {func}`progressbar` settles on its final position when `update_min_steps`123 does not divide the total. Steps below that threshold are applied when the124 bar finishes, so `show_pos` renders `20/20` rather than the last multiple125 it reached. {issue}`3571` {pr}`3769`126- An error raised while writing to the pager no longer gets replaced by127 `PermissionError: [WinError 32]` on Windows. The temporary file backend128 unlinked its file without closing it first, and Windows refuses to remove a129 file the process still holds open, so the cleanup failure masked the real130 exception. {issue}`3731` {pr}`3764`131- The temporary file the pager writes to on Windows is opened with the encoding132 {func}`get_pager_file` picked for the output stream, and with133 `errors="replace"` to match the pipe backend. Any text stdout can encode134 reaches the pager.135- The temporary file pager backend forwards any parameters the user set in136 `PAGER` to the pager command instead of silently dropping them. On Windows,137 `PAGER="less -R"` now invokes `less -R` on the temporary file rather than138 bare `less`. {pr}`3777`139- Improve raw mode detection by parsing the option tokens. {issue}`3416`140 {pr}`3777`141- {func}`edit` accepts `os.PathLike` values for `filename`, in addition to142 strings. {issue}`2869` {pr}`3781`143144## Version 8.4.2145146Released 2026-06-24147148- Fix Fish shell completion broken in `8.4.0` by {pr}`3126`. Newlines and149 tabs in option help text are now escaped, keeping the original completion150 format while still supporting multi-line help. {issue}`3502`151 {issue}`3043` {pr}`3504` {pr}`3508`152- Deprecated commands and options with empty or missing help text no longer153 render a stray leading space before the `(DEPRECATED)` label. {pr}`3509`154- A {class}`Group` with `invoke_without_command=True` marks its subcommand as155 optional in the usage help, showing `[COMMAND]` instead of `COMMAND`.156 {issue}`3059` {pr}`3507`157- `echo_via_pager` flushes after each write, so passing a generator streams158 output to the pager incrementally instead of staying hidden until the pipe159 buffer fills. {issue}`3242` {issue}`2542` {pr}`3534`160- `echo_via_pager` and `get_pager_file` no longer close a borrowed stdout161 stream when no external pager runs, completing the partial162 `I/O operation on closed file` fix from {pr}`3482`. {issue}`3449`163 {pr}`3533`164- Fix CLI usage symopsis for optional arguments producing double square brackets165 `[[a|b|c]]...` whose type already brackets their metavar. {pr}`3578`166- {func}`version_option` resolves a `package_name` that does not match an167 installed distribution as an import (top-level module) name via168 {func}`importlib.metadata.packages_distributions`. Packages whose169 top-level module name differs from their distribution name (`PIL` vs170 `Pillow`, `jwt` vs `PyJWT`) no longer raise `RuntimeError` out of the171 box. {issue}`2331` {issue}`1884` {issue}`3125` {pr}`3582`172173## Version 8.4.1174175Released 2026-05-21176177- `get_parameter_source()` is available during eager callbacks and type178 conversion again. {issue}`3458` {pr}`3484`179- Zsh completion scripts parse correctly on Windows. {issue}`3277` {pr}`3466`180- Shell completion of `Enum` values used as `Choice` options produces a181 valid completion result. {issue}`3015` {pr}`3471`182- Fix empty byte-string handling in echo. {issue}`3487` {pr}`3493`183- Fix closed file error with `echo_via_pager`. {issue}`3449` {pr}`3482`184- Fix `open_url` on Windows when the file path contains spaces.185 {issue}`2994` {pr}`3478`186187## Version 8.4.0188189Released 2026-05-17190191- {class}`ParamType` typing improvements. {pr}`3371`192193 - {class}`ParamType` is now a generic abstract base class,194 parameterized by its converted value type.195 - {meth}`~ParamType.convert` return types are narrowed on all196 concrete types (`str` for {class}`STRING`, `int` for197 {class}`INT`, etc.).198 - {meth}`~ParamType.to_info_dict` returns specific199 {class}`~typing.TypedDict` subclasses instead of200 `dict[str, Any]`.201 - {class}`CompositeParamType` and the number-range base are now202 generic with abstract methods.203204- Refactor `convert_type` to extract type inference into a private205 `_guess_type` helper, and add {func}`typing.overload` signatures.206 {pr}`3372`207208- {class}`Parameter` typing improvements. {pr}`2805`209210 - {class}`Parameter` is now an abstract base class, making explicit211 that it cannot be instantiated directly.212 - {attr}`Parameter.name` is now `str` instead of `str | None`.213 When `expose_value=False`, the name is set to `""` instead214 of `None`.215 - The `ctx` parameter of {meth}`Parameter.get_error_hint` is now216 typed as `Context | None`, matching the runtime behavior.217218- Split string values from `default_map` for parameters with `nargs > 1`219 or {class}`Tuple` type, matching environment variable behavior.220 {issue}`2745` {pr}`3364`221222- Auto-detect `type=UNPROCESSED` for `flag_value` of non-basic types223 (not `str`, `int`, `float`, or `bool`), so programmer-provided224 Python objects like classes and enum members are passed through unchanged225 instead of being stringified. Previously `type=click.UNPROCESSED` had226 to be set explicitly. {issue}`2012` {pr}`3363`227228- The error hint now uses {meth}`Command.get_help_option_names` to pick229 non-shadowed help option names, so `Try '... -h'` no longer points to a230 subcommand option that shadows `-h`. The longest surviving name is231 shown (`--help` over `-h`) for readability. {issue}`2790` {pr}`3208`232233- Fix readline functionality on non-Windows platforms. Prompt text is now234 passed directly to readline instead of being printed separately, allowing235 proper backspace, line editing, and line wrapping behavior. {issue}`2968`236 {pr}`2969`237238- Use {func}`os.startfile` on Windows to open URLs in {func}`open_url`,239 replacing the `start` built-in which cannot be invoked without240 `shell=True`. {issue}`2868` {issue}`3164` {pr}`3186`241242- Fix Fish shell completion errors when option help text contains newlines.243 {issue}`3043` {pr}`3126`244245- Add {class}`NoSuchCommand` exception with suggestions for misspelled246 commands. {issue}`3107` {pr}`3228`247248- Use {class}`ValueError` message when conversion in {class}`FuncParamType` would249 fail. {issue}`3105` {pr}`3211`250251- Add `click.get_pager_file` for file-like access to an output252 pager. {pr}`1572` {pr}`3405`253254- {func}`~click.formatting.wrap_text` now measures line width in visible255 characters, ignoring ANSI escape sequences. {pr}`3420`256257- Fix {meth}`HelpFormatter.write_usage` emitting only a blank line when258 called without `args`. The usage prefix and program name are now259 written even when no arguments follow, and the trailing separator260 space is stripped so the line ends at the program name.261 {issue}`3360` {pr}`3434`262263- Show custom error messages from types when {func}`prompt` with264 `hide_input=True` fails validation, instead of always showing a265 generic message. Built-in type messages mask the input value.266 {issue}`2809` {pr}`3256`267268- Add `capture` parameter to {class}`CliRunner` with two modes: `sys`269 (default) and `fd`. `fd` redirects file descriptors `1` and `2`270 via {func}`os.dup2` so output that bypasses `sys.stdout` (stale stream271 references, C extensions, subprocesses, `faulthandler`) is captured272 with proper isolation. {issue}`854` {issue}`2412` {issue}`2468`273 {issue}`2497` {issue}`2761` {issue}`2827` {issue}`2865` {pr}`3391`274275- Revert the `8.3.3` change that exposed the original file descriptor276 via `fileno()` on the redirected `CliRunner` streams in the default277 capture mode. `os.dup2(w, sys.stdout.fileno())` calls inside a CLI no278 longer mutate the host runner's stdout, which broke Pytest's `fd`-level279 capture teardown. C-level consumers that need a real `fd` should use280 `capture="fd"`. {issue}`3384` {pr}`3391`281282- Mark additional built-in strings with `gettext()` to extend translation283 coverage. {pr}`2902`284285- Fix feature switch groups (several `flag_value` options sharing one286 parameter name) silently dropping an explicit `default` when a sibling287 option without an explicit default was declared first. Arbitration is now288 source-aware: a more explicit {class}`ParameterSource` always wins, and289 within `ParameterSource.DEFAULT`, an option that received an explicit290 `default=` keyword wins over a sibling whose default was auto-derived.291 The 8.3.x first-wins fallback for remaining ties was reverted to the292 pre-8.3.x last-wins fallback. {issue}`3403` {pr}`3404`293294- Fix missing space between option help text and the `(DEPRECATED)`295 label, and localize the option label so it matches the command label.296 The label and the `DeprecationWarning` reason suffix are now produced297 by shared helpers. {pr}`3423`298299- Document short option stacking (`-abc` is parsed as `-a -b -c`) and300 clarify that multi-character short option names are not supported.301 {issue}`2779` {pr}`3431`302303## Version 8.3.3304305Released 2026-04-20306307- Use {func}`shlex.split` to split pager and editor commands into `argv`308 lists for {class}`subprocess.Popen`, removing `shell=True`.309 {issue}`1026` {pr}`1477` {pr}`2775`310- Fix `TypeError` when rendering help for an option whose default value is311 an object that doesn't support equality comparison with strings, such as312 `semver.Version`. {issue}`3298` {pr}`3299`313- Fix pager test pollution under parallel execution by using pytest's314 `tmp_path` fixture instead of a shared temporary file path. {pr}`3238`315- Treat `Sentinel.UNSET` values in a `default_map` as absent, so they fall316 through to the next default source instead of being used as the value.317 {issue}`3224` {pr}`3240`318- Patch `pdb.Pdb` in `CliRunner` isolation so `pdb.set_trace()`,319 `breakpoint()`, and debuggers subclassing `pdb.Pdb` (ipdb, pdbpp) can320 interact with the real terminal instead of the captured I/O streams.321 {issue}`654` {issue}`824` {issue}`843` {pr}`951` {pr}`3235`322- Add optional randomized parallel test execution using `pytest-randomly` and323 `pytest-xdist` to detect test pollution and race conditions. {pr}`3151`324- Add contributor documentation for running stress tests, randomized325 parallel tests, and Flask smoke tests. {pr}`3151` {pr}`3177`326- Show custom `show_default` string in prompts, matching the existing327 help text behavior. {issue}`2836` {pr}`2837` {pr}`3165` {pr}`3262` {pr}`3280`328 {pr}`3328`329- Fix `default=True` with boolean `flag_value` always returning the330 `flag_value` instead of `True`. The `default=True` to `flag_value`331 substitution now only applies to non-boolean flags, where `True` acts as a332 sentinel meaning "activate this flag by default". For boolean flags,333 `default=True` is returned as a literal value. {issue}`3111` {pr}`3239`334- Mark `make_default_short_help` as private API. {issue}`3189` {pr}`3250`335- `CliRunner`'s redirected streams now expose the original file descriptor336 via `fileno()`, so that `faulthandler`, `subprocess`, and other337 C-level consumers no longer crash with `io.UnsupportedOperation`.338 {issue}`2865`339- Change {class}`ParameterSource` to an {class}`~enum.IntEnum` and reorder340 its members from most to least explicit, so values can be compared to341 check whether a parameter was explicitly provided. {issue}`2879` {pr}`3248`342343## Version 8.3.2344345Released 2026-04-02346347- Fix handling of `flag_value` when `is_flag=False` to allow such options to be348 used without an explicit value. {issue}`3084` {pr}`3152`349- Hide `Sentinel.UNSET` values as `None` when using `lookup_default()`.350 {issue}`3136` {pr}`3199` {pr}`3202` {pr}`3209` {pr}`3212` {pr}`3224`351- Prevent `_NamedTextIOWrapper` from closing streams owned by `StreamMixer`.352 {issue}`824` {issue}`2991` {issue}`2993` {issue}`3110` {pr}`3139` {pr}`3140`353- Add comprehensive tests for `CliRunner` stream lifecycle, covering354 logging interaction, multi-threaded safety, and sequential invocation355 isolation. Add high-iteration stress tests behind a `stress` marker356 with a dedicated CI job. {pr}`3139`357- Fix callable `flag_value` being instantiated when used as a default via358 `default=True`. {issue}`3121` {pr}`3201` {pr}`3213` {pr}`3225`359360## Version 8.3.1361362Released 2025-11-15363364- Don't discard pager arguments by correctly using `subprocess.Popen`. {issue}`3039`365 {pr}`3055`366- Replace `Sentinel.UNSET` default values by `None` as they're passed through367 the `Context.invoke()` method. {issue}`3066` {issue}`3065` {pr}`3068`368- Fix conversion of `Sentinel.UNSET` happening too early, which caused incorrect369 behavior for multiple parameters using the same name. {issue}`3071` {pr}`3079`370- Hide `Sentinel.UNSET` values as `None` when looking up for other parameters371 through the context inside parameter callbacks. {issue}`3136` {pr}`3137`372- Fix rendering when `prompt` and `confirm` parameter `prompt_suffix` is373 empty. {issue}`3019` {pr}`3021`374- When `Sentinel.UNSET` is found during parsing, it will skip calls to375 `type_cast_value`. {issue}`3069` {pr}`3090`376377## Version 8.3.0378379Released 2025-09-17380381- **Improved flag option handling**: Reworked the relationship between `flag_value`382 and `default` parameters for better consistency:383384 - The `default` parameter value is now preserved as-is and passed directly385 to CLI functions (no more unexpected transformations)386 - Exception: flag options with `default=True` maintain backward compatibility387 by defaulting to their `flag_value`388 - The `default` parameter can now be any type (`bool`, `None`, etc.)389 - Fixes inconsistencies reported in: {issue}`1992` {issue}`2514` {issue}`2610`390 {issue}`3024` {pr}`3030`391392- Allow `default` to be set on `Argument` for `nargs = -1`. {issue}`2164`393 {pr}`3030`394395- Show correct auto complete value for `nargs` option in combination with flag396 option {issue}`2813`397398- Fix handling of quoted and escaped parameters in Fish autocompletion. {issue}`2995` {pr}`3013`399400- Lazily import `shutil`. {pr}`3023`401402- Properly forward exception information to resources registered with403 `click.core.Context.with_resource()`. {issue}`2447` {pr}`3058`404405- Fix regression related to EOF handling in `CliRunner`. {issue}`2939` {pr}`2940`406407## Version 8.2.2408409Released 2025-07-31410411- Fix reconciliation of `default`, `flag_value` and `type` parameters for412 flag options, as well as parsing and normalization of environment variables.413 {issue}`2952` {pr}`2956`414- Fix typing issue in `BadParameter` and `MissingParameter` exceptions for the415 parameter `param_hint` that did not allow for a sequence of string where the416 underlying function `_join_param_hints` allows for it. {issue}`2777` {pr}`2990`417- Use the value of `Enum` choices to render their default value in help418 screen. Refs {issue}`2911` {pr}`3004`419- Fix completion for the Z shell (`zsh`) for completion items containing420 colons. {issue}`2703` {pr}`2846`421- Don't include envvar in error hint when not configured. {issue}`2971` {pr}`2972`422- Fix a rare race in `click.testing.StreamMixer`'s finalization that manifested423 as a `ValueError` on close in a multi-threaded test session.424 {issue}`2993` {pr}`2991`425426## Version 8.2.1427428Released 2025-05-20429430- Fix flag value handling for flag options with a provided type. {issue}`2894`431 {issue}`2897` {pr}`2930`432- Fix shell completion for nested groups. {issue}`2906` {pr}`2907`433- Flush `sys.stderr` at the end of `CliRunner.invoke`. {issue}`2682`434- Fix EOF handling for stdin input in CliRunner. {issue}`2787`435436## Version 8.2.0437438Released 2025-05-10439440- Drop support for Python 3.7, 3.8, and 3.9. {pr}`2588` {pr}`2893`441442- Use modern packaging metadata with `pyproject.toml` instead of `setup.cfg`.443 {pr}`2438`444445- Use `flit_core` instead of `setuptools` as build backend. {pr}`2543`446447- Deprecate the `__version__` attribute. Use feature detection, or448 `importlib.metadata.version("click")`, instead. {issue}`2598`449450- `BaseCommand` is deprecated. `Command` is the base class for all451 commands. {issue}`2589`452453- `MultiCommand` is deprecated. `Group` is the base class for all group454 commands. {issue}`2590`455456- The current parser and related classes and methods, are deprecated.457 {issue}`2205`458459 - `OptionParser` and the `parser` module, which is a modified copy of460 `optparse` in the standard library.461 - `Context.protected_args` is unneeded. `Context.args` contains any462 remaining arguments while parsing.463 - `Parameter.add_to_parser` (on both `Argument` and `Option`) is464 unneeded. Parsing works directly without building a separate parser.465 - `split_arg_string` is moved from `parser` to `shell_completion`.466467- Enable deferred evaluation of annotations with468 `from __future__ import annotations`. {pr}`2270`469470- When generating a command's name from a decorated function's name, the471 suffixes `_command`, `_cmd`, `_group`, and `_grp` are removed.472 {issue}`2322`473474- Show the `types.ParamType.name` for `types.Choice` options within475 `--help` message if `show_choices=False` is specified.476 {issue}`2356`477478- Do not display default values in prompts when `Option.show_default` is479 `False`. {pr}`2509`480481- Add `get_help_extra` method on `Option` to fetch the generated extra482 items used in `get_help_record` to render help text. {issue}`2516`483 {pr}`2517`484485- Keep stdout and stderr streams independent in `CliRunner`. Always486 collect stderr output and never raise an exception. Add a new487 output stream to simulate what the user sees in its terminal. Removes488 the `mix_stderr` parameter in `CliRunner`. {issue}`2522` {pr}`2523`489490- `Option.show_envvar` now also shows environment variable in error messages.491 {issue}`2695` {pr}`2696`492493- `Context.close` will be called on exit. This results in all494 `Context.call_on_close` callbacks and context managers added via495 `Context.with_resource` to be closed on exit as well. {pr}`2680`496497- Add `ProgressBar(hidden: bool)` to allow hiding the progressbar. {issue}`2609`498499- A `UserWarning` will be shown when multiple parameters attempt to use the500 same name. {issue}`2396`501502- When using `Option.envvar` with `Option.flag_value`, the `flag_value`503 will always be used instead of the value of the environment variable.504 {issue}`2746` {pr}`2788`505506- Add `Choice.get_invalid_choice_message` method for customizing the507 invalid choice message. {issue}`2621` {pr}`2622`508509- If help is shown because `no_args_is_help` is enabled (defaults to `True`510 for groups, `False` for commands), the exit code is 2 instead of 0.511 {issue}`1489` {pr}`1489`512513- Contexts created during shell completion are closed properly, fixing514 a `ResourceWarning` when using `click.File`. {issue}`2644` {pr}`2800`515 {pr}`2767`516517- `click.edit(filename)` now supports passing an iterable of filenames in518 case the editor supports editing multiple files at once. Its return type519 is now also typed: `AnyStr` if `text` is passed, otherwise `None`.520 {issue}`2067` {pr}`2068`521522- Specialized typing of `progressbar(length=...)` as `ProgressBar[int]`.523 {pr}`2630`524525- Improve `echo_via_pager` behaviour in face of errors.526 {issue}`2674`527528 - Terminate the pager in case a generator passed to `echo_via_pager`529 raises an exception.530 - Ensure to always close the pipe to the pager process and wait for it531 to terminate.532 - `echo_via_pager` will not ignore `KeyboardInterrupt` anymore. This533 allows the user to search for future output of the generator when534 using less and then aborting the program using ctrl-c.535536- `deprecated: bool | str` can now be used on options and arguments. This537 previously was only available for `Command`. The message can now also be538 customised by using a `str` instead of a `bool`. {issue}`2263` {pr}`2271`539540 - `Command.deprecated` formatting in `--help` changed from541 `(Deprecated) help` to `help (DEPRECATED)`.542 - Parameters cannot be required nor prompted or an error is raised.543 - A warning will be printed when something deprecated is used.544545- Add a `catch_exceptions` parameter to `CliRunner`. If546 `catch_exceptions` is not passed to `CliRunner.invoke`, the value547 from `CliRunner` is used. {issue}`2817` {pr}`2818`548549- `Option.flag_value` will no longer have a default value set based on550 `Option.default` if `Option.is_flag` is `False`. This results in551 `Option.default` not needing to implement `__bool__`. {pr}`2829`552553- Incorrect `click.edit` typing has been corrected. {pr}`2804`554555- `Choice` is now generic and supports any iterable value.556 This allows you to use enums and other non-`str` values. {pr}`2796`557 {issue}`605`558559- Fix setup of help option's defaults when using a custom class on its560 decorator. Removes `HelpOption`. {issue}`2832` {pr}`2840`561562## Version 8.1.8563564Released 2024-12-19565566- Fix an issue with type hints for `click.open_file()`. {issue}`2717`567- Fix issue where error message for invalid `click.Path` displays on568 multiple lines. {issue}`2697`569- Fixed issue that prevented a default value of `""` from being displayed in570 the help for an option. {issue}`2500`571- The test runner handles stripping color consistently on Windows.572 {issue}`2705`573- Show correct value for flag default when using `default_map`.574 {issue}`2632`575- Fix `click.echo(color=...)` passing `color` to coloroma so it can be576 forced on Windows. {issue}`2606`.577- More robust bash version check, fixing problem on Windows with git-bash.578 {issue}`2638`579- Cache the help option generated by the `help_option_names` setting to580 respect its eagerness. {pr}`2811`581- Replace uses of `os.system` with `subprocess.Popen`. {issue}`1476`582- Exceptions generated during a command will use the context's `color`583 setting when being displayed. {issue}`2193`584- Error message when defining option with invalid name is more descriptive.585 {issue}`2452`586- Refactor code generating default `--help` option to deduplicate code.587 {pr}`2563`588- Test `CLIRunner` resets patched `_compat.should_strip_ansi`.589 {issue}`2732`590591## Version 8.1.7592593Released 2023-08-17594595- Fix issue with regex flags in shell completion. {issue}`2581`596- Bash version detection issues a warning instead of an error. {issue}`2574`597- Fix issue with completion script for Fish shell. {issue}`2567`598599## Version 8.1.6600601Released 2023-07-18602603- Fix an issue with type hints for `@click.group()`. {issue}`2558`604605## Version 8.1.5606607Released 2023-07-13608609- Fix an issue with type hints for `@click.command()`, `@click.option()`, and610 other decorators. Introduce typing tests. {issue}`2558`611612## Version 8.1.4613614Released 2023-07-06615616- Replace all `typing.Dict` occurrences to `typing.MutableMapping` for617 parameter hints. {issue}`2255`618- Improve type hinting for decorators and give all generic types parameters.619 {issue}`2398`620- Fix return value and type signature of `shell_completion.add_completion_class`621 function. {pr}`2421`622- Bash version detection doesn't fail on Windows. {issue}`2461`623- Completion works if there is a dot (`.`) in the program name. {issue}`2166`624- Improve type annotations for pyright type checker. {issue}`2268`625- Improve responsiveness of `click.clear()`. {issue}`2284`626- Improve command name detection when using Shiv or PEX. {issue}`2332`627- Avoid showing empty lines if command help text is empty. {issue}`2368`628- ZSH completion script works when loaded from `fpath`. {issue}`2344`.629- `EOFError` and `KeyboardInterrupt` tracebacks are not suppressed when630 `standalone_mode` is disabled. {issue}`2380`631- `@group.command` does not fail if the group was created with a custom632 `command_class`. {issue}`2416`633- `multiple=True` is allowed for flag options again and does not require634 setting `default=()`. {issue}`2246, 2292, 2295`635- Make the decorators returned by `@argument()` and `@option()` reusable when the636 `cls` parameter is used. {issue}`2294`637- Don't fail when writing filenames to streams with strict errors. Replace invalid638 bytes with the replacement character (`�`). {issue}`2395`639- Remove unnecessary attempt to detect MSYS2 environment. {issue}`2355`640- Remove outdated and unnecessary detection of App Engine environment. {pr}`2554`641- `echo()` does not fail when no streams are attached, such as with `pythonw` on642 Windows. {issue}`2415`643- Argument with `expose_value=False` do not cause completion to fail. {issue}`2336`644645## Version 8.1.3646647Released 2022-04-28648649- Use verbose form of `typing.Callable` for `@command` and650 `@group`. {issue}`2255`651- Show error when attempting to create an option with652 `multiple=True, is_flag=True`. Use `count` instead.653 {issue}`2246`654655## Version 8.1.2656657Released 2022-03-31658659- Fix error message for readable path check that was mixed up with the660 executable check. {pr}`2236`661- Restore parameter order for `Path`, placing the `executable`662 parameter at the end. It is recommended to use keyword arguments663 instead of positional arguments. {issue}`2235`664665## Version 8.1.1666667Released 2022-03-30668669- Fix an issue with decorator typing that caused type checking to670 report that a command was not callable. {issue}`2227`671672## Version 8.1.0673674Released 2022-03-28675676- Drop support for Python 3.6. {pr}`2129`677678- Remove previously deprecated code. {pr}`2130`679680 - `Group.resultcallback` is renamed to `result_callback`.681 - `autocompletion` parameter to `Command` is renamed to682 `shell_complete`.683 - `get_terminal_size` is removed, use684 `shutil.get_terminal_size` instead.685 - `get_os_args` is removed, use `sys.argv[1:]` instead.686687- Rely on {pep}`538` and {pep}`540` to handle selecting UTF-8 encoding688 instead of ASCII. Click's locale encoding detection is removed.689 {issue}`2198`690691- Single options boolean flags with `show_default=True` only show692 the default if it is `True`. {issue}`1971`693694- The `command` and `group` decorators can be applied with or695 without parentheses. {issue}`1359`696697- The `Path` type can check whether the target is executable.698 {issue}`1961`699700- `Command.show_default` overrides `Context.show_default`, instead701 of the other way around. {issue}`1963`702703- Parameter decorators and `@group` handles `cls=None` the same as704 not passing `cls`. `@option` handles `help=None` the same as705 not passing `help`. {issue}`##1959`706707- A flag option with `required=True` requires that the flag is708 passed instead of choosing the implicit default value. {issue}`1978`709710- Indentation in help text passed to `Option` and `Command` is711 cleaned the same as using the `@option` and `@command`712 decorators does. A command's `epilog` and `short_help` are also713 processed. {issue}`1985`714715- Store unprocessed `Command.help`, `epilog` and `short_help`716 strings. Processing is only done when formatting help text for717 output. {issue}`2149`718719- Allow empty str input for `prompt()` when720 `confirmation_prompt=True` and `default=""`. {issue}`2157`721722- Windows glob pattern expansion doesn't fail if a value is an invalid723 pattern. {issue}`2195`724725- It's possible to pass a list of `params` to `@command`. Any726 params defined with decorators are appended to the passed params.727 {issue}`2131`.728729- `@command` decorator is annotated as returning the correct type if730 a `cls` argument is used. {issue}`2211`731732- A `Group` with `invoke_without_command=True` and `chain=False`733 will invoke its result callback with the group function's return734 value. {issue}`2124`735736- `to_info_dict` will not fail if a `ParamType` doesn't define a737 `name`. {issue}`2168`738739- Shell completion prioritizes option values with option prefixes over740 new options. {issue}`2040`741742- Options that get an environment variable value using743 `autoenvvar_prefix` treat an empty value as `None`, consistent744 with a direct `envvar`. {issue}`2146`745746## Version 8.0.4747748Released 2022-02-18749750- `open_file` recognizes `Path("-")` as a standard stream, the751 same as the string `"-"`. {issue}`2106`752- The `option` and `argument` decorators preserve the type753 annotation of the decorated function. {pr}`2155`754- A callable default value can customize its help text by overriding755 `__str__` instead of always showing `(dynamic)`. {issue}`2099`756- Fix a typo in the Bash completion script that affected file and757 directory completion. If this script was generated by a previous758 version, it should be regenerated. {issue}`2163`759- Fix typing for `echo` and `secho` file argument.760 {issue}`2174, 2185`761762## Version 8.0.3763764Released 2021-10-10765766- Fix issue with `Path(resolve_path=True)` type creating invalid767 paths. {issue}`2088`768- Importing `readline` does not cause the `confirm()` prompt to769 disappear when pressing backspace. {issue}`2092`770- Any default values injected by `invoke()` are cast to the771 corresponding parameter's type. {issue}`2089, 2090`772773## Version 8.0.2774775Released 2021-10-08776777- `is_bool_flag` is not set to `True` if `is_flag` is `False`.778 {issue}`1925`779- Bash version detection is locale independent. {issue}`1940`780- Empty `default` value is not shown for `multiple=True`.781 {issue}`1969`782- Fix shell completion for arguments that start with a forward slash783 such as absolute file paths. {issue}`1929`784- `Path` type with `resolve_path=True` resolves relative symlinks785 to be relative to the containing directory. {issue}`1921`786- Completion does not skip Python's resource cleanup when exiting,787 avoiding some unexpected warning output. {issue}`1738, 2017`788- Fix type annotation for `type` argument in `prompt` function.789 {issue}`2062`790- Fix overline and italic styles, which were incorrectly added when791 adding underline. {pr}`2058`792- An option with `count=True` will not show "[x>=0]" in help text.793 {issue}`2072`794- Default values are not cast to the parameter type twice during795 processing. {issue}`2085`796- Options with `multiple` and `flag_value` use the flag value797 instead of leaving an internal placeholder. {issue}`2001`798799## Version 8.0.1800801Released 2021-05-19802803- Mark top-level names as exported so type checking understand imports804 in user projects. {issue}`1879`805- Annotate `Context.obj` as `Any` so type checking allows all806 operations on the arbitrary object. {issue}`1885`807- Fix some types that weren't available in Python 3.6.0. {issue}`1882`808- Fix type checking for iterating over `ProgressBar` object.809 {issue}`1892`810- The `importlib_metadata` backport package is installed on Python \<811 3.8. {issue}`1889`812- Arguments with `nargs=-1` only use env var value if no command813 line values are given. {issue}`1903`814- Flag options guess their type from `flag_value` if given, like815 regular options do from `default`. {issue}`1886`816- Added documentation that custom parameter types may be passed817 already valid values in addition to strings. {issue}`1898`818- Resolving commands returns the name that was given, not819 `command.name`, fixing an unintended change to help text and820 `default_map` lookups. When using patterns like `AliasedGroup`,821 override `resolve_command` to change the name that is returned if822 needed. {issue}`1895`823- If a default value is invalid, it does not prevent showing help824 text. {issue}`1889`825- Pass `windows_expand_args=False` when calling the main command to826 disable pattern expansion on Windows. There is no way to escape827 patterns in CMD, so if the program needs to pass them on as-is then828 expansion must be disabled. {issue}`1901`829830## Version 8.0.0831832Released 2021-05-11833834- Drop support for Python 2 and 3.5.835836- Colorama is always installed on Windows in order to provide style837 and color support. {pr}`1784`838839- Adds a repr to Command, showing the command name for friendlier840 debugging. {issue}`1267`, {pr}`1295`841842- Add support for distinguishing the source of a command line843 parameter. {issue}`1264`, {pr}`1329`844845- Add an optional parameter to `ProgressBar.update` to set the846 `current_item`. {issue}`1226`, {pr}`1332`847848- `version_option` uses `importlib.metadata` (or the849 `importlib_metadata` backport) instead of `pkg_resources`. The850 version is detected based on the package name, not the entry point851 name. The Python package name must match the installed package852 name, or be passed with `package_name=`. {issue}`1582`853854- If validation fails for a prompt with `hide_input=True`, the value855 is not shown in the error message. {issue}`1460`856857- An `IntRange` or `FloatRange` option shows the accepted range in858 its help text. {issue}`1525`, {pr}`1303`859860- `IntRange` and `FloatRange` bounds can be open (`<`) instead861 of closed (`<=`) by setting `min_open` and `max_open`. Error862 messages have changed to reflect this. {issue}`1100`863864- An option defined with duplicate flag names (`"--foo/--foo"`)865 raises a `ValueError`. {issue}`1465`866867- `echo()` will not fail when using pytest's `capsys` fixture on868 Windows. {issue}`1590`869870- Resolving commands returns the canonical command name instead of the871 matched name. This makes behavior such as help text and872 `Context.invoked_subcommand` consistent when using patterns like873 `AliasedGroup`. {issue}`1422`874875- The `BOOL` type accepts the values "on" and "off". {issue}`1629`876877- A `Group` with `invoke_without_command=True` will always invoke878 its result callback. {issue}`1178`879880- `nargs == -1` and `nargs > 1` is parsed and validated for881 values from environment variables and defaults. {issue}`729`882883- Detect the program name when executing a module or package with884 `python -m name`. {issue}`1603`885886- Include required parent arguments in help synopsis of subcommands.887 {issue}`1475`888889- Help for boolean flags with `show_default=True` shows the flag890 name instead of `True` or `False`. {issue}`1538`891892- Non-string objects passed to `style()` and `secho()` will be893 converted to string. {pr}`1146`894895- `edit(require_save=True)` will detect saves for editors that exit896 very fast on filesystems with 1 second resolution. {pr}`1050`897898- New class attributes make it easier to use custom core objects899 throughout an entire application. {pr}`938`900901 - `Command.context_class` controls the context created when902 running the command.903 - `Context.invoke` creates new contexts of the same type, so a904 custom type will persist to invoked subcommands.905 - `Context.formatter_class` controls the formatter used to906 generate help and usage.907 - `Group.command_class` changes the default type for908 subcommands with `@group.command()`.909 - `Group.group_class` changes the default type for subgroups910 with `@group.group()`. Setting it to `type` will create911 subgroups of the same type as the group itself.912 - Core objects use `super()` consistently for better support of913 subclassing.914915- Use `Context.with_resource()` to manage resources that would916 normally be used in a `with` statement, allowing them to be used917 across subcommands and callbacks, then cleaned up when the context918 ends. {pr}`1191`919920- The result object returned by the test runner's `invoke()` method921 has a `return_value` attribute with the value returned by the922 invoked command. {pr}`1312`923924- Required arguments with the `Choice` type show the choices in925 curly braces to indicate that one is required (`{a|b|c}`).926 {issue}`1272`927928- If only a name is passed to `option()`, Click suggests renaming it929 to `--name`. {pr}`1355`930931- A context's `show_default` parameter defaults to the value from932 the parent context. {issue}`1565`933934- `click.style()` can output 256 and RGB color codes. Most modern935 terminals support these codes. {pr}`1429`936937- When using `CliRunner.invoke()`, the replaced `stdin` file has938 `name` and `mode` attributes. This lets `File` options with939 the `-` value match non-testing behavior. {issue}`1064`940941- When creating a `Group`, allow passing a list of commands instead942 of a dict. {issue}`1339`943944- When a long option name isn't valid, use `difflib` to make better945 suggestions for possible corrections. {issue}`1446`946947- Core objects have a `to_info_dict()` method. This gathers948 information about the object's structure that could be useful for a949 tool generating user-facing documentation. To get the structure of950 an entire CLI, use `Context(cli).to_info_dict()`. {issue}`461`951952- Redesign the shell completion system. {issue}`1484`, {pr}`1622`953954 - Support Bash >= 4.4, Zsh, and Fish, with the ability for955 extensions to add support for other shells.956 - Allow commands, groups, parameters, and types to override their957 completions suggestions.958 - Groups complete the names commands were registered with, which959 can differ from the name they were created with.960 - The `autocompletion` parameter for options and arguments is961 renamed to `shell_complete`. The function must take962 `ctx, param, incomplete`, must do matching rather than return963 all values, and must return a list of strings or a list of964 `CompletionItem`. The old name and behavior is deprecated and965 will be removed in 8.1.966 - The env var values used to start completion have changed order.967 The shell now comes first, such as `{shell}_source` rather968 than `source_{shell}`, and is always required.969970- Completion correctly parses command line strings with incomplete971 quoting or escape sequences. {issue}`1708`972973- Extra context settings (`obj=...`, etc.) are passed on to the974 completion system. {issue}`942`975976- Include `--help` option in completion. {pr}`1504`977978- `ParameterSource` is an `enum.Enum` subclass. {issue}`1530`979980- Boolean and UUID types strip surrounding space before converting.981 {issue}`1605`982983- Adjusted error message from parameter type validation to be more984 consistent. Quotes are used to distinguish the invalid value.985 {issue}`1605`986987- The default value for a parameter with `nargs` > 1 and988 `multiple=True` must be a list of tuples. {issue}`1649`989990- When getting the value for a parameter, the default is tried in the991 same section as other sources to ensure consistent processing.992 {issue}`1649`993994- All parameter types accept a value that is already the correct type.995 {issue}`1649`996997- For shell completion, an argument is considered incomplete if its998 value did not come from the command line args. {issue}`1649`9991000- Added `ParameterSource.PROMPT` to track parameter values that were1001 prompted for. {issue}`1649`10021003- Options with `nargs` > 1 no longer raise an error if a default is1004 not given. Parameters with `nargs` > 1 default to `None`, and1005 parameters with `multiple=True` or `nargs=-1` default to an1006 empty tuple. {issue}`472`10071008- Handle empty env vars as though the option were not passed. This1009 extends the change introduced in 7.1 to be consistent in more cases.1010 {issue}`1285`10111012- `Parameter.get_default()` checks `Context.default_map` to1013 handle overrides consistently in help text, `invoke()`, and1014 prompts. {issue}`1548`10151016- Add `prompt_required` param to `Option`. When set to `False`,1017 the user will only be prompted for an input if no value was passed.1018 {issue}`736`10191020- Providing the value to an option can be made optional through1021 `is_flag=False`, and the value can instead be prompted for or1022 passed in as a default value.1023 {issue}`549, 736, 764, 921, 1015, 1618`10241025- Fix formatting when `Command.options_metavar` is empty. {pr}`1551`10261027- Revert adding space between option help text that wraps.1028 {issue}`1831`10291030- The default value passed to `prompt` will be cast to the correct1031 type like an input value would be. {pr}`1517`10321033- Automatically generated short help messages will stop at the first1034 ending of a phrase or double linebreak. {issue}`1082`10351036- Skip progress bar render steps for efficiency with very fast1037 iterators by setting `update_min_steps`. {issue}`676`10381039- Respect `case_sensitive=False` when doing shell completion for1040 `Choice` {issue}`1692`10411042- Use `mkstemp()` instead of `mktemp()` in pager implementation.1043 {issue}`1752`10441045- If `Option.show_default` is a string, it is displayed even if1046 `default` is `None`. {issue}`1732`10471048- `click.get_terminal_size()` is deprecated and will be removed in1049 8.1. Use {func}`shutil.get_terminal_size` instead. {issue}`1736`10501051- Control the location of the temporary directory created by1052 `CLIRunner.isolated_filesystem` by passing `temp_dir`. A custom1053 directory will not be removed automatically. {issue}`395`10541055- `click.confirm()` will prompt until input is given if called with1056 `default=None`. {issue}`1381`10571058- Option prompts validate the value with the option's callback in1059 addition to its type. {issue}`457`10601061- `confirmation_prompt` can be set to a custom string. {issue}`723`10621063- Allow styled output in Jupyter on Windows. {issue}`1271`10641065- `style()` supports the `strikethrough`, `italic`, and1066 `overline` styles. {issue}`805, 1821`10671068- Multiline marker is removed from short help text. {issue}`1597`10691070- Restore progress bar behavior of echoing only the label if the file1071 is not a TTY. {issue}`1138`10721073- Progress bar output is shown even if execution time is less than 0.51074 seconds. {issue}`1648`10751076- Progress bar `item_show_func` shows the current item, not the1077 previous item. {issue}`1353`10781079- The `Path` param type can be passed `path_type=pathlib.Path` to1080 return a path object instead of a string. {issue}`405`10811082- `TypeError` is raised when parameter with `multiple=True` or1083 `nargs > 1` has non-iterable default. {issue}`1749`10841085- Add a `pass_meta_key` decorator for passing a key from1086 `Context.meta`. This is useful for extensions using `meta` to1087 store information. {issue}`1739`10881089- `Path` `resolve_path` resolves symlinks on Windows Python < 3.8.1090 {issue}`1813`10911092- Command deprecation notice appears at the start of the help text, as1093 well as in the short help. The notice is not in all caps.1094 {issue}`1791`10951096- When taking arguments from `sys.argv` on Windows, glob patterns,1097 user dir, and env vars are expanded. {issue}`1096`10981099- Marked messages shown by the CLI with `gettext()` to allow1100 applications to translate Click's built-in strings. {issue}`303`11011102- Writing invalid characters to `stderr` when using the test runner1103 does not raise a `UnicodeEncodeError`. {issue}`848`11041105- Fix an issue where `readline` would clear the entire `prompt()`1106 line instead of only the input when pressing backspace. {issue}`665`11071108- Add all kwargs passed to `Context.invoke()` to `ctx.params`.1109 Fixes an inconsistency when nesting `Context.forward()` calls.1110 {issue}`1568`11111112- The `MultiCommand.resultcallback` decorator is renamed to1113 `result_callback`. The old name is deprecated. {issue}`1160`11141115- Fix issues with `CliRunner` output when using `echo_stdin=True`.1116 {issue}`1101`11171118- Fix a bug of `click.utils.make_default_short_help` for which the1119 returned string could be as long as `max_width + 3`. {issue}`1849`11201121- When defining a parameter, `default` is validated with1122 `multiple` and `nargs`. More validation is done for values being1123 processed as well. {issue}`1806`11241125- `HelpFormatter.write_text` uses the full line width when wrapping1126 text. {issue}`1871`11271128## Version 7.1.211291130Released 2020-04-2711311132- Revert applying shell quoting to commands for `echo_with_pager`1133 and `edit`. This was intended to allows spaces in commands, but1134 caused issues if the string was actually a command and arguments, or1135 on Windows. Instead, the string must be quoted manually as it should1136 appear on the command line. {issue}`1514`11371138## Version 7.1.111391140Released 2020-03-0911411142- Fix `ClickException` output going to stdout instead of stderr.1143 {issue}`1495`11441145## Version 7.111461147Released 2020-03-0911481149- Fix PyPI package name, "click" is lowercase again.1150- Fix link in `unicode_literals` error message. {pr}`1151`1151- Add support for colored output on UNIX Jupyter notebooks.1152 {issue}`1185`1153- Operations that strip ANSI controls will strip the cursor hide/show1154 sequences. {issue}`1216`1155- Remove unused compat shim for `bytes`. {pr}`1195`1156- Expand testing around termui, especially getchar on Windows.1157 {issue}`1116`1158- Fix output on Windows Python 2.7 built with MSVC 14. {pr}`1342`1159- Fix `OSError` when running in MSYS2. {issue}`1338`1160- Fix `OSError` when redirecting to `NUL` stream on Windows.1161 {issue}`1065`1162- Fix memory leak when parsing Unicode arguments on Windows.1163 {issue}`1136`1164- Fix error in new AppEngine environments. {issue}`1462`1165- Always return one of the passed choices for `click.Choice`1166 {issue}`1277`, {pr}`1318`1167- Add `no_args_is_help` option to `click.Command`, defaults to1168 False {pr}`1167`1169- Add `show_default` parameter to `Context` to enable showing1170 defaults globally. {issue}`1018`1171- Handle `env MYPATH=''` as though the option were not passed.1172 {issue}`1196`1173- It is once again possible to call `next(bar)` on an active1174 progress bar instance. {issue}`1125`1175- `open_file` with `atomic=True` retains permissions of existing1176 files and respects the current umask for new files. {issue}`1376`1177- When using the test `CliRunner` with `mix_stderr=False`, if1178 `result.stderr` is empty it will not raise a `ValueError`.1179 {issue}`1193`1180- Remove the unused `mix_stderr` parameter from1181 `CliRunner.invoke`. {issue}`1435`1182- Fix `TypeError` raised when using bool flags and specifying1183 `type=bool`. {issue}`1287`1184- Newlines in option help text are replaced with spaces before1185 re-wrapping to avoid uneven line breaks. {issue}`834`1186- `MissingParameter` exceptions are printable in the Python1187 interpreter. {issue}`1139`1188- Fix how default values for file-type options are shown during1189 prompts. {issue}`914`1190- Fix environment variable automatic generation for commands1191 containing `-`. {issue}`1253`1192- Option help text replaces newlines with spaces when rewrapping, but1193 preserves paragraph breaks, fixing multiline formatting.1194 {issue}`834, 1066, 1397`1195- Option help text that is wrapped adds an extra newline at the end to1196 distinguish it from the next option. {issue}`1075`1197- Consider `sensible-editor` when determining the editor to use for1198 `click.edit()`. {pr}`1469`1199- Arguments to system calls such as the executable path passed to1200 `click.edit` can contains spaces. {pr}`1470`1201- Add ZSH completion autoloading and error handling. {issue}`1348`1202- Add a repr to `Command`, `Group`, `Option`, and `Argument`,1203 showing the name for friendlier debugging. {issue}`1267`1204- Completion doesn't consider option names if a value starts with1205 `-` after the `--` separator. {issue}`1247`1206- ZSH completion escapes special characters in values. {pr}`1418`1207- Add completion support for Fish shell. {pr}`1423`1208- Decoding bytes option values falls back to UTF-8 in more cases.1209 {pr}`1468`1210- Make the warning about old 2-arg parameter callbacks a deprecation1211 warning, to be removed in 8.0. This has been a warning since Click1212 2.0. {pr}`1492`1213- Adjust error messages to standardize the types of quotes used so1214 they match error messages from Python.12151216## Version 7.012171218Released 2018-09-2512191220- Drop support for Python 2.6 and 3.3. {pr}`967, 976`1221- Wrap `click.Choice`'s missing message. {issue}`202`, {pr}`1000`1222- Add native ZSH autocompletion support. {issue}`323`, {pr}`865`1223- Document that ANSI color info isn't parsed from bytearrays in Python1224 2\. {issue}`334`1225- Document byte-stripping behavior of `CliRunner`. {issue}`334`,1226 {pr}`1010`1227- Usage errors now hint at the `--help` option. {issue}`393`,1228 {pr}`557`1229- Implement streaming pager. {issue}`409`, {pr}`889`1230- Extract bar formatting to its own method. {pr}`414`1231- Add `DateTime` type for converting input in given date time1232 formats. {pr}`423`1233- `secho`'s first argument can now be `None`, like in `echo`.1234 {pr}`424`1235- Fixes a `ZeroDivisionError` in `ProgressBar.make_step`, when the1236 arg passed to the first call of `ProgressBar.update` is 0.1237 {issue}`447`, {pr}`1012`1238- Show progressbar only if total execution time is visible. {pr}`487`1239- Added the ability to hide commands and options from help. {pr}`500`1240- Document that options can be `required=True`. {issue}`514`,1241 {pr}`1022`1242- Non-standalone calls to `Context.exit` return the exit code,1243 rather than calling `sys.exit`. {issue}`667`, {pr}`533, 1098`1244- `click.getchar()` returns Unicode in Python 3 on Windows,1245 consistent with other platforms. {issue}`537, 821, 822, 1088`,1246 {pr}`1108`1247- Added `FloatRange` type. {pr}`538, 553`1248- Added support for bash completion of `type=click.Choice` for1249 `Options` and `Arguments`. {issue}`535`, {pr}`681`1250- Only allow one positional arg for `Argument` parameter1251 declaration. {issue}`568, 574`, {pr}`1014`1252- Add `case_sensitive=False` as an option to Choice. {issue}`569`1253- `click.getchar()` correctly raises `KeyboardInterrupt` on "^C"1254 and `EOFError` on "^D" on Linux. {issue}`583`, {pr}`1115`1255- Fix encoding issue with `click.getchar(echo=True)` on Linux.1256 {pr}`1115`1257- `param_hint` in errors now derived from param itself.1258 {issue}`598, 704`, {pr}`709`1259- Add a test that ensures that when an argument is formatted into a1260 usage error, its metavar is used, not its name. {pr}`612`1261- Allow setting `prog_name` as extra in `CliRunner.invoke`.1262 {issue}`616`, {pr}`999`1263- Help text taken from docstrings truncates at the `\f` form feed1264 character, useful for hiding Sphinx-style parameter documentation.1265 {pr}`629, 1091`1266- `launch` now works properly under Cygwin. {pr}`650`1267- Update progress after iteration. {issue}`651`, {pr}`706`1268- `CliRunner.invoke` now may receive `args` as a string1269 representing a Unix shell command. {pr}`664`1270- Make `Argument.make_metavar()` default to type metavar. {pr}`675`1271- Add documentation for `ignore_unknown_options`. {pr}`684`1272- Add bright colors support for `click.style` and fix the reset1273 option for parameters `fg` and `bg`. {issue}`703`, {pr}`809`1274- Add `show_envvar` for showing environment variables in help.1275 {pr}`710`1276- Avoid `BrokenPipeError` during interpreter shutdown when stdout or1277 stderr is a closed pipe. {issue}`712`, {pr}`1106`1278- Document customizing option names. {issue}`725`, {pr}`1016`1279- Disable `sys._getframes()` on Python interpreters that don't1280 support it. {pr}`728`1281- Fix bug in test runner when calling `sys.exit` with `None`.1282 {pr}`739`1283- Clarify documentation on command line options. {issue}`741`,1284 {pr}`1003`1285- Fix crash on Windows console. {issue}`744`1286- Fix bug that caused bash completion to give improper completions on1287 chained commands. {issue}`754`, {pr}`774`1288- Added support for dynamic bash completion from a user-supplied1289 callback. {pr}`755`1290- Added support for bash completions containing spaces. {pr}`773`1291- Allow autocompletion function to determine whether or not to return1292 completions that start with the incomplete argument. {issue}`790`,1293 {pr}`806`1294- Fix option naming routine to match documentation and be1295 deterministic. {issue}`793`, {pr}`794`1296- Fix path validation bug. {issue}`795`, {pr}`1020`1297- Add test and documentation for `Option` naming: functionality.1298 {pr}`799`1299- Update doc to match arg name for `path_type`. {pr}`801`1300- Raw strings added so correct escaping occurs. {pr}`807`1301- Fix 16k character limit of `click.echo` on Windows. {issue}`816`,1302 {pr}`819`1303- Overcome 64k character limit when writing to binary stream on1304 Windows 7. {issue}`825`, {pr}`830`1305- Add bool conversion for "t" and "f". {pr}`842`1306- `NoSuchOption` errors take `ctx` so that `--help` hint gets1307 printed in error output. {pr}`860`1308- Fixed the behavior of Click error messages with regards to Unicode1309 on 2.x and 3.x. Message is now always Unicode and the str and1310 Unicode special methods work as you expect on that platform.1311 {issue}`862`1312- Progress bar now uses stderr by default. {pr}`863`1313- Add support for auto-completion documentation. {issue}`866`,1314 {pr}`869`1315- Allow `CliRunner` to separate stdout and stderr. {pr}`868`1316- Fix variable precedence. {issue}`873`, {pr}`874`1317- Fix invalid escape sequences. {pr}`877`1318- Fix `ResourceWarning` that occurs during some tests. {pr}`878`1319- When detecting a misconfigured locale, don't fail if the `locale`1320 command fails. {pr}`880`1321- Add `case_sensitive=False` as an option to `Choice` types.1322 {pr}`887`1323- Force stdout/stderr writable. This works around issues with badly1324 patched standard streams like those from Jupyter. {pr}`918`1325- Fix completion of subcommand options after last argument1326 {issue}`919`, {pr}`930`1327- `_AtomicFile` now uses the `realpath` of the original filename1328 so that changing the working directory does not affect it. {pr}`920`1329- Fix incorrect completions when defaults are present {issue}`925`,1330 {pr}`930`1331- Add copy option attrs so that custom classes can be reused.1332 {issue}`926`, {pr}`994`1333- "x" and "a" file modes now use stdout when file is `"-"`.1334 {pr}`929`1335- Fix missing comma in `__all__` list. {pr}`935`1336- Clarify how parameters are named. {issue}`949`, {pr}`1009`1337- Stdout is now automatically set to non blocking. {pr}`954`1338- Do not set options twice. {pr}`962`1339- Move `fcntl` import. {pr}`965`1340- Fix Google App Engine `ImportError`. {pr}`995`1341- Better handling of help text for dynamic default option values.1342 {pr}`996`1343- Fix `get_winter_size()` so it correctly returns `(0,0)`.1344 {pr}`997`1345- Add test case checking for custom param type. {pr}`1001`1346- Allow short width to address cmd formatting. {pr}`1002`1347- Add details about Python version support. {pr}`1004`1348- Added deprecation flag to commands. {pr}`1005`1349- Fixed issues where `fd` was undefined. {pr}`1007`1350- Fix formatting for short help. {pr}`1008`1351- Document how `auto_envvar_prefix` works with command groups.1352 {pr}`1011`1353- Don't add newlines by default for progress bars. {pr}`1013`1354- Use Python sorting order for ZSH completions. {issue}`1047`,1355 {pr}`1059`1356- Document that parameter names are converted to lowercase by default.1357 {pr}`1055`1358- Subcommands that are named by the function now automatically have1359 the underscore replaced with a dash. If you register a function1360 named `my_command` it becomes `my-command` in the command line1361 interface.1362- Hide hidden commands and options from completion. {issue}`1058`,1363 {pr}`1061`1364- Fix absolute import blocking Click from being vendored into a1365 project on Windows. {issue}`1068`, {pr}`1069`1366- Fix issue where a lowercase `auto_envvar_prefix` would not be1367 converted to uppercase. {pr}`1105`13681369## Version 6.713701371Released 2017-01-0613721373- Make `click.progressbar` work with `codecs.open` files.1374 {pr}`637`1375- Fix bug in bash completion with nested subcommands. {pr}`639`1376- Fix test runner not saving caller env correctly. {pr}`644`1377- Fix handling of SIGPIPE. {pr}`62`1378- Deal with broken Windows environments such as Google App Engine's.1379 {issue}`711`13801381## Version 6.613821383Released 2016-04-0413841385- Fix bug in `click.Path` where it would crash when passed a `-`.1386 {issue}`551`13871388## Version 6.413891390Released 2016-03-2413911392- Fix bug in bash completion where click would discard one or more1393 trailing arguments. {issue}`471`13941395## Version 6.313961397Released 2016-02-2213981399- Fix argument checks for interpreter invoke with `-m` and `-c` on1400 Windows.1401- Fixed a bug that cased locale detection to error out on Python 3.14021403## Version 6.214041405Released 2015-11-2714061407- Correct fix for hidden progress bars.14081409## Version 6.114101411Released 2015-11-2714121413- Resolved an issue with invisible progress bars no longer rendering.1414- Disable chain commands with subcommands as they were inherently1415 broken.1416- Fix `MissingParameter` not working without parameters passed.14171418## Version 6.014191420Released 2015-11-24, codename "pow pow"14211422- Optimized the progressbar rendering to not render when it did not1423 actually change.1424- Explicitly disallow `nargs=-1` with a set default.1425- The context is now closed before it's popped from the stack.1426- Added support for short aliases for the false flag on toggles.1427- Click will now attempt to aid you with debugging locale errors1428 better by listing with the help of the OS what locales are1429 available.1430- Click used to return byte strings on Python 2 in some unit-testing1431 situations. This has been fixed to correctly return unicode strings1432 now.1433- For Windows users on Python 2, Click will now handle Unicode more1434 correctly handle Unicode coming in from the system. This also has1435 the disappointing side effect that filenames will now be always1436 unicode by default in the `Path` type which means that this can1437 introduce small bugs for code not aware of this.1438- Added a `type` parameter to `Path` to force a specific string1439 type on the value.1440- For users running Python on Windows the `echo` and `prompt`1441 functions now work with full unicode functionality in the Python1442 windows console by emulating an output stream. This also applies to1443 getting the virtual output and input streams via1444 `click.get_text_stream(...)`.1445- Unittests now always force a certain virtual terminal width.1446- Added support for allowing dashes to indicate standard streams to1447 the `Path` type.1448- Multi commands in chain mode no longer propagate arguments left over1449 from parsing to the callbacks. It's also now disallowed through an1450 exception when optional arguments are attached to multi commands if1451 chain mode is enabled.1452- Relaxed restriction that disallowed chained commands to have other1453 chained commands as child commands.1454- Arguments with positive nargs can now have defaults implemented.1455 Previously this configuration would often result in slightly1456 unexpected values be returned.14571458## Version 5.114591460Released 2015-08-1714611462- Fix a bug in `pass_obj` that would accidentally pass the context1463 too.14641465## Version 5.014661467Released 2015-08-16, codename "tok tok"14681469- Removed various deprecated functionality.1470- Atomic files now only accept the `w` mode.1471- Change the usage part of help output for very long commands to wrap1472 their arguments onto the next line, indented by 4 spaces.1473- Fix a bug where return code and error messages were incorrect when1474 using `CliRunner`.1475- Added `get_current_context`.1476- Added a `meta` dictionary to the context which is shared across1477 the linked list of contexts to allow click utilities to place state1478 there.1479- Introduced `Context.scope`.1480- The `echo` function is now threadsafe: It calls the `write`1481 method of the underlying object only once.1482- `prompt(hide_input=True)` now prints a newline on `^C`.1483- Click will now warn if users are using `unicode_literals`.1484- Click will now ignore the `PAGER` environment variable if it is1485 empty or contains only whitespace.1486- The `click-contrib` GitHub organization was created.14871488## Version 4.114891490Released 2015-07-1414911492- Fix a bug where error messages would include a trailing `None`1493 string.1494- Fix a bug where Click would crash on docstrings with trailing1495 newlines.1496- Support streams with encoding set to `None` on Python 3 by barfing1497 with a better error.1498- Handle ^C in less-pager properly.1499- Handle return value of `None` from `sys.getfilesystemencoding`1500- Fix crash when writing to unicode files with `click.echo`.1501- Fix type inference with multiple options.15021503## Version 4.015041505Released 2015-03-31, codename "zoom zoom"15061507- Added `color` parameters to lots of interfaces that directly or1508 indirectly call into echoing. This previously was always1509 autodetection (with the exception of the `echo_via_pager`1510 function). Now you can forcefully enable or disable it, overriding1511 the auto detection of Click.1512- Added an `UNPROCESSED` type which does not perform any type1513 changes which simplifies text handling on 2.x / 3.x in some special1514 advanced usecases.1515- Added `NoSuchOption` and `BadOptionUsage` exceptions for more1516 generic handling of errors.1517- Added support for handling of unprocessed options which can be1518 useful in situations where arguments are forwarded to underlying1519 tools.1520- Added `max_content_width` parameter to the context which can be1521 used to change the maximum width of help output. By default Click1522 will not format content for more than 80 characters width.1523- Added support for writing prompts to stderr.1524- Fix a bug when showing the default for multiple arguments.1525- Added support for custom subclasses to `option` and `argument`.1526- Fix bug in `clear()` on Windows when colorama is installed.1527- Reject `nargs=-1` for options properly. Options cannot be1528 variadic.1529- Fixed an issue with bash completion not working properly for1530 commands with non ASCII characters or dashes.1531- Added a way to manually update the progressbar.1532- Changed the formatting of missing arguments. Previously the internal1533 argument name was shown in error messages, now the metavar is shown1534 if passed. In case an automated metavar is selected, it's stripped1535 of extra formatting first.15361537## Version 3.315381539Released 2014-09-0815401541- Fixed an issue with error reporting on Python 3 for invalid1542 forwarding of commands.15431544## Version 3.215451546Released 2014-08-2215471548- Added missing `err` parameter forwarding to the `secho`1549 function.1550- Fixed default parameters not being handled properly by the context1551 invoke method. This is a backwards incompatible change if the1552 function was used improperly.1553- Removed the `invoked_subcommands` attribute largely. It is not1554 possible to provide it to work error free due to how the parsing1555 works so this API has been deprecated.1556- Restored the functionality of `invoked_subcommand` which was1557 broken as a regression in 3.1.15581559## Version 3.115601561Released 2014-08-1315621563- Fixed a regression that caused contexts of subcommands to be created1564 before the parent command was invoked which was a regression from1565 earlier Click versions.15661567## Version 3.015681569Released 2014-08-12, codename "clonk clonk"15701571- Formatter now no longer attempts to accommodate for terminals1572 smaller than 50 characters. If that happens it just assumes a1573 minimal width.1574- Added a way to not swallow exceptions in the test system.1575- Added better support for colors with pagers and ways to override the1576 autodetection.1577- The CLI runner's result object now has a traceback attached.1578- Improved automatic short help detection to work better with dots1579 that do not terminate sentences.1580- When defining options without actual valid option strings now,1581 Click will give an error message instead of silently passing. This1582 should catch situations where users wanted to created arguments1583 instead of options.1584- Restructured Click internally to support vendoring.1585- Added support for multi command chaining.1586- Added support for defaults on options with `multiple` and options1587 and arguments with `nargs != 1`.1588- Label passed to `progressbar` is no longer rendered with1589 whitespace stripped.1590- Added a way to disable the standalone mode of the `main` method on1591 a Click command to be able to handle errors better.1592- Added support for returning values from command callbacks.1593- Added simplifications for printing to stderr from `echo`.1594- Added result callbacks for groups.1595- Entering a context multiple times defers the cleanup until the last1596 exit occurs.1597- Added `open_file`.15981599## Version 2.616001601Released 2014-08-1116021603- Fixed an issue where the wrapped streams on Python 3 would be1604 reporting incorrect values for seekable.16051606## Version 2.516071608Released 2014-07-2816091610- Fixed a bug with text wrapping on Python 3.16111612## Version 2.416131614Released 2014-07-0416151616- Corrected a bug in the change of the help option in 2.3.16171618## Version 2.316191620Released 2014-07-0316211622- Fixed an incorrectly formatted help record for count options.1623- Add support for ansi code stripping on Windows if colorama is not1624 available.1625- Restored the Click 1.0 handling of the help parameter for certain1626 edge cases.16271628## Version 2.216291630Released 2014-06-2616311632- Fixed tty detection on PyPy.1633- Fixed an issue that progress bars were not rendered when the context1634 manager was entered.16351636## Version 2.116371638Released 2014-06-1416391640- Fixed the {func}`launch` function on windows.1641- Improved the colorama support on windows to try hard to not screw up1642 the console if the application is interrupted.1643- Fixed windows terminals incorrectly being reported to be 801644 characters wide instead of 791645- Use colorama win32 bindings if available to get the correct1646 dimensions of a windows terminal.1647- Fixed an issue with custom function types on Python 3.1648- Fixed an issue with unknown options being incorrectly reported in1649 error messages.16501651## Version 2.016521653Released 2014-06-06, codename "tap tap tap"16541655- Added support for opening stdin/stdout on Windows in binary mode1656 correctly.1657- Added support for atomic writes to files by going through a1658 temporary file.1659- Introduced {exc}`BadParameter` which can be used to easily perform1660 custom validation with the same error messages as in the type1661 system.1662- Added {func}`progressbar`; a function to show progress bars.1663- Added {func}`get_app_dir`; a function to calculate the home folder1664 for configs.1665- Added transparent handling for ANSI codes into the {func}`echo`1666 function through `colorama`.1667- Added {func}`clear` function.1668- Breaking change: parameter callbacks now get the parameter object1669 passed as second argument. There is legacy support for old callbacks1670 which will warn but still execute the script.1671- Added {func}`style`, {func}`unstyle` and {func}`secho` for ANSI1672 styles.1673- Added an {func}`edit` function that invokes the default editor.1674- Added an {func}`launch` function that launches browsers and1675 applications.1676- Nargs of -1 for arguments can now be forced to be a single item1677 through the required flag. It defaults to not required.1678- Setting a default for arguments now implicitly makes it non1679 required.1680- Changed "yN" / "Yn" to "y/N" and "Y/n" in confirmation prompts.1681- Added basic support for bash completion.1682- Added {func}`getchar` to fetch a single character from the terminal.1683- Errors now go to stderr as intended.1684- Fixed various issues with more exotic parameter formats like1685 DOS/Windows style arguments.1686- Added {func}`pause` which works similar to the Windows `pause` cmd1687 built-in but becomes an automatic noop if the application is not run1688 through a terminal.1689- Added a bit of extra information about missing choice parameters.1690- Changed how the help function is implemented to allow global1691 overriding of the help option.1692- Added support for token normalization to implement case insensitive1693 handling.1694- Added support for providing defaults for context settings.16951696## Version 1.116971698Released 2014-05-2316991700- Fixed a bug that caused text files in Python 2 to not accept native1701 strings.17021703## Version 1.017041705Released 2014-05-2117061707- Initial release.