code: def setup(app: Sphinx) -> dict[str, Any]:
      app.add_directive("testsetup", TestsetupDirective)
      app.add_directive("testcleanup", TestcleanupDirective)
      app.add_directive("doctest", DoctestDirective)
      app.add_directive("testcode", TestcodeDirective)
      app.add_directive("testoutput", TestoutputDirective)
      app.add_builder(DocTestBuilder)
      # this config value adds to sys.path
      app.add_config_value("doctest_show_successes", True, "", bool)
      app.add_config_value("doctest_path", [], "")
      app.add_config_value("doctest_test_doctest_blocks", "default", "")
      app.add_config_value("doctest_global_setup", "", "")
      app.add_config_value("doctest_global_cleanup", "", "")
      app.add_config_value(
          "doctest_default_flags",
          doctest.DONT_ACCEPT_TRUE_FOR_1
          | doctest.ELLIPSIS
          | doctest.IGNORE_EXCEPTION_DETAIL,
          "",
      )
      return {
          "version": sphinx.__display_version__,
          "parallel_read_safe": True,
      }
  
imports: from __future__ import annotations
  import doctest
  import re
  import sys
  import time
  from io import StringIO
  from os import path
  from typing import TYPE_CHECKING, Any, Callable
  from docutils import nodes
  from docutils.parsers.rst import directives
  from packaging.specifiers import InvalidSpecifier, SpecifierSet
  from packaging.version import Version
  import sphinx
  from sphinx.builders import Builder
  from sphinx.locale import __
  from sphinx.util import logging
  from sphinx.util.console import bold
  from sphinx.util.docutils import SphinxDirective
  from sphinx.util.osutil import relpath
label_desc: Use image node_id 2 for calling a global function with example usage: setup(app) and returns: dict