Skip to content

Commit 08dbd6d

Browse files
committed
fix: Use simple config with autodoc_mock_imports and napoleon
1 parent c8f4cd6 commit 08dbd6d

File tree

1 file changed

+33
-293
lines changed

1 file changed

+33
-293
lines changed

docs/conf.py

Lines changed: 33 additions & 293 deletions
Original file line numberDiff line numberDiff line change
@@ -1,329 +1,69 @@
11
# -*- coding: utf-8 -*-
22
#
3-
# autodoc-example documentation build configuration file, created by
4-
# sphinx-quickstart on Thu Sep 29 20:30:00 2016.
5-
#
6-
# This file is execfile()d with the current directory set to its
7-
# containing dir.
8-
#
9-
# Note that not all possible configuration values are present in this
10-
# autogenerated file.
11-
#
12-
# All configuration values have a default; values that are commented out
13-
# serve to show the default.
3+
# Configuration file for Sphinx documentation
144

15-
# If extensions (or modules to document with autodoc) are in another directory,
16-
# add these directories to sys.path here. If the directory is relative to the
17-
# documentation root, use os.path.abspath to make it absolute, like shown here.
18-
#
195
import os
206
import sys
21-
import inspect
227

8+
# Agregar el directorio padre al path
239
sys.path.insert(0, os.path.abspath('..'))
2410

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
31-
3211
# -- General configuration ------------------------------------------------
3312

34-
# If your documentation needs a minimal Sphinx version, state it here.
35-
#
36-
# needs_sphinx = '1.0'
37-
38-
# Add any Sphinx extension module names here, as strings. They can be
39-
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
40-
# ones.
13+
# Extensions
4114
extensions = [
4215
'sphinx.ext.autodoc',
43-
'sphinx.ext.napoleon', # ¡IMPORTANTE para docstrings estilo Google!
16+
'sphinx.ext.napoleon', # Para docstrings estilo Google
4417
'sphinx_rtd_theme'
4518
]
4619

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
20+
# Configuración de napoleon
5521
napoleon_google_docstring = True
5622
napoleon_numpy_docstring = False
5723
napoleon_include_init_with_doc = True
58-
napoleon_include_private_with_doc = False
59-
napoleon_include_special_with_doc = True
60-
61-
# Add any paths that contain templates here, relative to this directory.
62-
templates_path = ['_templates']
6324

64-
html_theme_options = {"collapse_navigation": False}
25+
# Configuración de autodoc
26+
autodoc_default_options = {
27+
'members': True,
28+
'undoc-members': True,
29+
'member-order': 'bysource'
30+
}
6531

66-
# The suffix(es) of source filenames.
67-
# You can specify multiple suffix as a list of string:
68-
#
69-
# source_suffix = ['.rst', '.md']
70-
source_suffix = '.rst'
32+
# Para métodos decorados
33+
autodoc_inherit_docstrings = True
34+
35+
# Mockear importaciones problemáticas
36+
autodoc_mock_imports = [
37+
'requests',
38+
'cachetools',
39+
'pycryptodome',
40+
'pytz',
41+
'confuse',
42+
'six',
43+
'python-dotenv',
44+
'pyyaml',
45+
'ad_api', # Mockear el paquete principal
46+
]
7147

72-
# The encoding of source files.
73-
#
74-
# source_encoding = 'utf-8-sig'
48+
# Templates
49+
templates_path = ['_templates']
7550

76-
# The master toctree document.
51+
# Source
52+
source_suffix = '.rst'
7753
master_doc = 'index'
7854

79-
# General information about the project.
55+
# Project info
8056
project = u'Python Amazon Advertising API'
8157
copyright = u'2023, Daniel Alvaro'
8258
author = u'Daniel Alvaro'
83-
84-
# The version info for the project you're documenting, acts as replacement for
85-
# |version| and |release|, also used in various other places throughout the
86-
# built documents.
87-
#
88-
# The short X.Y version.
8959
version = u'0.7.4'
90-
# The full version, including alpha/beta/rc tags.
9160
release = u'0.7.4'
9261

93-
# The language for content autogenerated by Sphinx. Refer to documentation
94-
# for a list of supported languages.
95-
#
96-
# This is also used if you do content translation via gettext catalogs.
97-
# Usually you set "language" from the command line for these cases.
98-
language = None
99-
100-
# There are two options for replacing |today|: either, you set today to some
101-
# non-false value, then it is used:
102-
#
103-
# today = ''
104-
#
105-
# Else, today_fmt is used as the format for a strftime call.
106-
#
107-
# today_fmt = '%B %d, %Y'
108-
109-
# List of patterns, relative to source directory, that match files and
110-
# directories to ignore when looking for source files.
111-
# This patterns also effect to html_static_path and html_extra_path
62+
# Exclusiones
11263
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
11364

114-
# The reST default role (used for this markup: `text`) to use for all
115-
# documents.
116-
#
117-
# default_role = None
118-
119-
# If true, '()' will be appended to :param: and :param type: in function
120-
# descriptions.
121-
#
122-
add_function_parentheses = True
123-
124-
# If true, the current module name will be prepended to all description
125-
# unit titles (such as .. function::).
126-
#
127-
add_module_names = True
128-
129-
# If true, sectionauthor and moduleauthor directives will be shown in the
130-
# output. They are ignored by default.
131-
#
132-
# show_authors = False
133-
134-
# The name of the Pygments (syntax highlighting) style to use.
135-
pygments_style = 'sphinx'
136-
137-
# A list of ignored prefixes for module index sorting.
138-
# modindex_common_prefix = []
139-
140-
# If true, keep warnings as "system message" paragraphs in the built documents.
141-
# keep_warnings = False
142-
143-
# If true, `todo` and `todoList` produce output, else they produce nothing.
144-
todo_include_todos = False
145-
146-
14765
# -- Options for HTML output ----------------------------------------------
14866

149-
# The theme to use for HTML and HTML Help pages. See the documentation for
150-
# a list of builtin themes.
151-
#
15267
html_theme = 'sphinx_rtd_theme'
153-
154-
# Theme options are theme-specific and customize the look and feel of a theme
155-
# further. For a list of options available for each theme, see the
156-
# documentation.
157-
#
158-
# html_theme_options = {}
159-
160-
# Add any paths that contain custom themes here, relative to this directory.
161-
# html_theme_path = []
162-
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'
166-
167-
# A shorter title for the navigation bar. Default is the same as html_title.
168-
# html_short_title = None
169-
170-
# The name of an image file (relative to this directory) to place at the top
171-
# of the sidebar.
172-
# html_logo = None
173-
174-
# The name of an image file (relative to this directory) to use as a favicon of
175-
# the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
176-
# pixels large.
177-
# html_favicon = None
178-
179-
# Add any paths that contain custom static files (such as style sheets) here,
180-
# relative to this directory. They are copied after the builtin static files,
181-
# so a file named "default.css" will overwrite the builtin "default.css".
68+
html_theme_options = {"collapse_navigation": False}
18269
html_static_path = ['_static']
183-
184-
# Add any extra paths that contain custom files (such as robots.txt or
185-
# .htaccess) here, relative to this directory. These files are copied
186-
# directly to the root of the documentation.
187-
# html_extra_path = []
188-
189-
# If not None, a 'Last updated on:' timestamp is inserted at every page
190-
# bottom, using the given strftime format.
191-
# html_last_updated_fmt = None
192-
193-
# If true, SmartyPants will be used to convert quotes and dashes to
194-
# typographically correct entities.
195-
# html_use_smartypants = True
196-
197-
# Custom sidebar templates, maps document names to template names.
198-
# html_sidebars = {}
199-
200-
# Additional templates that should be rendered to pages, maps page names to
201-
# template names.
202-
# html_additional_pages = {}
203-
204-
# If false, no module index is generated.
205-
# html_domain_indices = True
206-
207-
# If false, no index is generated.
208-
# html_use_index = True
209-
210-
# If true, the index is split into individual pages for each letter.
211-
# html_split_index = False
212-
213-
# If true, links to the reST sources are added to the pages.
214-
# html_show_sourcelink = True
215-
216-
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
217-
# html_show_sphinx = True
218-
219-
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
220-
# html_show_copyright = True
221-
222-
# If true, an OpenSearch description file will be output, and all pages will
223-
# contain a <link> tag referring to it. The value of this option must be the
224-
# base URL from which the finished documentation is served.
225-
# html_use_opensearch = ''
226-
227-
# This is the file name suffix for HTML files (e.g. ".xhtml").
228-
# html_file_suffix = None
229-
230-
# Language to be used for generating the HTML full-text search index.
231-
# Sphinx supports the following languages:
232-
# 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja'
233-
# 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr', 'zh'
234-
# html_search_language = 'en'
235-
236-
# A dictionary with options for the search language support, empty by default.
237-
# html_search_options = {'type': 'default'}
238-
239-
# The name of a javascript file (relative to the configuration directory) that
240-
# implements a search results scorer. If empty, the default will be used.
241-
# html_search_scorer = 'scorer.js'
242-
243-
# Output file base name for HTML help builder.
244-
htmlhelp_basename = 'python-amazon-ad-apidoc'
245-
246-
# -- Options for LaTeX output ---------------------------------------------
247-
248-
latex_elements = {
249-
# The paper size ('letterpaper' or 'a4paper').
250-
#
251-
# 'papersize': 'letterpaper',
252-
253-
# The font size ('10pt', '11pt' or '12pt').
254-
#
255-
# 'pointsize': '10pt',
256-
257-
# Additional stuff for the LaTeX preamble.
258-
#
259-
# 'preamble': '',
260-
261-
# Latex figure (float) alignment
262-
#
263-
# 'figure_align': 'htbp',
264-
}
265-
266-
# Grouping the document tree into LaTeX files. List of tuples
267-
# (source start file, target name, title,
268-
# author, documentclass [howto, manual, or own class]).
269-
latex_documents = [
270-
(master_doc, 'python-amazon-ad-api.tex', u'Python Amazon Advertising API Documentation',
271-
u'Daniel Alvaro', 'manual'),
272-
]
273-
274-
# The name of an image file (relative to this directory) to place at the top of
275-
# the title page.
276-
# latex_logo = None
277-
278-
# For "manual" documents, if this is true, then toplevel headings are parts,
279-
# not chapters.
280-
# latex_use_parts = False
281-
282-
# If true, show page references after internal links.
283-
# latex_show_pagerefs = False
284-
285-
# If true, show URL addresses after external links.
286-
# latex_show_urls = False
287-
288-
# Documents to append as an appendix to all manuals.
289-
# latex_appendices = []
290-
291-
# If false, no module index is generated.
292-
# latex_domain_indices = True
293-
294-
295-
# -- Options for manual page output ---------------------------------------
296-
297-
# One entry per manual page. List of tuples
298-
# (source start file, name, description, authors, manual section).
299-
man_pages = [
300-
(master_doc, 'python-amazon-ad-api', u'Python Amazon Advertising API Documentation',
301-
[author], 1)
302-
]
303-
304-
# If true, show URL addresses after external links.
305-
# man_show_urls = False
306-
307-
308-
# -- Options for Texinfo output -------------------------------------------
309-
310-
# Grouping the document tree into Texinfo files. List of tuples
311-
# (source start file, target name, title, author,
312-
# dir menu entry, description, category)
313-
texinfo_documents = [
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'),
317-
]
318-
319-
# Documents to append as an appendix to all manuals.
320-
# texinfo_appendices = []
321-
322-
# If false, no module index is generated.
323-
# texinfo_domain_indices = True
324-
325-
# How to display URL addresses: 'footnote', 'no', or 'inline'.
326-
# texinfo_show_urls = 'footnote'
327-
328-
# If true, do not generate a @detailmenu in the "Top" node's menu.
329-
# texinfo_no_detailmenu = False

0 commit comments

Comments
 (0)