Skip to content

Commit 7add05f

Browse files
committed
fix: Use working config from python-amazon-sp-api (import module, add napoleon)
1 parent 7448927 commit 7add05f

File tree

1 file changed

+51
-103
lines changed

1 file changed

+51
-103
lines changed

docs/conf.py

Lines changed: 51 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,16 @@
1818
#
1919
import os
2020
import sys
21+
import inspect
2122

2223
sys.path.insert(0, os.path.abspath('..'))
2324

25+
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
26+
parentdir = os.path.dirname(currentdir)
27+
sys.path.insert(0, parentdir)
28+
29+
# Importar el módulo principal - ¡ESTO ES CLAVE!
30+
import ad_api
2431

2532
# -- General configuration ------------------------------------------------
2633

@@ -31,22 +38,25 @@
3138
# Add any Sphinx extension module names here, as strings. They can be
3239
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
3340
# ones.
34-
extensions = ['sphinx.ext.autodoc', 'sphinx_rtd_theme']
35-
36-
# Mockear importaciones problemáticas para que autodoc funcione
37-
autodoc_mock_imports = [
38-
"requests",
39-
"cachetools",
40-
"pycryptodome",
41-
"pytz",
42-
"confuse",
43-
"six",
44-
"python-dotenv",
45-
"pyyaml",
46-
# El paquete principal se mockea como respaldo
47-
"ad_api",
41+
extensions = [
42+
'sphinx.ext.autodoc',
43+
'sphinx.ext.napoleon', # ¡IMPORTANTE para docstrings estilo Google!
44+
'sphinx_rtd_theme'
4845
]
4946

47+
# Configuración de autodoc (como en el repo que funciona)
48+
autodoc_default_options = {
49+
"members": True,
50+
"undoc-members": True,
51+
"member-order": "bysource"
52+
}
53+
54+
# Configuración de napoleon para docstrings estilo Google
55+
napoleon_google_docstring = True
56+
napoleon_numpy_docstring = False
57+
napoleon_include_init_with_doc = True
58+
napoleon_include_private_with_doc = False
59+
napoleon_include_special_with_doc = True
5060

5161
# Add any paths that contain templates here, relative to this directory.
5262
templates_path = ['_templates']
@@ -68,17 +78,17 @@
6878

6979
# General information about the project.
7080
project = u'Python Amazon Advertising API'
71-
copyright = u'2022, DAC'
72-
author = u'DAC'
81+
copyright = u'2023, Daniel Alvaro'
82+
author = u'Daniel Alvaro'
7383

7484
# The version info for the project you're documenting, acts as replacement for
7585
# |version| and |release|, also used in various other places throughout the
7686
# built documents.
7787
#
7888
# The short X.Y version.
79-
version = u'0.4.3'
89+
version = u'0.7.4'
8090
# The full version, including alpha/beta/rc tags.
81-
release = u'0.4.3'
91+
release = u'0.7.4'
8292

8393
# The language for content autogenerated by Sphinx. Refer to documentation
8494
# for a list of supported languages.
@@ -99,21 +109,22 @@
99109
# List of patterns, relative to source directory, that match files and
100110
# directories to ignore when looking for source files.
101111
# This patterns also effect to html_static_path and html_extra_path
102-
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', 'ad_api/base/*.py']
112+
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
103113

104114
# The reST default role (used for this markup: `text`) to use for all
105115
# documents.
106116
#
107117
# default_role = None
108118

109-
# If true, '()' will be appended to :func: etc. cross-reference text.
119+
# If true, '()' will be appended to :param: and :param type: in function
120+
# descriptions.
110121
#
111-
# add_function_parentheses = True
122+
add_function_parentheses = True
112123

113124
# If true, the current module name will be prepended to all description
114125
# unit titles (such as .. function::).
115126
#
116-
# add_module_names = True
127+
add_module_names = True
117128

118129
# If true, sectionauthor and moduleauthor directives will be shown in the
119130
# output. They are ignored by default.
@@ -133,34 +144,11 @@
133144
todo_include_todos = False
134145

135146

136-
137-
# -- Configuración adicional para autodoc --
138-
139-
# Configuración adicional para autodoc con decoradores
140-
autodoc_default_options = {
141-
"members": True,
142-
"member-order": "bysource",
143-
"special-members": "__init__",
144-
"undoc-members": True,
145-
"exclude-members": "__weakref__"
146-
}
147-
148-
# Importante para métodos decorados
149-
autodoc_inherit_docstrings = True
150-
151-
# Para preservar signatures con decoradores
152-
autodoc_preserve_defaults = True
153-
154-
# Configurar cómo se muestran los type hints
155-
autodoc_typehints = "signature"
156-
autodoc_typehints_format = "short"
157-
158147
# -- Options for HTML output ----------------------------------------------
159148

160149
# The theme to use for HTML and HTML Help pages. See the documentation for
161150
# a list of builtin themes.
162151
#
163-
# html_theme = 'haiku'
164152
html_theme = 'sphinx_rtd_theme'
165153

166154
# Theme options are theme-specific and customize the look and feel of a theme
@@ -172,24 +160,20 @@
172160
# Add any paths that contain custom themes here, relative to this directory.
173161
# html_theme_path = []
174162

175-
# The name for this set of Sphinx documents.
176-
# "<project> v<release> documentation" by default.
177-
#
178-
# html_title = u'autodoc-example v0.1'
163+
# The name for this set of Sphinx documents. If None, it defaults to
164+
# "<project> v<release> documentation".
165+
html_title = u'Python Amazon Advertising API v0.7.4'
179166

180167
# A shorter title for the navigation bar. Default is the same as html_title.
181-
#
182168
# html_short_title = None
183169

184170
# The name of an image file (relative to this directory) to place at the top
185171
# of the sidebar.
186-
#
187172
# html_logo = None
188173

189174
# The name of an image file (relative to this directory) to use as a favicon of
190-
# the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
175+
# the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
191176
# pixels large.
192-
#
193177
# html_favicon = None
194178

195179
# Add any paths that contain custom static files (such as style sheets) here,
@@ -200,57 +184,44 @@
200184
# Add any extra paths that contain custom files (such as robots.txt or
201185
# .htaccess) here, relative to this directory. These files are copied
202186
# directly to the root of the documentation.
203-
#
204187
# html_extra_path = []
205188

206189
# If not None, a 'Last updated on:' timestamp is inserted at every page
207190
# bottom, using the given strftime format.
208-
# The empty string is equivalent to '%b %d, %Y'.
209-
#
210191
# html_last_updated_fmt = None
211192

212193
# If true, SmartyPants will be used to convert quotes and dashes to
213194
# typographically correct entities.
214-
#
215195
# html_use_smartypants = True
216196

217197
# Custom sidebar templates, maps document names to template names.
218-
#
219198
# html_sidebars = {}
220199

221200
# Additional templates that should be rendered to pages, maps page names to
222201
# template names.
223-
#
224202
# html_additional_pages = {}
225203

226204
# If false, no module index is generated.
227-
#
228205
# html_domain_indices = True
229206

230207
# If false, no index is generated.
231-
#
232208
# html_use_index = True
233209

234210
# If true, the index is split into individual pages for each letter.
235-
#
236211
# html_split_index = False
237212

238213
# If true, links to the reST sources are added to the pages.
239-
#
240214
# html_show_sourcelink = True
241215

242216
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
243-
#
244217
# html_show_sphinx = True
245218

246219
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
247-
#
248220
# html_show_copyright = True
249221

250222
# If true, an OpenSearch description file will be output, and all pages will
251223
# contain a <link> tag referring to it. The value of this option must be the
252-
# base URL from which the finished HTML is served.
253-
#
224+
# base URL from which the finished documentation is served.
254225
# html_use_opensearch = ''
255226

256227
# This is the file name suffix for HTML files (e.g. ".xhtml").
@@ -260,35 +231,33 @@
260231
# Sphinx supports the following languages:
261232
# 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja'
262233
# 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr', 'zh'
263-
#
264234
# html_search_language = 'en'
265235

266236
# A dictionary with options for the search language support, empty by default.
267-
# 'ja' uses this config value.
268-
# 'zh' user can custom change `jieba` dictionary path.
269-
#
270237
# html_search_options = {'type': 'default'}
271238

272239
# The name of a javascript file (relative to the configuration directory) that
273240
# implements a search results scorer. If empty, the default will be used.
274-
#
275241
# html_search_scorer = 'scorer.js'
276242

277243
# Output file base name for HTML help builder.
278-
htmlhelp_basename = 'autodoc-exampledoc'
244+
htmlhelp_basename = 'python-amazon-ad-apidoc'
279245

280246
# -- Options for LaTeX output ---------------------------------------------
281247

282248
latex_elements = {
283249
# The paper size ('letterpaper' or 'a4paper').
284250
#
285251
# 'papersize': 'letterpaper',
252+
286253
# The font size ('10pt', '11pt' or '12pt').
287254
#
288255
# 'pointsize': '10pt',
256+
289257
# Additional stuff for the LaTeX preamble.
290258
#
291259
# 'preamble': '',
260+
292261
# Latex figure (float) alignment
293262
#
294263
# 'figure_align': 'htbp',
@@ -298,52 +267,41 @@
298267
# (source start file, target name, title,
299268
# author, documentclass [howto, manual, or own class]).
300269
latex_documents = [
301-
(master_doc, 'autodoc-example.tex', u'autodoc-example Documentation', u'Eric Beahan', 'manual'),
270+
(master_doc, 'python-amazon-ad-api.tex', u'Python Amazon Advertising API Documentation',
271+
u'Daniel Alvaro', 'manual'),
302272
]
303273

304274
# The name of an image file (relative to this directory) to place at the top of
305275
# the title page.
306-
#
307276
# latex_logo = None
308277

309278
# For "manual" documents, if this is true, then toplevel headings are parts,
310279
# not chapters.
311-
#
312280
# latex_use_parts = False
313281

314282
# If true, show page references after internal links.
315-
#
316283
# latex_show_pagerefs = False
317284

318285
# If true, show URL addresses after external links.
319-
#
320286
# latex_show_urls = False
321287

322288
# Documents to append as an appendix to all manuals.
323-
#
324289
# latex_appendices = []
325290

326-
# It false, will not define \strong, \code, \titleref, \crossref ... but only
327-
# \sphinxstrong, ..., \sphinxtitleref, ... To help avoid clash with user added
328-
# packages.
329-
#
330-
# latex_keep_old_macro_names = True
331-
332291
# If false, no module index is generated.
333-
#
334292
# latex_domain_indices = True
335293

336294

337295
# -- Options for manual page output ---------------------------------------
338296

339-
html_style = 'css/custom.css'
340-
341297
# One entry per manual page. List of tuples
342298
# (source start file, name, description, authors, manual section).
343-
man_pages = [(master_doc, 'autodoc-example', u'autodoc-example Documentation', [author], 1)]
299+
man_pages = [
300+
(master_doc, 'python-amazon-ad-api', u'Python Amazon Advertising API Documentation',
301+
[author], 1)
302+
]
344303

345304
# If true, show URL addresses after external links.
346-
#
347305
# man_show_urls = False
348306

349307

@@ -353,29 +311,19 @@
353311
# (source start file, target name, title, author,
354312
# dir menu entry, description, category)
355313
texinfo_documents = [
356-
(
357-
master_doc,
358-
'autodoc-example',
359-
u'autodoc-example Documentation',
360-
author,
361-
'autodoc-example',
362-
'One line description of project.',
363-
'Miscellaneous',
364-
),
314+
(master_doc, 'python-amazon-ad-api', u'Python Amazon Advertising API Documentation',
315+
author, 'python-amazon-ad-api', 'Python wrapper for the Amazon Advertising API.',
316+
'Miscellaneous'),
365317
]
366318

367319
# Documents to append as an appendix to all manuals.
368-
#
369320
# texinfo_appendices = []
370321

371322
# If false, no module index is generated.
372-
#
373323
# texinfo_domain_indices = True
374324

375325
# How to display URL addresses: 'footnote', 'no', or 'inline'.
376-
#
377326
# texinfo_show_urls = 'footnote'
378327

379328
# If true, do not generate a @detailmenu in the "Top" node's menu.
380-
#
381329
# texinfo_no_detailmenu = False

0 commit comments

Comments
 (0)