Giter VIP home page Giter VIP logo

Comments (4)

regisb avatar regisb commented on May 28, 2024

I am also observing this issue. In my project, when I attempt to generate docs, I get:

make build BUILD_ARGS="-W"
make[1]: Entering directory '/home/regis/projets/overhang/repos/overhang/tutor/docs'
sphinx-build -b html -a -E -n -W "." "_build/html"
Running Sphinx v4.2.0
building [mo]: all of 0 po files
building [html]: all source files
updating environment: [new config] 42 added, 0 changed, 0 removed
reading sources... [ 57%] reference/cli/tutor                                                                                                                                                                      
Exception occurred:
  File "/home/regis/projets/overhang/repos/overhang/tutor/tutor/commands/cli.py", line 49, in get_commands
    actions.do_action_once("root:load", ctx.params["root"])
TypeError: list indices must be integers or slices, not str
The full traceback has been saved in /tmp/sphinx-err-ien2tje3.log, if you want to report the issue to the developers.
Please also report this if it was a user error, so that a better error message can be provided next time.
A bug report can be filed in the tracker at <https://github.com/sphinx-doc/sphinx/issues>. Thanks!
make[1]: *** [Makefile:5: build] Error 2
make[1]: Leaving directory '/home/regis/projets/overhang/repos/overhang/tutor/docs'
make: *** [Makefile:8: html] Error 2

It is occurring as I am trying to implement a custom MultiCommand class to load subcommands from plugins, very much as described in the click docs: https://click.palletsprojects.com/en/latest/commands/#custom-multi-commands

You can see my custom implementation here: https://github.com/overhangio/tutor/pull/599/files#diff-135f3cab863e666db1ab4b3c1a36f125f11501065e0cae258d73d706b5dfae56R30

The context argument (which is here a MultiCommand) that is passed to list_command and get_command is not used by the base Group implementation. Thus, the bug does not occur in most cases.

The fix should be relatively straightforward and I can open a PR. Would you be interested? Is a unit test necessary?

from sphinx-click.

stephenfin avatar stephenfin commented on May 28, 2024

I'd definitely be interested. Tests would be appreciated since they prove things are working as expected. Ideally there would be two commits: one to add (failing) unit test(s) and one to fix the bug and the test. Just try your best and let me know if you really can't figure it out.

from sphinx-click.

stephenfin avatar stephenfin commented on May 28, 2024

Fixing this would likely unblock #83 also.

from sphinx-click.

regisb avatar regisb commented on May 28, 2024

Unfortunately the proposed fix does not 100% resolve this issue. The context must also be passed to get_command, as suggested above. I opened #101 to resolve this.

from sphinx-click.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.