This page provides a guide for developers wishing to contribute to Sphinx-Needs.

Bugs, Features and PRs

For bug reports and well-described technical feature requests, please use our issue tracker:

For feature ideas and questions, please use our discussion board:

If you have already created a PR, you can send it in. Our CI workflow will check (test and code styles) and a maintainer will perform a review, before we can merge it. Your PR should conform with the following rules:

  • 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
  3. Install Pre-Commit

  4. Install the Pre-Commit hooks

    pre-commit install
  5. 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

To build the Sphinx-Needs documentation stored under /docs, run:

# Build HTML pages
make docs-html


# Build PDF pages
make docs-pdf

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).

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 format its source code.

make lint


Sphinx-Needs own documentation is used for creating a benchmark for each PR. If the runtime takes 10% longer as the previous ones, the benchmark test will fail.

Benchmark test cases are available under tests/benchmarks. And they can be locally executed via make benchmark.

The results for each PR/commit get added to a chart, which is available under

The benchmark data is stored on the benchmarks branch, which is also used by github-pages as source.

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

# The versions here must be in sync with the github-workflows.
# Or at least support all version from there.
# This list can contain more versions as used by the github workflows to support
# custom local tests

PYTHON_VERSIONS = ["3.8", "3.10"]
SPHINX_VERSIONS = ["5.2.1", "4.5.0"]
DOCUTILS_VERSIONS = ["0.19", "0.17", "0.16", "0.15"]


# Some pytest-extension do not work well with pytest-benchmark, so we create our
# own list for benchmarking
BENCHMARK_DEPENDENCIES = [e for e in TEST_DEPENDENCIES if e not in ['"pytest-xdist"']]

def is_supported(python: str, sphinx: str, docutils: str) -> bool:
    return not (sphinx in ["4.5.0"] and docutils in ["0.19", "0.18"])

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

@nox.parametrize("docutils", DOCUTILS_VERSIONS)  # order is important, last options needs to be given first ...
@nox.parametrize("sphinx", SPHINX_VERSIONS)  # ... by GH workflow
def tests(session, sphinx, docutils):
    if is_supported(session.python, sphinx, docutils):
        run_tests(session, sphinx, docutils)
        session.skip("unsupported combination")

def linkcheck(session):
    # LinkCheck can handle rate limits since Sphinx 3.4, which is needed as
    # our doc has too 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)

def benchmark_time(session):
    session.install(*BENCHMARK_DEPENDENCIES)"pip", "install", "-r", "docs/requirements.txt", silent=True)
        env={"ON_CI": "true", "FAST_BUILD": "true"},

def benchmark_memory(session):
    session.install(*BENCHMARK_DEPENDENCIES)"pip", "install", "-r", "docs/requirements.txt", silent=True)
        env={"ON_CI": "true", "FAST_BUILD": "true"},
    )"memray", "flamegraph", "-o", "mem_out.html", "mem_out.bin")

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>).

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 must follow the format: [0-9].[0-9]+.[0-9]. Otherwise the release jobs won’t trigger.

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


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 <>

Duodu Randy <>

Christian Wappler <>