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

error on http link containing a dash with sphinx book/pydata theme #12437

Closed
NicNomadic opened this issue Jun 18, 2024 · 4 comments
Closed

error on http link containing a dash with sphinx book/pydata theme #12437

NicNomadic opened this issue Jun 18, 2024 · 4 comments
Labels

Comments

@NicNomadic
Copy link

Describe the bug

When building an RST page with the sphinx_book_theme containing a web link which includes a dash, Sphinx stops with "ValueError: not enough values to unpack".

How to Reproduce

$ cat >index.rst <<EOF
Welcome to the Documentation!

Report issues to https://gitlab.com/tezos/tezos/-/issues
EOF

$ cat >conf.py <<EOF
source_suffix = '.rst'
master_doc = 'index'
html_theme = "sphinx_book_theme"
EOF

$ poetry run sphinx-build -b html "." "build"
Running Sphinx v7.3.7
building [mo]: targets for 0 po files that are out of date
writing output...
building [html]: targets for 1 source files that are out of date
updating environment: [new config] 1 added, 0 changed, 0 removed
reading sources... [100%] index
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
copying assets... copying static files... done
copying extra files... done
done
writing output... [100%] index
Exception occurred:
File "/Users/nic/Library/Caches/pypoetry/virtualenvs/tezos-LY8-gUlI-py3.11/lib/python3.11/site-packages/pydata_sphinx_theme/short_link.py", line 103, in parse_url
url_type, element_number, *
= parts
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: not enough values to unpack (expected at least 2, got 1)
The full traceback has been saved in /var/folders/9y/r3w7mc6j3j79sp8qyp92rd_r0000gn/T/sphinx-err-deyk9e2j.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!

Environment Information

Platform:              darwin; (macOS-10.16-x86_64-i386-64bit)
Python version:        3.11.6 (main, Nov 22 2023, 10:02:40) [Clang 12.0.0 (clang-1200.0.32.21)])
Python implementation: CPython
Sphinx version:        7.2.6
Docutils version:      0.20.1
Jinja2 version:        3.1.2
Pygments version:      2.17.2

Sphinx extensions

sphinx = "7.3.7"
sphinx-book-theme = "1.1.3"
types-pygments = "2.14.0.1"
types-docutils = "0.19.1.2"

Additional context

$ poetry --version
Poetry (version 1.2.2)

@NicNomadic
Copy link
Author

I forgot to paste the complete system log:
$ cat /var/folders/9y/r3w7mc6j3j79sp8qyp92rd_r0000gn/T/sphinx-err-deyk9e2j.log

Platform: darwin; (macOS-10.16-x86_64-i386-64bit)

Sphinx version: 7.3.7

Python version: 3.11.6 (CPython)

Docutils version: 0.21.2

Jinja2 version: 3.1.4

Pygments version: 2.18.0

Last messages:

copying assets...

copying static files...

done

copying extra files...

done

done

writing output... [100%]

index

Loaded extensions:

sphinx.ext.mathjax (7.3.7)

alabaster (0.7.16)

sphinxcontrib.applehelp (1.0.8)

sphinxcontrib.devhelp (1.0.6)

sphinxcontrib.htmlhelp (2.0.5)

sphinxcontrib.serializinghtml (1.1.10)

sphinxcontrib.qthelp (1.0.7)

sphinx_book_theme (unknown version)

pydata_sphinx_theme (unknown version)

Traceback:

Traceback (most recent call last):
File "/Users/nic/Library/Caches/pypoetry/virtualenvs/tezos-LY8-gUlI-py3.11/lib/python3.11/site-packages/sphinx/cmd/build.py", line 337, in build_main
app.build(args.force_all, args.filenames)
File "/Users/nic/Library/Caches/pypoetry/virtualenvs/tezos-LY8-gUlI-py3.11/lib/python3.11/site-packages/sphinx/application.py", line 351, in build
self.builder.build_update()
File "/Users/nic/Library/Caches/pypoetry/virtualenvs/tezos-LY8-gUlI-py3.11/lib/python3.11/site-packages/sphinx/builders/init.py", line 293, in build_update
self.build(to_build,
File "/Users/nic/Library/Caches/pypoetry/virtualenvs/tezos-LY8-gUlI-py3.11/lib/python3.11/site-packages/sphinx/builders/init.py", line 362, in build
self.write(docnames, list(updated_docnames), method)
File "/Users/nic/Library/Caches/pypoetry/virtualenvs/tezos-LY8-gUlI-py3.11/lib/python3.11/site-packages/sphinx/builders/init.py", line 570, in write
self._write_serial(sorted(docnames))
File "/Users/nic/Library/Caches/pypoetry/virtualenvs/tezos-LY8-gUlI-py3.11/lib/python3.11/site-packages/sphinx/builders/init.py", line 577, in write_serial
doctree = self.env.get_and_resolve_doctree(docname, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/nic/Library/Caches/pypoetry/virtualenvs/tezos-LY8-gUlI-py3.11/lib/python3.11/site-packages/sphinx/environment/init.py", line 638, in get_and_resolve_doctree
self.apply_post_transforms(doctree, docname)
File "/Users/nic/Library/Caches/pypoetry/virtualenvs/tezos-LY8-gUlI-py3.11/lib/python3.11/site-packages/sphinx/environment/init.py", line 691, in apply_post_transforms
transformer.apply_transforms()
File "/Users/nic/Library/Caches/pypoetry/virtualenvs/tezos-LY8-gUlI-py3.11/lib/python3.11/site-packages/sphinx/transforms/init.py", line 84, in apply_transforms
super().apply_transforms() # type: ignore[misc]
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/nic/Library/Caches/pypoetry/virtualenvs/tezos-LY8-gUlI-py3.11/lib/python3.11/site-packages/docutils/transforms/init.py", line 182, in apply_transforms
transform.apply(**kwargs)
File "/Users/nic/Library/Caches/pypoetry/virtualenvs/tezos-LY8-gUlI-py3.11/lib/python3.11/site-packages/sphinx/transforms/post_transforms/init.py", line 44, in apply
self.run(**kwargs)
File "/Users/nic/Library/Caches/pypoetry/virtualenvs/tezos-LY8-gUlI-py3.11/lib/python3.11/site-packages/pydata_sphinx_theme/short_link.py", line 54, in run
node.children[0] = nodes.Text(self.parse_url(uri))
^^^^^^^^^^^^^^^^^^^
File "/Users/nic/Library/Caches/pypoetry/virtualenvs/tezos-LY8-gUlI-py3.11/lib/python3.11/site-packages/pydata_sphinx_theme/short_link.py", line 103, in parse_url
url_type, element_number, *
= parts
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: not enough values to unpack (expected at least 2, got 1)

@NicNomadic
Copy link
Author

FYI, I could reproduce the issue without the sphinx-book-theme, but using only the underlying pydata_sphinx_theme (I just replaced html_theme = "pydata_sphinx_theme" in conf.py).

It seems more like a pydata issue than a Sphinx issue, so I also filed pydata/pydata-sphinx-theme#1887. Is this the right decision?

@Carreau
Copy link
Contributor

Carreau commented Jun 18, 2024

It's an bug in PST working on a fix: pydata/pydata-sphinx-theme#1888 I think you can close here to have less noise for sphinx maintainers.

@NicNomadic
Copy link
Author

Thanks alot for the quick reaction, so I close this here.

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

No branches or pull requests

2 participants