1+Upgrading To Newer Releases2+===========================3+4+Click attempts the highest level of backwards compatibility but sometimes5+this is not entirely possible. In case we need to break backwards6+compatibility this document gives you information about how to upgrade or7+handle backwards compatibility properly.8+9+Upgrading to 2.010+----------------11+12+Click 2.0 has one breaking change which is the signature for parameter13+callbacks. Before 2.0 the callback was invoked with ``(ctx, value)``14+wheras now it's ``(ctx, param, value)``. This change was necessary as it15+otherwise made reusing callbacks too complicated.16+17+To ease the transition Click will still accept old callbacks but it will18+issue a warning to stderr to encourage you to upgrade.19+20+In case you want to support both Click 1.0 and Click 2.0 you can make a21+simple decorator that adjusts the signatures::22+23+ import click24+ from functools import update_wrapper25+26+ def compatcallback(f):27+ # Click 1.0 does not have a version string stored, so we need to28+ # use getattr here to be safe.29+ if getattr(click, '__version__', '0.0') >= '2.0':30+ return f31+ return update_wrapper(lambda ctx, value: f(ctx, None, value), f)32+33+With that helper you can then write something like this::34+35+ @compatcallback36+ def callback(ctx, param, value):37+ return value.upper()38+39+Note that because Click 1.0 did not pass a parameter the `param` argument40+here would be `None` so a compatibility callback could not use that41+argument.