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

force_decode is no longer available in Sphinx 4.0.0 #46

Closed
Zlopez opened this issue May 10, 2021 · 9 comments
Closed

force_decode is no longer available in Sphinx 4.0.0 #46

Zlopez opened this issue May 10, 2021 · 9 comments

Comments

@Zlopez
Copy link

Zlopez commented May 10, 2021

Hi,

today I tried to update to sphinx 4.0.0 and the build of doc failed on:

Extension error:
Could not import extension sphinxcontrib.autohttp.flask (exception: cannot import name 'force_decode' from 'sphinx.util' (/var/home/zlopez/git/anitya/.tox/docs/lib/python3.9/site-packages/sphinx/util/__init__.py))

It seems that force_decode is deprecated from Sphinx 2.0 and it is removed completely in 4.0. See https://www.sphinx-doc.org/en/master/extdev/deprecated.html

@stevepiercy
Copy link

The same issue appears in repoze/repoze.sphinx.autointerface#16. I started a PR repoze/repoze.sphinx.autointerface#17, but haven't had time to fix the remaining issues.

I could definitely use advice on how to replace sphinx.ext.autodoc.AutoDirective with application.Sphinx.add_autodocumenter() and for addressing an issue with sphinx.theming.Theme.themes.

@kasium
Copy link

kasium commented Jun 9, 2021

Hi guys,
I also stumbled across this issue. Maybe it's worth to ask the sphinx developers how to fix the open issues?

@Zlopez
Copy link
Author

Zlopez commented Jul 9, 2021

The change is now reverted in 4.0.3 of sphinx. The force_decode() works again. See changelog for 4.0.3

@Zlopez Zlopez closed this as completed Jul 9, 2021
@kloczek
Copy link

kloczek commented Jul 9, 2021

OK.
Thx :)

@kloczek
Copy link

kloczek commented Jul 9, 2021

Just tested that. With 4.0.3

+ /usr/bin/python3 setup.py build_sphinx -b man --build-dir build/sphinx
running build_sphinx
Running Sphinx v4.0.3
making output directory... done
building [mo]: targets for 0 po files that are out of date
building [man]: all manpages
updating environment: [new config] 2 added, 0 changed, 0 removed
reading sources... [100%] index
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
writing... python-sphinxcontrib-httpdomain.3 { } done
build succeeded.

One more time thank you to let me know :)

@stevepiercy
Copy link

I would suggest that you reopen this issue. force_decode() will become a problem when Sphinx 5.0 is released because its usage is still deprecated. The change note is a little misleading because the contributor used the term "during" instead of "until". See: sphinx-doc/sphinx#9326 (comment)

This reverts the removal and extends its deprecation period to 5.0.0. I hope it helps users of these extensions.

@kasium
Copy link

kasium commented Jul 9, 2021

I'm also happy to support here, but yes, this will become an issue again in Sphinx 5

@mcepl
Copy link

mcepl commented Jul 9, 2021

I happily accept that this patch is not the greatest achievement of the computer science, but it seems to do the job, and it allows me to build httpdomain package for openSUSE with different versions of Sphinx.

Of course, the proper solution is to follow the idea of sphinx-doc/sphinx#5620 (comment) and fix the use of str/bytes so that it is not required anyrmore.

bmwiedemann pushed a commit to bmwiedemann/openSUSE that referenced this issue Jul 10, 2021
…SR 905350

https://build.opensuse.org/request/show/905350
by user mcepl + dimstar_suse
- Add missing_force_decode.patch with shim for missing
  force_decode method (gh#sphinx-contrib/httpdomain#46).
@danc86
Copy link
Contributor

danc86 commented Jul 19, 2021

PR #49 seems to be a reasonable solution to this (just remove all usages of force_decode because they should not be needed).

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

No branches or pull requests

6 participants