mkdocs-click icon indicating copy to clipboard operation
mkdocs-click copied to clipboard

Fail to Build with `asyncclick`

Open jayceslesar opened this issue 11 months ago • 2 comments

Unable to use this with https://github.com/python-trio/asyncclick, which should be a pretty much drop in replacement.

The error I receive is

mkdocs_click._exceptions.MkDocsClickException: 'cli' must be a 'click.BaseCommand' object, got <class 'asyncclick.core.Group'>

Happy to hack on this if its something useful

jayceslesar avatar Jan 22 '25 19:01 jayceslesar

yeah literally just commenting out https://github.com/mkdocs/mkdocs-click/blob/master/mkdocs_click/_loader.py#L20 seems to work fine so might be worth just adding the async click as an optional mkdocs dependency here and dealing with it that way....IE attempt to import and if it is not None, then add it to the check if not isinstance(command, [click.BaseCommand, asyncclick.core.Group]) otherwise the iterable will just be if not isinstance(command, [click.BaseCommand] )

jayceslesar avatar Jan 22 '25 19:01 jayceslesar

A PR would be greatly appreciated! However, my preference would be adding a new command-class option that defaults to click.BaseCommand. The benefit of this approach is that any package becomes compatible.

ofek avatar Jan 22 '25 19:01 ofek