40
40
41
41
# Sphinx extensions
42
42
extensions = [
43
- "sphinx.ext.autodoc" ,
44
- "sphinx.ext.autosummary" ,
45
43
"sphinx.ext.intersphinx" ,
46
44
"sphinx_copybutton" ,
47
45
"sphinx_design" ,
48
- "sphinx_tabs.tabs" ,
49
- "sphinxcontrib.autodoc_pydantic" ,
50
46
"sphinx_jinja" ,
47
+ "numpydoc" ,
48
+ "ansys_sphinx_theme.extension.autoapi" ,
49
+ "sphinx_gallery.gen_gallery" ,
51
50
]
52
51
53
52
exclude_patterns = ["_build" , "Thumbs.db" , ".DS_Store" ]
54
53
54
+ nbsphinx_execute = "always"
55
+ sphinx_gallery_conf = {
56
+ # path to your examples scripts
57
+ "examples_dirs" : ["../../examples" ],
58
+ # path where to save gallery generated examples
59
+ "gallery_dirs" : ["examples" ],
60
+ # Pattern to search for example files
61
+ "filename_pattern" : r".*\.py" ,
62
+ "run_stale_examples" : False , # Do not re-run examples
63
+ "plot_gallery" : False ,
64
+ # Remove the "Download all examples" button from the top level gallery
65
+ "download_all_examples" : False ,
66
+ # Sort gallery example by file name instead of number of lines (default)
67
+ # directory where function granular galleries are stored
68
+ "backreferences_dir" : None ,
69
+ # Modules for which function level galleries are created in
70
+ "doc_module" : "ansys-hps-data-transfer-client" ,
71
+ "ignore_pattern" : "flycheck*" ,
72
+ "thumbnail_size" : (350 , 350 ),
73
+ "remove_config_comments" : True ,
74
+ "show_signature" : False ,
75
+ }
76
+
77
+
55
78
# Intersphinx mapping
56
79
intersphinx_mapping = {
57
80
"python" : ("https://docs.python.org/3" , None ),
58
- # kept here as an example
59
- # "scipy": ("https://docs.scipy.org/doc/scipy/reference", None),
60
- # "numpy": ("https://numpy.org/devdocs", None),
61
- # "matplotlib": ("https://matplotlib.org/stable", None),
62
- # "pandas": ("https://pandas.pydata.org/pandas-docs/stable", None),
63
- # "pyvista": ("https://docs.pyvista.org/", None),
64
- # "grpc": ("https://grpc.github.io/grpc/python/", None),
81
+ #"scipy": ("https://docs.scipy.org/doc/scipy/reference", None),
82
+ "numpy" : ("https://numpy.org/devdocs" , None ),
83
+ #"matplotlib": ("https://matplotlib.org/stable", None),
84
+ #"pandas": ("https://pandas.pydata.org/pandas-docs/stable", None),
85
+ #"pyvista": ("https://docs.pyvista.org/", None),
86
+ #"grpc": ("https://grpc.github.io/grpc/python/", None),
65
87
}
66
88
67
89
# numpydoc configuration
74
96
numpydoc_validation_checks = {
75
97
"GL06" , # Found unknown section
76
98
"GL07" , # Sections are in the wrong order.
77
- "GL08" , # The object does not have a docstring
99
+ # "GL08", # The object does not have a docstring
78
100
"GL09" , # Deprecation warning should precede extended summary
79
101
"GL10" , # reST directives {directives} must be followed by two colons
80
102
"SS01" , # No summary found
81
- "SS02" , # Summary does not start with a capital letter
103
+ # "SS02", # Summary does not start with a capital letter
82
104
# "SS03", # Summary does not end with a period
83
105
"SS04" , # Summary contains heading whitespaces
84
106
# "SS05", # Summary must start with infinitive verb, not third person
85
107
"RT02" , # The first line of the Returns section should contain only the
86
108
# type, unless multiple values are being returned"
87
109
}
88
110
89
- # autodoc/autosummary flags
90
- autoclass_content = "both"
91
- # autodoc_default_flags = ["members"]
92
- autosummary_generate = True
111
+
112
+ autoapi_type = "python"
113
+ autoapi_dirs = ["../../src" ]
114
+ autoapi_generate_api_docs = True
115
+ autoapi_root = "api"
116
+
117
+ # Configuration for Sphinx autoapi
118
+ suppress_warnings = [
119
+ "autoapi.duplicate_object" ,
120
+ "design.grid" ,
121
+ "docutils" ,
122
+ "toc.not_readable" ,
123
+ "toc.not_included" ,
124
+ "toc.excluded" ,
125
+ "ref.python" ,
126
+ "design.fa-build" ,
127
+ ]
93
128
94
129
95
130
# static path
104
139
# The master toctree document.
105
140
master_doc = "index"
106
141
142
+
107
143
# Keep these while the repository is private
108
144
linkcheck_ignore = [
109
145
"https://github.com/ansys-internal/hps-data-transfer-client//*" ,
115
151
# available until the release is published.
116
152
if switcher_version != "dev" :
117
153
linkcheck_ignore .append (f"https://github.com/ansys/ansys.hps.data_transfer_client/releases/tag/v{ __version__ } " )
154
+
155
+ # Examples gallery customization
156
+ nbsphinx_execute = "always"
157
+
158
+ # -- Declare the Jinja context -----------------------------------------------
159
+ exclude_patterns = [
160
+ "examples/**/*.txt" ,
161
+ "api/client/client/index.rst" ,
162
+ "api/client/index.rst" ,
163
+ ]
164
+
165
+ BUILD_API = True
166
+ if not BUILD_API :
167
+ exclude_patterns .append ("autoapi" )
168
+
169
+ BUILD_EXAMPLES = True
170
+ if not BUILD_EXAMPLES :
171
+ exclude_patterns .append ("examples/**" )
172
+ exclude_patterns .append ("examples.rst" )
173
+
174
+ jinja_contexts = {
175
+ "main_toctree" : {
176
+ "build_api" : BUILD_API ,
177
+ "build_examples" : BUILD_EXAMPLES ,
178
+ }
179
+ }
180
+
181
+
182
+ def prepare_jinja_env (jinja_env ) -> None :
183
+ """Customize the jinja env.
184
+
185
+ Notes
186
+ -----
187
+ See https://jinja.palletsprojects.com/en/3.0.x/api/#jinja2.Environment
188
+
189
+ """
190
+ jinja_env .globals ["project_name" ] = project
191
+
192
+
193
+ autoapi_prepare_jinja_env = prepare_jinja_env
0 commit comments