11"""Sphinx documentation generation configuration."""
22
3+ import enum
34import types
45import inspect
56import pathlib
2223 "sphinx.ext.intersphinx" ,
2324]
2425
25- html_theme = "sphinx_rtd_theme "
26+ html_theme = "furo "
2627
2728autosummary_generate = False
2829intersphinx_mapping = {'python' : ('https://docs.python.org/3' , None )}
@@ -75,19 +76,24 @@ def _generate_api_docs() -> None:
7576
7677 lines += ["" , f".. auto{ type_name } :: { name } " ]
7778 if type_name == "class" :
79+ if not issubclass (export , enum .Enum ):
80+ lines += [" :inherited-members:" ]
7881 lines += [
79- " :inherited-members:" ,
8082 " :members:" ,
8183 " :undoc-members:" ,
8284 ]
8385 elif type_name == "exception" :
8486 lines += [" :members:" ]
8587 lines += ["" ]
8688
89+ module_rst = "\n " .join (lines )
90+
8791 module_rst_reference = f"swf_typed.{ module_name } "
8892 module_rst_references .append (module_rst_reference )
93+
8994 module_path = source_dir / f"{ module_rst_reference } .rst"
90- module_path .write_text ("\n " .join (lines ))
95+ if not module_path .is_file () or module_path .read_text () != module_rst :
96+ module_path .write_text (module_rst )
9197
9298 lines = [
9399 r"swf\_typed" ,
@@ -102,8 +108,11 @@ def _generate_api_docs() -> None:
102108 lines += [f" { n } " for n in module_rst_references ]
103109 lines += ["" ]
104110
111+ api_docs_rst = "\n " .join (lines )
112+
105113 api_docs_path = source_dir / f"swf_typed.rst"
106- api_docs_path .write_text ("\n " .join (lines ))
114+ if not api_docs_path .is_file () or api_docs_path .read_text () != api_docs_rst :
115+ api_docs_path .write_text (api_docs_rst )
107116
108117
109118_generate_api_docs ()
0 commit comments