Coverage for jsonschema_diff/sphinx/__init__.py: 0%

12 statements  

« prev     ^ index     » next       coverage.py v7.10.5, created at 2025-08-25 07:00 +0000

1# jsonschema_diff/sphinx/__init__.py 

2""" 

3Sphinx extension: ``jsonschema_diff.sphinx`` 

4""" 

5 

6from __future__ import annotations 

7 

8from pathlib import Path 

9from typing import Any 

10 

11from sphinx.application import Sphinx 

12 

13 

14def setup(app: Sphinx) -> dict[str, Any]: 

15 """Register the directive and configuration variable.""" 

16 from .directive import JsonSchemaDiffDirective 

17 

18 app.add_directive("jsonschemadiff", JsonSchemaDiffDirective) 

19 

20 # единственная настраиваемая переменная 

21 app.add_config_value("jsonschema_diff", None, "env") 

22 

23 # гарантируем наличие _static в html_static_path 

24 static_root = Path(app.srcdir) / "_static" 

25 if str(static_root) not in app.config.html_static_path: 

26 app.config.html_static_path.append(str(static_root)) 

27 

28 return { 

29 "version": "0.4.0", 

30 "parallel_read_safe": True, 

31 "parallel_write_safe": True, 

32 }