Skip to content

Commit

Permalink
Merge pull request #1221 from jjmaestro/patch-1
Browse files Browse the repository at this point in the history
Explicit explanation of the breaking change in 7.0
  • Loading branch information
davidism authored Feb 22, 2020
2 parents 98a55ab + 06b8263 commit 70c4493
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions docs/upgrading.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,37 @@ this is not entirely possible. In case we need to break backwards
compatibility this document gives you information about how to upgrade or
handle backwards compatibility properly.

.. _upgrade-to-7.0:

Upgrading to 7.0
----------------

Commands that take their name from the decorated function now replace
underscores with dashes. For example, the Python function ``run_server``
will get the command name ``run-server`` now. There are a few options
to address this:

- To continue with the new behavior, pin your dependency to
``Click>=7`` and update any documentation to use dashes.
- To keep existing behavior, add an explicit command name with
underscores, like ``@click.command("run_server")``.
- To try a name with dashes if the name with underscores was not
found, pass a ``token_normalize_func`` to the context:

.. code-block:: python
def normalize(name):
return name.replace("_", "-")
@click.group(context_settings={"token_normalize_func": normalize})
def group():
...
@group.command()
def run_server():
...
.. _upgrade-to-3.2:

Upgrading to 3.2
Expand Down

0 comments on commit 70c4493

Please sign in to comment.