sphinx-contrib / sphinxcontrib-versioning

Sphinx extension that allows building versioned docs for self-hosting.
https://sphinxcontrib-versioning.readthedocs.io/en/latest/
MIT License
125 stars 81 forks source link

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

Open z00sts opened 4 years ago

z00sts commented 4 years ago

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'
TimKam commented 4 years ago

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.
z00sts commented 4 years ago

@TimKam fixed

gryphon2411 commented 4 years ago

@TimKam any progress on this one?

achamayou commented 4 years ago

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

TimKam commented 4 years ago

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

TimKam commented 4 years ago

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.

z00sts commented 4 years ago

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

I'm not sure that this particular issue is related

TimKam commented 4 years ago

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.

Holzhaus commented 4 years ago

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

TimKam commented 4 years ago

@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?

Holzhaus commented 4 years ago

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:

codecov-io commented 3 years ago

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.

samuel-emrys commented 3 years ago

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