Click and pylint

There is a way to avoid those errors from happening, by not using the decoration syntax. This might be what @Azsgy referred to as 'weird' :-)

@click.option(
    "--direction",
    default="upgrade",
    type=click.Choice(["upgrade", "downgrade"]),
    help="Direction of migration upgrade/downgrade",
)
@click.argument("revision", default="heads")
def _main(direction, revision):
    """Runs migrations on each of the databases."""
    pass


main = click.command()(_main)


if __name__ == "__main__":
    main()

Whether it's nice or not is debatable :-)


The @click.command decorator edits your functions parameters, but pylint does not know this, since it does not actually run your code.

I don't think it makes sense to make your code weird just so pylint is happy. Instead, ignore it, or add a comment to disable that warning in the current scope:

# pylint: disable=no-value-for-parameter