Skip to content

Proposal for versioned documentation #13

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

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions versioned-docs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Versioned Documentation
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please link this somewhere as well fairlearn/fairlearn#482

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This mention links it :-)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once checking in it won't


We are starting to run into issues with people trying to use Fairlearn installed from PyPI with the documentation on [our website](https://fairlearn.github.io/).
This is an issue because we have made and are making a number of breaking changes to our API.
The solution to this is to provide versioned documentation, so that users can read the docs associated with the version they have installed.
This is the pattern used by projects such as [SciKit-Learn](https://scikit-learn.org).

The basic pattern is to change the layout of the `fairlearn.github.io` repository so that there is a directory for each version of the documentation.
There is then a root level `index.html` to redirect users to an appropriate default directory (either latest release, or the development branch).
See the [SciKit-Learn documentation repo](https://github.com/scikit-learn/scikit-learn.github.io) for an example.

There are tools to help with this, such as:
- [sphinx-multiversion](https://pypi.org/project/sphinx-multiversion/)
- [sphinxcontrib-versioning](https://pypi.org/project/sphinxcontrib-versioning/)

The latter of these last had a PyPI release in 2016. The last repo commit was in 2019, but there was little activity after 2016.
As such, it is probably not a wise choice.

The `sphinx-multiversion` tool has more recent updates, and the author has been very helpful with debugging issues the Fairlearn documentation.
Some of these have resulted from Windows, and the author has issued patches for them.
Unfortunately, there is a more fundamental issue: we have substantially changed the `examples/` directory, and this means that the latest `conf.py` does not work with `v0.4.6`.
This is not compatible with the way `sphinx-multiversion` works.

## Tool Selection

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do some more reading. When I was writing this, I was primarily thinking about the v0.4.6 issue (not to mention the even older versions for which all the sphinx docs will vanish).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need to care. Scikit learn starts somewhere around 0.17 or so and that's fine.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't mean to go back to the beginning, but I would like to be able to generate docs for v0.4.6.

I've been reading the docs for both sphinxcontrib-versioning and sphinx-multiversion. Both look like they can go back to older versions just fine.

Comparing:
https://github.com/sphinx-contrib/sphinxcontrib-versioning
and
https://github.com/Holzhaus/sphinx-multiversion
I'm a little concerned that the former hasn't had any activity since last December, and it was mostly 'done' back in 2016. I'll start by seeing that sphinx-multiversion can do.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Been trying to persuade sphinx-multiversion to work... have wound up filing an issue on it :-/

We should onboard to using `sphinx-multiversion` going forwards.
However, if we want `v0.4.6` documentation, that will have to be a special case.
It should be relative straightforward to add it to the `fairlearn.github.io` repository manually, once `sphinx-multiversion` has taken over main documentation build.
We will then at least have a URL we can share with those who encounter issues.

Since `sphinx-multiversion` builds every version of the documentation each time and we have some examples which take a while to generate, it is possible that we might start to bump against the time limits of our free CircleCI account.
If this happens, we will have to devise workarounds.

## Required Changes

Moving to versioned documentation will require a number of changes to the workings of our `docs/` directory.

Our static, professionally designed landing page should be removed from the Sphinx build.
The assets should be saved in a separate directory, and copied to the appropriate location by a script after the main documentation has been built.

To access the different versions of the documentation, `sphinx-multiversion` [provides two samples](https://holzhaus.github.io/sphinx-multiversion/master/templates.html) of HTML fragments which can be generated with appropriate links.
Unfortunately, it appears that currently the `pydata-sphinx-theme` we're using does not currently support customised sidebars.
I have [opened an issue on their GitHub repo](https://github.com/pandas-dev/pydata-sphinx-theme/issues/234) about this, and it has been acknowledged.
If no better solution can be found, then I can adjust the generated code from `sphinx-multiversion` to be a full webpage, and have it redirect to the `master` version after a pause of five seconds.
The 'User Guide' links on the static landing page can then point to this version-selection page.