0

I currently have a software that I documented using sphinx. I created a website and display the actual documentation part using sphin autodoc. For now, I have the package installed on my local python version so I can simply say

.. autoclass:: packagename.Classname
   :members:

and have the contents of the class be displayed.

The goal is to create multiple versions of the documentation and be able to select one in a sidebar dropdown menu using e.g. sphinx-multiversion, however because the documentation is seperate from the actual source code I cannot simply use autoclass, since this directive only looks at the package that is installed for the local python version. Is there a good way to generate a documentation for each version and then reference it from within my actual website using a similar directive?

mzjn
  • 48,958
  • 13
  • 128
  • 248
Yes
  • 339
  • 3
  • 19
  • A package does not need to be installed in order to be documented. In conf.py, you can add to `sys.path` so that Sphinx can find the package. – mzjn Jul 13 '21 at 19:24
  • But I have multiple versions of the same package that I would like to reference, so some classes are overlapping. If I add two versions to sys.path then how do I know which one I am referencing? – Yes Jul 13 '21 at 19:43
  • I don't really understand the question. What do you mean by "the documentation is seperate from the actual source code"? Isn't the Sphinx project in the same repository as the code? – mzjn Jul 13 '21 at 19:52
  • I created a documentation website seperate from the actual source code repository and am documenting it in the documentation section using autoclass and the installed package as shown above. Is there maybe a place in the documentation I missed that shows how you can reference a specific class from a directory containing python code instead of referencing the version I installed using pip? – Yes Jul 13 '21 at 20:02
  • 1
    For an example of how to publish multiple versions of a project, see [Pyramid](https://github.com/pylons/pyramid). It uses a branch for each version and publishes each branch. See the [docs](https://docs.pylonsproject.org/projects/pyramid/en/latest/) and use the version switcher in the lower right corner. – Steve Piercy Jul 14 '21 at 08:04

0 Answers0