Contributing or modifying the theme

The sphinx_rtd_theme is primarily a sass project that requires a few other sass libraries. I’m using bower to manage these dependencies and sass to build the css. The good news is I have a very nice set of grunt operations that will not only load these dependencies, but watch for changes, rebuild the sphinx demo docs and build a distributable version of the theme. The bad news is this means you’ll need to set up your environment similar to that of a front-end developer (vs. that of a python developer). That means installing node and ruby.

See also

If you are unsure of appropriate actions to take while interacting with our community please read our Code of Conduct.

Set up your environment

  1. Install sphinx into a virtual environment.

    pip install sphinx sphinxcontrib-httpdomain
  2. Install sass.

    gem install sass
  3. Install node, bower, grunt, and theme dependencies.

    # Install node
    brew install node
    # Install bower and grunt
    npm install -g bower grunt-cli
    # Now that everything is installed, let's install the theme dependencies.
    npm install

Now that our environment is set up, make sure you’re in your virtual environment, go to this repository in your terminal and run grunt:


This default task will do the following very cool things that make it worth the trouble:

  1. Install and update any bower dependencies.
  2. Run sphinx and build new docs.
  3. Watch for changes to the sass files and build css from the changes.
  4. Rebuild the sphinx docs anytime it notices a change to .rst, .html, .js or .css files.

Releasing the Theme

When you release a new version, you should do the following:

  1. Bump the version in sphinx_rtd_theme/, bower.json and package.json – we try to follow semver, so be careful with breaking changes.

  2. Update the changelog (docs/changelog.rst) with the version information.

  3. Run a grunt build to rebuild all the theme assets.

  4. Commit that change.

  5. Tag the release in git: git tag $NEW_VERSION.

  6. Push the tag to GitHub: git push --tags origin.

  7. Upload the package to PyPI:

    $ rm -rf dist/
    $ python sdist bdist_wheel
    $ twine upload --sign --identity dist/*