Change8

8.3.0

Breaking Changes
📦 clickView on GitHub →
1 breaking4 features🐛 5 fixes🔧 4 symbols

Summary

Click 8.3.0 introduces improved flag handling, new defaults support for variable‑length arguments, and several bug fixes, with a potential breaking change in how ``default`` values are passed to callbacks.

⚠️ Breaking Changes

  • Reworked relationship between ``flag_value`` and ``default`` in ``click.Option``: ``default`` is now passed unchanged to callbacks, which may break code that relied on the previous automatic transformation. Adjust code to handle the raw ``default`` value or keep ``default=True`` for backward compatibility.

Migration Steps

  1. Review any ``click.Option`` definitions that relied on the previous transformation of ``default`` values and update the code to work with the raw ``default`` value.
  2. If you need the old behavior for a flag option, keep ``default=True`` or explicitly handle the ``flag_value`` in your callback.
  3. Run your test suite, especially tests that invoke CLI commands with flag options, to ensure expected behavior.

✨ New Features

  • Improved flag option handling with consistent ``default`` and ``flag_value`` behavior.
  • Added support for setting ``default`` on ``click.Argument`` when ``nargs=-1``.
  • Auto‑completion now shows correct values when ``nargs`` options are combined with flag options.
  • Lazily import ``shutil`` to reduce import overhead.

🐛 Bug Fixes

  • Fixed inconsistencies in flag option handling reported in #1992, #2514, #2610, #3024, #3030.
  • Corrected auto‑complete value display for ``nargs`` options combined with flag options (#2813).
  • Fixed handling of quoted and escaped parameters in Fish shell autocompletion (#2995, #3013).
  • Properly forward exception information to resources registered via ``click.core.Context.with_resource()`` (#2447, #3058).
  • Fixed regression in EOF handling for ``click.testing.CliRunner`` (#2939, #2940).

🔧 Affected Symbols

click.Optionclick.Argumentclick.core.Context.with_resourceclick.testing.CliRunner