The following provides a guide for developers wishing to contribute to Sphinx-Needs.

Bugs, Features and PRs

For bug reports and technical well described feature requests please use our issue tracker:
For feature ideas and questions please use our discussion board:

If you have already created a PR, awesome! Just send it in. It will be checked by our CI (test and code styles) and a maintainer needs to perform a review, before it can be merged. Your PR should contain the following parts:

  • A meaningful description or link, which describes the change

  • The changed code (for sure :) )

  • Test cases for the change (important!)

  • Updated documentation, if behavior gets changed or new options/directives are introduced.

  • Update of docs/changelog.rst.

  • If this is your first PR, feel free to add your name in the AUTHORS file.

Installing Dependencies

Sphinx-Needs requires only Poetry to be installed as a system dependency, the rest of the dependencies are ‘bootstrapped’ and installed in an isolated environment by Poetry.

  1. Install Poetry

  2. Install project dependencies

poetry install
  1. Install Pre-Commit

  2. Install the Pre-Commit hooks

pre-commit install
  1. For running tests, install the dependencies of our official documentation:

pip install -r docs/requirements.txt

List make targets

Sphinx-Needs uses make to invoke most development related actions.

Use make list to get a list of available targets.


Build docs

This will build the Sphinx-Needs documentation stored under /docs.

It will always perform a clean build (calls make clean before the build). If you want to avoid this, run the related sphinx-commands directly under /docs (e.g. make docs).

make docs-html


make docs-pdf

To check if all used links in the documentation are still valid, run:

make docs-linkcheck

Running Tests


Please be sure to have the dependencies of the official documentation installed:

pip install -r docs/requirements.txt
make test

Linting & Formatting

Sphinx-Needs uses black and isort to care about its source code formatting.

make lint

Running Test Matrix

This project provides a test matrix for running the tests across a range of python and sphinx versions. This is used primarily for continuous integration.

Nox is used as a test runner.

Running the matrix tests requires additional system-wide dependencies

  1. Install Nox

  2. Install Nox-Poetry

  3. You will also need multiple Python versions available. You can manage these using Pyenv

You can run the test matrix by using the nox command


or using the provided Makefile

make test-matrix

For a full list of available options, refer to the Nox documentation, and the local noxfile.

import nox
from nox_poetry import session

PYTHON_VERSIONS = ["3.8", "3.9.7", "3.10"]
SPHINX_VERSIONS = ["4.0.3", "4.3.2", "4.5"]

def is_supported(python: str, sphinx: str) -> bool:
    return not (python == "3.6" and sphinx not in ["3.2"])

def run_tests(session, sphinx):
    session.install(*TEST_DEPENDENCIES)"pip", "install", f"sphinx=={sphinx}", silent=True)"pip", "install", "-r", "docs/requirements.txt", silent=True)"echo", "TEST FINAL PACKAGE LIST")"pip", "freeze")"make", "test", external=True)

@nox.parametrize("sphinx", SPHINX_VERSIONS)
def tests(session, sphinx):
    if is_supported(session.python, sphinx):
        run_tests(session, sphinx)
        session.skip("unsupported combination")

def linkcheck(session):
    # LinkCheck can handle rate limits since Sphinx 3.4, which is needed as
    # our doc has to many links to GitHub."pip", "install", "sphinx==3.5.4", silent=True)"pip", "install", "-r", "docs/requirements.txt", silent=True)"make", "docs-linkcheck", external=True)

Running Commands

See the Poetry documentation for a list of commands.

In order to run custom commands inside the isolated environment, they should be prefixed with “poetry run” (ie. poetry run <command>).


Daniel Woste <>


Marco Heinemann <>

Trevor Lovett <>

Magnus Lööf <>

Harri Kaimio

Anders Thuné

Daniel Eades <>

Philip Partsch <>

David Le Nir <>

Baran Barış Yıldızlı <>

Roberto Rötting <>

Nirmal Sasidharan <>

Jacob Allen <>

Jörg Kreuzberger <>

Publishing a new release

There is a release pipeline installed for the CI.

This gets triggered automatically, if a tag is created and pushed. The tag most follow [0-9].[0-9]+.[0-9]. Otherwise the release jobs get not triggered. So other tags can still be used.

The release jobs will build the source and wheel distribution and try to upload them to and

Debugging Sphinx-Needs Language Server features

Sphinx-Needs provides some language server functions for the Esbonio Language Server.

The complete functionality can used in VsCode by using the extension vscode-restructuredtext. The whole configuration is done automatically and Sphinx-Needs features gets loaded, if the Sphinx-Needs extension is part of ´extensions` variable inside


Most information is coming from

  1. Check out the source code of all the following projects:

    • vscode-restructuredtext: links…

    • esbonio

  2. Follow to install all dependencies, compile it and get the Development host running in VsCode.

  3. Create a test folder inside the project with a Sphinx projects using Sphinx-Needs, for example under /docs by using sphinx-quickstart.

  4. Add the following to docs/.vscode/settings.json:

        "esbonio.server.sourceFolder": "/Path/to/checked_out/esbonio/lib/esbonio",  # absolute path
        "esbonio.server.debugLaunch": true,
        "esbonio.server.logLevel": "debug",
  5. Add the args ${workspaceFolder}/docs to configuration Launch Extension in .vscode/launch.json like this:

                      "name": "Launch Extension",
                      "type": "extensionHost",
                      "request": "launch",
                      "runtimeExecutable": "${execPath}",
                      "args": [
                      "sourceMaps": true,
                      "outFiles": ["${workspaceRoot}/out/extension.js"],
                      "preLaunchTask": "watch"
  6. Test it by pressing F5 (running the preconfigured tasks Launch Extension)

    • In the opened extensionDevelopmentHost instance, select the correct python interpretor. e.g. vscode-restructuredtext/.venv/bin/python

  7. Open another instance of VsCode for the checked out esbonio folder.

  8. Add this to .vscode/launch.json under configurations:

        "name": "Python: Remote Attach",
        "type": "python",
        "request": "attach",
        "connect": {
            "host": "localhost",
            "port": 5678
        "pathMappings": [
                "localRoot": "${workspaceFolder}/lib/esbonio",
                "remoteRoot": "."
  9. Test it by running the new task Python: Remote Attach. For this the task Launch Extension from VsCode-restructuredText Extension must be already running, as this one starts a python debug server.

  10. Now you set set breakpoints anywhere in the esbonio code.

Debugging Sphinx-Needs functions

To debugging Sphinx-Needs Language Server functions, you can repeat the steps 7-10 from above with the Sphinx-Needs repository.


  • For step 8: adapt the localRoot path accordingly, e.g. “${workspaceFolder}/../esbonio/lib/esbonio”

  • If it doesn’t stop at breakpoints, set a breakpoint at sphinx_needs/, where you import esbonio_setup. When debugger stops there, choose step into to continue debug.