Skip to content
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

ValueError: too many values to unpack #7409

Closed
sedimentation-fault opened this issue Apr 3, 2020 · 6 comments
Closed

ValueError: too many values to unpack #7409

sedimentation-fault opened this issue Apr 3, 2020 · 6 comments

Comments

@sedimentation-fault
Copy link

Description
While building the references of Sage 9.0, I got:

# Sphinx version: 2.0.1
# Python version: 3.7.6 (CPython)
# Docutils version: 0.15.2 release
# Jinja2 version: 2.11.1
# Last messages:

# Loaded extensions:
Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/sphinx/cmd/build.py", line 283, in build_main
    args.tags, args.verbosity, args.jobs, args.keep_going)
  File "/usr/lib/python3.7/site-packages/sphinx/application.py", line 260, in __init__
    self._init_builder()
  File "/usr/lib/python3.7/site-packages/sphinx/application.py", line 321, in _init_builder
    self.emit('builder-inited')
  File "/usr/lib/python3.7/site-packages/sphinx/application.py", line 440, in emit
    return self.events.emit(event, self, *args)
  File "/usr/lib/python3.7/site-packages/sphinx/events.py", line 76, in emit
    results.append(callback(*args))
  File "/usr/lib/python3.7/site-packages/sphinx/ext/intersphinx.py", line 207, in load_mappings
    for key, (name, (uri, invs)) in app.config.intersphinx_mapping.items():
ValueError: too many values to unpack (expected 2)

How To Reproduce
Steps to reproduce the behavior:
I have written a detailed account in:
cschwan/sage-on-gentoo#580

Expected behavior
No error should occur.

Your project
Sage 9.0 on Gentoo. Using the sage-9.0-r1 ebuild from the sage-on-gentoo overlay: https://github.com/cschwan/sage-on-gentoo

Environment info
See error text above.

Reason
The error occurs in

/usr/lib/python3.7/site-packages/sphinx/ext/intersphinx.py", line 207

According to #3075, it is due to a change that took place in sphinx 1.4:

This is incompatible change since 1.4 (see #2320).
After the change, the entries was changed to a list of entryname, (links, subitems, key).

Could it be that this change didn't reach line 207 of intersphinx.py yet?

@tk0miya
Copy link
Member

tk0miya commented Apr 4, 2020

Please let me know your intersphinx_mapping settings. What value did you set?

@sedimentation-fault
Copy link
Author

Oops...good question - I must confess, I have no idea! Now I feel like a newbie! 🐤 :-)

Let's see: I am trying to compile sage-9.0 and I am stuck at its documentation, which, with sphinx-2.0.1 (and only that! all other versions, from 1.7.5 to 1.8.5 and 2.4.4 break earlier with other errors) breaks at the second pass of the references - you can see the error at the link I posted.

About the intersphinx_mapping...using ripgrep I found it at

sage-9.0/src/sage/docs/conf.py


# Cross-links to other project's online documentation.
python_version = sys.version_info.major
intersphinx_mapping = {
    'python': ('https://docs.python.org/',
                os.path.join(SAGE_DOC_SRC, "common",
                             "python{}.inv".format(python_version))),
    'pplpy': (PPLPY_DOCS, None)}

def set_intersphinx_mappings(app):
    """
    Add precompiled inventory (the objects.inv)
    """
    refpath = os.path.join(SAGE_DOC, "html", "en", "reference")
    invpath = os.path.join(SAGE_DOC, "inventory", "en", "reference")
    if app.config.multidoc_first_pass == 1 or \
            not (os.path.exists(refpath) and os.path.exists(invpath)):
        app.config.intersphinx_mapping = {}
        return

    app.config.intersphinx_mapping = intersphinx_mapping

    # Add master intersphinx mapping
    dst = os.path.join(invpath, 'objects.inv')
    app.config.intersphinx_mapping['sagemath'] = (refpath, dst)

Now, before you continue please have a look at

https://trac.sagemath.org/ticket/28856

where some important details might be lurking. For example, it is said there that "our intersphinx usage differs from normal usage" - but I have no idea in which respect...

@tk0miya
Copy link
Member

tk0miya commented Apr 5, 2020

Thank you for the info. It seems sagemath docs try to configure via Sphinx events. And it does not work since 2.x because we've refactored the intersphinx. Sorry for inconvenience. But I don't know such hack...
Please let them know to use config-inited event instead of builder-inited event. And I'll work to allow customizing intersphinx_mapping on the event on 3.0.

@tk0miya tk0miya added this to the 3.0.0 milestone Apr 5, 2020
tk0miya added a commit to tk0miya/sphinx that referenced this issue Apr 5, 2020
…ed event

This changes a priority for config-inited handlers of core modules
to invoke them at the late of the event.  It allows extensions to
modify configurations.
tk0miya added a commit to tk0miya/sphinx that referenced this issue Apr 5, 2020
…ed event

This changes a priority for config-inited handlers of core modules
to invoke them at the late of the event.  It allows extensions to
modify configurations.
tk0miya added a commit to tk0miya/sphinx that referenced this issue Apr 5, 2020
…ed event

This changes a priority for config-inited handlers of core modules
to invoke them at the late of the event.  It allows extensions to
modify configurations.
tk0miya added a commit to tk0miya/sphinx that referenced this issue Apr 5, 2020
…ed event

This changes a priority for config-inited handlers of core modules
to invoke them at the late of the event.  It allows extensions to
modify configurations.
tk0miya added a commit that referenced this issue Apr 5, 2020
…_handlers

Fix #7409: Convert configuration values on late config-inited event
@tk0miya
Copy link
Member

tk0miya commented Apr 5, 2020

I just merged #7415. It allows extensions to modify configurations via config-inited event. In this case, sagemath should be fixed to use the event and new Sphinx.

@tk0miya tk0miya closed this as completed Apr 5, 2020
@sedimentation-fault
Copy link
Author

Thank you very much! I will forward this information to the sage-on-gentoo project.

@timokau
Copy link

timokau commented Apr 7, 2020

Thanks a lot for going the extra mile and fixing our hacks for us. That is far beyond any responsibility I would have assigned to an upstream project :)

As I said in the trac ticket, I don't really know why we aren't using intersphinx as its supposed to be used. But at least now we'll be able to fix our build with an up-to-date sphinx.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 26, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants