|
31 | 31 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom |
32 | 32 | # ones. |
33 | 33 | extensions = [ |
| 34 | + 'sphinx.ext.extlinks', |
34 | 35 | 'sphinx.ext.intersphinx', |
35 | 36 | 'sphinx.ext.todo', |
| 37 | + 'sphinx_inline_tabs', |
36 | 38 | ] |
37 | 39 |
|
38 | 40 | # Add any paths that contain templates here, relative to this directory. |
|
51 | 53 | # The master toctree document. |
52 | 54 | master_doc = 'index' |
53 | 55 |
|
| 56 | +# -- Project information ----------------------------------------------------- |
| 57 | + |
| 58 | +github_url = 'https://github.com' |
| 59 | +github_repo_org = 'pypa' |
| 60 | +github_repo_name = 'packaging.python.org' |
| 61 | +github_repo_slug = f'{github_repo_org}/{github_repo_name}' |
| 62 | +github_repo_url = f'{github_url}/{github_repo_slug}' |
| 63 | +github_repo_issues_url = f'{github_url}/{github_repo_slug}/issues' |
| 64 | +github_sponsors_url = f'{github_url}/sponsors' |
| 65 | + |
54 | 66 | # General information about the project. |
55 | 67 | project = u'Python Packaging User Guide' |
56 | | -copyright = u'2013–2019, PyPA' |
| 68 | +copyright = u'2013–2020, PyPA' |
57 | 69 | author = 'Python Packaging Authority' |
58 | 70 |
|
59 | 71 | # The version info for the project you're documenting, acts as replacement for |
|
88 | 100 |
|
89 | 101 | # The reST default role (used for this markup: `text`) to use for all |
90 | 102 | # documents. |
91 | | -# |
92 | | -# default_role = None |
| 103 | +# Ref: python-attrs/attrs#571 |
| 104 | +default_role = 'any' # makes single backticks autofind targets |
93 | 105 |
|
94 | 106 | # If true, '()' will be appended to :func: etc. cross-reference text. |
95 | 107 | # |
|
132 | 144 | 'collapsiblesidebar': True, |
133 | 145 | 'externalrefs': True, |
134 | 146 | 'navigation_depth': 2, |
135 | | - 'issues_url': 'https://github.com/pypa/python-packaging-user-guide/issues' |
| 147 | + 'issues_url': github_repo_issues_url, |
136 | 148 | } |
137 | 149 |
|
138 | 150 | # Add any paths that contain custom themes here, relative to this directory. |
|
185 | 197 |
|
186 | 198 | # Custom sidebar templates, filenames relative to this file. |
187 | 199 | html_sidebars = { |
188 | | - '**': ['localtoc.html', 'relations.html'], |
189 | | - 'index': ['localtoc.html'] |
| 200 | + '**': ['globaltoc.html', 'relations.html'], |
| 201 | + 'index': ['globaltoc.html'] |
190 | 202 | } |
191 | 203 |
|
192 | 204 | # Additional templates that should be rendered to pages, maps page names to |
|
350 | 362 | # |
351 | 363 | # texinfo_no_detailmenu = False |
352 | 364 |
|
| 365 | +# -- Options for extlinks extension --------------------------------------- |
| 366 | +extlinks = { |
| 367 | + 'issue': (f'{github_repo_issues_url}/%s', '#'), # noqa: WPS323 |
| 368 | + 'pr': (f'{github_repo_url}/pull/%s', 'PR #'), # noqa: WPS323 |
| 369 | + 'commit': (f'{github_repo_url}/commit/%s', ''), # noqa: WPS323 |
| 370 | + 'gh': (f'{github_url}/%s', 'GitHub: '), # noqa: WPS323 |
| 371 | + 'user': (f'{github_sponsors_url}/%s', '@'), # noqa: WPS323 |
| 372 | +} |
| 373 | + |
353 | 374 | # Example configuration for intersphinx: refer to the Python standard library. |
354 | 375 | intersphinx_mapping = { |
355 | | - 'python': ('https://docs.python.org/3.6', None), |
| 376 | + 'python': ('https://docs.python.org/3', None), |
| 377 | + 'python2': ('https://docs.python.org/2', None), |
356 | 378 | 'pip': ('https://pip.pypa.io/en/latest/', None), |
| 379 | + 'setuptools': ('https://setuptools.rtfd.io/en/latest/', None), |
357 | 380 | } |
358 | 381 |
|
359 | 382 |
|
|
362 | 385 |
|
363 | 386 | todo_include_todos = True |
364 | 387 |
|
365 | | -# Configure the GitHub PR role to point to our project. |
366 | | - |
367 | | -pr_role_github_org_and_project = 'pypa/python-packaging-user-guide' |
368 | | - |
369 | | -# |
370 | | -# Custom plugin code below. |
371 | | -# |
372 | | - |
373 | | - |
374 | | -def setup(app): |
375 | | - app.add_config_value('pr_role_github_org_and_project', None, 'html') |
376 | | - app.add_role('pr', pr_role) |
377 | | - |
378 | | - |
379 | | -def pr_role(name, rawtext, text, lineno, inliner, options={}, content=[]): |
380 | | - """Transforms ':pr:`number`'' to a hyperlink to the referenced pull request |
381 | | - on GitHub.""" |
382 | | - from docutils import nodes |
383 | | - |
384 | | - app = inliner.document.settings.env |
385 | | - project = app.config.pr_role_github_org_and_project |
386 | | - title = '#{}'.format(text) |
387 | | - |
388 | | - uri = 'https://github.com/{}/pull/{}'.format(project, text) |
389 | | - rn = nodes.reference( |
390 | | - title, title, internal=False, refuri=uri, classes=['pr']) |
391 | | - return [rn], [] |
| 388 | +nitpicky = True |
| 389 | + |
| 390 | +# NOTE: consider having a separate ignore file |
| 391 | +# Ref: https://stackoverflow.com/a/30624034/595220 |
| 392 | +nitpick_ignore = [ |
| 393 | + ('envvar', 'PATH'), |
| 394 | + ('py:func', 'find_packages'), |
| 395 | + ('py:func', 'pkg_resources.iter_entry_points'), |
| 396 | + ('py:func', 'setup'), |
| 397 | + ('py:func', 'setuptools.find_namespace_packages'), |
| 398 | + ('py:func', 'setuptools.find_packages'), |
| 399 | + ('py:func', 'setuptools.setup'), |
| 400 | +] |
0 commit comments