Skip to content

Cannot generate documentation using asyncclick #144

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
jmartel-olvid opened this issue Sep 19, 2024 · 2 comments · May be fixed by #151
Open

Cannot generate documentation using asyncclick #144

jmartel-olvid opened this issue Sep 19, 2024 · 2 comments · May be fixed by #151

Comments

@jmartel-olvid
Copy link

jmartel-olvid commented Sep 19, 2024

Hi,

I am trying to use sphinx-click with an asyncclick CLI.

I had issues when I used the last version (6.0.0) because it told me click module was not found.

So I fixed it by removing import click.core line in ext.py file.

This line have been added in commit 05b69cf. I am not sure why because without it it works i my configuration, I tried with version 5.1.0 and it's fine.

Thanks for your time

Here are my versions to reproduce the issue:
Python 3.12.3
asyncclick==8.1.7.2
sphinx-click==6.0.0

@NickCao
Copy link

NickCao commented Feb 6, 2025

Try the following patch

--- a/sphinx_click/ext.py
+++ b/sphinx_click/ext.py
@@ -5,11 +5,11 @@ import traceback
 import typing as ty
 import warnings

+import click.core
 try:
     import asyncclick as click
 except ImportError:
     import click
-import click.core
 from docutils import nodes
 from docutils.parsers import rst
 from docutils.parsers.rst import directives

@jloehel
Copy link

jloehel commented Apr 10, 2025

I have the same issue. Why not support both? Like that:

  467         if not isinstance(
  468             parser, (asyncclick.Command, asyncclick.Group, click.Command, click.Group)                                                                         
  469         ):
  470             raise self.error(
  471                 '"{}" of type "{}" is not click.Command or click.Group.'
  472                 '"click.BaseCommand"'.format(type(parser), module_path)
  473             )
  474         return parser

Of course, it's necessary to adjust the other calls of isinstance, too. As a quick-fix it worked really well for me.

@jloehel jloehel linked a pull request Apr 10, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants