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

Incompatible with Sphinx >= 2.0 #77

Open
bdusell opened this issue Dec 3, 2019 · 6 comments
Open

Incompatible with Sphinx >= 2.0 #77

bdusell opened this issue Dec 3, 2019 · 6 comments

Comments

@bdusell
Copy link

bdusell commented Dec 3, 2019

When running Sphinx 2.2.1, sphinx-versioning fails with

$ poetry run sphinx-versioning build docs docs/_build/html
Traceback (most recent call last):
  File "/app/.venv/bin/sphinx-versioning", line 7, in <module>
    from sphinxcontrib.versioning.__main__ import cli
  File "/app/.venv/lib/python3.7/site-packages/sphinxcontrib/versioning/__main__.py", line 13, in <module>
    from sphinxcontrib.versioning.routines import build_all, gather_git_info, pre_build, read_local_conf
  File "/app/.venv/lib/python3.7/site-packages/sphinxcontrib/versioning/routines.py", line 11, in <module>
    from sphinxcontrib.versioning.sphinx_ import build, read_config
  File "/app/.venv/lib/python3.7/site-packages/sphinxcontrib/versioning/sphinx_.py", line 9, in <module>
    from sphinx import application, build_main, locale
ImportError: cannot import name 'build_main' from 'sphinx' (/app/.venv/lib/python3.7/site-packages/sphinx/__init__.py)

It looks like build_main was deprecated in 2.0: https://www.sphinx-doc.org/en/master/extdev/deprecated.html

The alternative listed is to use sphinx.cmd.build.build_main().

I cannot downgrade due to another Sphinx plugin.

@z00sts
Copy link

z00sts commented Dec 9, 2019

workaround is here #78

@swalsberger
Copy link

@z00sts sorry I dont understand the workarround

for me it was ok, working with
sphinx 1.7.7
sphinxcontrib-versioning 2.2.1

but now there is a new Problem with python 2 and sphinx < 1.8.5

VersionConflict: (Sphinx 1.7.7 (venv2/lib/site-packages), Requirement.parse('sphinx<2.0,>=1.8.5; python_version < "3.0"'))

is there a version of sphinx >=1.8.5 < 2.0
which is compatible with sphinxcontrib-versioning?

@z00sts
Copy link

z00sts commented Feb 5, 2020

@swalsberger I think there are few more issues with spinix >= 1.7+. I was fixing ImportError during getting help message:

Package                       Version                                                  
----------------------------- ----------
...
Sphinx                        2.2.2      
sphinxcontrib-applehelp       1.0.1      
sphinxcontrib-devhelp         1.0.1      
sphinxcontrib-htmlhelp        1.0.2      
sphinxcontrib-jsmath          1.0.1      
sphinxcontrib-qthelp          1.0.2      
sphinxcontrib-serializinghtml 1.1.3      
sphinxcontrib-versioning      2.2.1      
...
$ venv/bin/sphinx-versioning --help
Traceback (most recent call last):
  File "venv/bin/sphinx-versioning", line 11, in <module>
    load_entry_point('sphinxcontrib-versioning', 'console_scripts', 'sphinx-versioning')()
  File ".../sphinxcontrib-versioning/venv/lib/python3.7/site-packages/setuptools-40.8.0-py3.7.egg/pkg_resources/__init__.py", line 489, in load_entry_point
  File ".../sphinxcontrib-versioning/venv/lib/python3.7/site-packages/setuptools-40.8.0-py3.7.egg/pkg_resources/__init__.py", line 2793, in load_entry_point
  File ".../sphinxcontrib-versioning/venv/lib/python3.7/site-packages/setuptools-40.8.0-py3.7.egg/pkg_resources/__init__.py", line 2411, in load
  File ".../sphinxcontrib-versioning/venv/lib/python3.7/site-packages/setuptools-40.8.0-py3.7.egg/pkg_resources/__init__.py", line 2417, in resolve
  File ".../sphinxcontrib-versioning/sphinxcontrib/versioning/__main__.py", line 13, in <module>
    from sphinxcontrib.versioning.routines import build_all, gather_git_info, pre_build, read_local_conf
  File ".../sphinxcontrib-versioning/sphinxcontrib/versioning/routines.py", line 11, in <module>
    from sphinxcontrib.versioning.sphinx_ import build, read_config
  File ".../sphinxcontrib-versioning/sphinxcontrib/versioning/sphinx_.py", line 9, in <module>
    from sphinx import application, build_main, locale
ImportError: cannot import name 'build_main' from 'sphinx'

@swalsberger
Copy link

Ok, wie found the Problem
sphinxcontrib-images >= 9.0 makes the trouble on python 2.x

now we have these versions
sphinx==1.7.7
sphinxcontrib-versioning==2.2.1
sphinxcontrib-images==0.8.0
sphinxcontrib-websupport==1.1.2

@jli
Copy link

jli commented Dec 2, 2020

FYI, sphinx-multiversion is an alternative project (found here).

I just worked on a PR to switch to SMV from SCV: gro-intelligence/api-client#292
It was straightforward, except that I needed to replicate the behavior of sphinx-versioning push via a shell script. (There are docs on how do to this, but the results are a little different and I didn't want to break any existing links, so needed to resort to a shell script.)

In terms of project health, it doesn't seem particularly active/responsive (looks like just @Holzhaus maintaining it, a number of open issues and PRs), so there is a risk there. But the code looks pretty clean/straightforward.

@Holzhaus
Copy link

Holzhaus commented Dec 2, 2020

@jli I originally started sphinx-multiversion because I needed a versioning extension for the Mixxx manual and I couldn't get sphinxcontrib-versioning to work. When I tried to fix the issues, I found the code to be a mess, so I wrote another one from scratch.

As the extension already satisfies my use-case, I consider the extension more or less finished. I try to look into open issues from time to time, but most of them are caused by other third party extensions that I don't use, so I'd appreciate PRs. And in case I ever get run over by a bus or choose to become a Pokemon trainer, you can still fork it - I think the code should be pretty easy to understand.

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

5 participants