Skip to content

Instantly share code, notes, and snippets.

@goerz
Created January 9, 2020 04:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save goerz/16099378bfed5c4edcde0a8c27ef1bc6 to your computer and use it in GitHub Desktop.
Save goerz/16099378bfed5c4edcde0a8c27ef1bc6 to your computer and use it in GitHub Desktop.
README test

Doctr Versions Menu

Source code on Github

Documentation

doctr-versions-menu on the Python Package Index

Travis Continuous Integration

AppVeyor Continuous Integration

Coveralls

MIT License

Sphinx extension and utility to add a versions menu to Doctr-deployed documentation.

Doctr is a tool that deploys Sphinx documentation to Github Pages. It is an alternative to the popular Read the Docs (RTD). Compared to RTD, Doctr gives full control over the documentation build process. However, Doctr out of the box does not support documentation for multiple versions of a package at the same time (unlike RTD).

The doctr-versions-menu package aims to remedy this. It provides a Sphinx extension and a command line tool that work together to generate a dynamic versions menu similar to that on RTD pages:

Doctr Versions Menu Screenshot

It also injects warnings for outdated or unreleased versions.

See the doctr-versions-menu documentation itself for a live example.

Development of Doctr Versions Menu happens on Github. You can read the full documentation online.

⚠️ WARNING: This implementation is work in progress. No public release is available at this time, nor should the current development version (master) be considered functional.

Installation

To install the latest released version of doctr-versions-menu, run this command in your terminal:

$ pip install doctr-versions-menu

This is the preferred method to install Doctr Versions Menu, as it will always install the most recent stable release.

If you don't have pip installed, the Python installation guide, respectively the Python Packaging User Guide can guide you through the process.

To install the latest development version of doctr-versions-menu from Github.

$ pip install git+https://github.com/goerz/doctr_versions_menu.git@master#egg=doctr_versions_menu

Usage

Showing a versions menu in your documentation requires two steps:

  1. Add 'doctr_versions_menu' to the list of extensions in your Sphinx conf.py.

    This adds javascript to your rendered documentation that displays a dynamic versions menu based on information in a versions.json file it expects to find in the root for your gh-pages branch.

  2. Call the doctr-versions-menu command as part of doctr deploy.

    For example,

    python -m doctr deploy --command="doctr-versions-menu" --no-require-master --build-tags "$DEPLOY_DIR"

    This causes doctr-versions-menu to be executed in the root of the gh-pages branch. The script examines the folders that exist there, and generates the versions.json file that step 1 relies on.

See the full documentation for Step 1 and Step 2 for details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment