Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to manage multiple versions of documentation with Sphinx? [closed]

I maintain a small library project written in C++. I'd like to use Sphinx to maintain the library website + user documentation per release version. I have found [similar question asked How to manage many versions? on the sphinx-dev mailing list which I have bumped but without extensive follow-up.

How to manage many versions?

I think of basic structure like this:

mylib/     <- website root
mylib/...
mylib/tutorial/...
mylib/doc   <- list of documentation per release version
mylib/doc/1.0.0
mylib/doc/2.0.0
mylib/doc/X.Y.Z

I'm trying to figure out best practical configuration for this structure. I have root configuration mylib/conf.py where I control the website structure and content.

I could put .rst files into mylib/doc/1.0.0 and mylib/doc/2.0.0 build them using the root conf.py. But then it seems tricky to control toctree for website and for docs.

So, I think it may be more practical to separate website config/build from per release documentation config/builds:

mylib/conf.py
mylib/doc/1.0.0/conf.py
mylib/doc/2.0.0/conf.py
mylib/doc/X.Y.Z/conf.py

but I'd like the main documents in mylib/doc/X.Y.Z/conf.py to use the same layout is the root documents in mylib/, so I can have consistent look, e.g. links in page header, etc.

This way I can easily achieve consistent toctree per documentation release. It should be easy to walk the directories and perform builds for website and for each doc version separately.

Regarding searching the documentation, I don't mind the search engine to scan all versions of documentation per single query as well as I don't mind to have search engine specific to particular version (search box is displayed in the same place, but depending what is being read, it scans index of current version only).

Is there any better way to achieve that?

I've found similar question asked in sphinx for multiple, separate documents and I'm wondering if the Intersphinx plugin is a good idea here.

UPDATE:

  • 2017-04-10: SO answer pointing to an interesting Sphinx extension: sphinxcobtrib-versioning
  • 2011-10-21: Following olt's question in comments, mylib/ is not how I mean to structure project in VCS. So, I don't want to maintain multiple versions of documentation in VCS. The mylib/ is just structure for easier visualisation. It can be also working directory where I put Sphinx sources together (e.g. pull from version branches, etc.) and where I launch Sphinx to build the output.
like image 760
mloskot Avatar asked Oct 21 '11 13:10

mloskot


1 Answers

In my opinion, the documentation should stay with the code in the same repository. Otherwise you would need to manage the documentation source manually, for example when you backport a feature from version B to A. With a single repository, you just check out that version and re-build the documentation.

You should look at SQLAlchemy project, they have multiple versions of their documentation available on the same site. The documentation is in the same repository and they copy the output of each version into their static homepage folders.

like image 189
olt Avatar answered Oct 24 '22 19:10

olt