# Configuration file for the Sphinx documentation builder. # # For the full list of built-in configuration values, see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html from datetime import datetime import json import os import sys import tempfile sys.path.insert( 0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..")) ) from mapping_provider import create_app # -- Project information ----------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information project = 'GÉANT Mapping Provider' copyright = f"{datetime.now().year}, GÉANT" author = 'swd@geant.org' release = '0.0' # -- General configuration --------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration extensions = [ "sphinx_rtd_theme", "sphinx.ext.autodoc", "sphinx.ext.coverage", "sphinxcontrib.plantuml", "sphinxcontrib.openapi", ] # tags is injected by sphinx into conf.py # toggle this by running ``sphinx-build -t drawio`` if tags.has("drawio"): # noqa F821 extensions.append("sphinxcontrib.drawio") templates_path = ['_templates'] exclude_patterns = [] plantuml = f'java -jar {os.path.expanduser("~/bin/plantuml.jar")}' # -- Options for HTML output ------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output html_theme = 'sphinx_rtd_theme' html_static_path = ['_static'] # we need a minimal/parseable config file in order to # start the server and dump the schema with tempfile.NamedTemporaryFile(delete=False) as f: bogus_config = {'inventory': 'http://bogus'} with open(f.name, 'w') as f: json.dump(bogus_config, f) f.flush() os.environ['SETTINGS_FILENAME'] = f.name api_schema = create_app().openapi() openapi_filename = os.path.join(os.path.dirname(__file__), "openapi.json") with open(openapi_filename, 'w') as f: json.dump(api_schema, f, indent=4)