sphinxcontrib-versioning icon indicating copy to clipboard operation
sphinxcontrib-versioning copied to clipboard

sphinx1.7+: ImportError workaround, allows to see help

Open z00sts opened this issue 5 years ago • 13 comments

upstream merged + branch/commit renamed (https://github.com/sphinx-contrib/sphinxcontrib-versioning/pull/69)

UPD: add reproduce details python 3.7.5

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'

z00sts avatar Dec 05 '19 03:12 z00sts

Can you fix the linting error:

./sphinxcontrib/versioning/sphinx_.py:17:1: I202 Additional newline in a group of imports. 'from sphinx.builders.html import StandaloneHTMLBuilder' is identified as Third Party and 'from sphinx import application, locale' is identified as Third Party.

TimKam avatar Dec 05 '19 11:12 TimKam

@TimKam fixed

z00sts avatar Dec 09 '19 09:12 z00sts

@TimKam any progress on this one?

gryphon2411 avatar Jan 03 '20 19:01 gryphon2411

@TimKam there is a good number of users who would love to this merged (and released!) :)

achamayou avatar Feb 27 '20 14:02 achamayou

Sorry, my GitHub inbox is so full that I can hardly see what's relevant. I'll take a look tomorrow night latest.

TimKam avatar Mar 11 '20 08:03 TimKam

I am getting an error:

File "/Users/timotheuskampik/Desktop/github/sphinx-forks/sphinxcontrib-versioning/sphinxcontrib/versioning/sphinx_.py", line 95, in html_page_context
    cls.VERSIONS.context = context
AttributeError: 'NoneType' object has no attribute 'context'

I cannot see where in the code cls.VERSIONS could possibly be set.

TimKam avatar Mar 12 '20 21:03 TimKam

I cannot see where in the code cls.VERSIONS could possibly be set.

I'm not sure that this particular issue is related

z00sts avatar Mar 15 '20 06:03 z00sts

I am also not sure, but I cannot successfully do a manual test. If you point me to a doc set that should "just work" with this branch, I'll test it and consider it good enough/create a follow-up issue.

TimKam avatar Mar 15 '20 10:03 TimKam

I had these issues, too, and decided to write a new, clean implementation of a sphinx versioning extension. If you're still having problems with this, you could try https://holzhaus.github.io/sphinx-multiversion/master/index.html

Holzhaus avatar Mar 15 '20 10:03 Holzhaus

@Holzhaus great, wouldn't it make sense to consolidate these two projects? I.e. if your extension has the same functionality as this one but works reliably, we can deprecate this extension and ideally move yours into this GitHub project (but you remain maintainer). What do you think?

TimKam avatar Mar 15 '20 10:03 TimKam

The extension works vastly different internally. Check the FAQ page.

I wrote it to add versioning to the existing sphinx documentation of the Mixxx DJ Software. Hence, I made sure does not require any changes to old branches/tags (i.e. adding the extension to conf.py). Also, it always uses the configuration of the branch you're building from, so that all versions share the same theme/templates/extensions, etc. So it might not be the right choice for everyone.

I suggest you try it out first before we start to talk about dropping sphinx-versioning in favor of sphinx-multiversion :stuck_out_tongue:

Holzhaus avatar Mar 15 '20 11:03 Holzhaus

Codecov Report

Merging #78 into master will increase coverage by 0.11%. The diff coverage is 60.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #78      +/-   ##
==========================================
+ Coverage   98.34%   98.46%   +0.11%     
==========================================
  Files           8        8              
  Lines         908      912       +4     
  Branches      176      176              
==========================================
+ Hits          893      898       +5     
  Misses          7        7              
+ Partials        8        7       -1     
Impacted Files Coverage Δ
sphinxcontrib/versioning/sphinx_.py 98.64% <60.00%> (-1.36%) :arrow_down:
sphinxcontrib/versioning/git.py 97.14% <0.00%> (+1.42%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 0b56210...d6d0260. Read the comment docs.

codecov-io avatar Oct 24 '20 19:10 codecov-io

Any progress on this? What's holding it up from being merged in?

samuel-emrys avatar May 25 '21 08:05 samuel-emrys