8000 DOC: Doc build for a single doc made much faster, and clean up by datapythonista · Pull Request #24428 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

DOC: Doc build for a single doc made much faster, and clean up #24428

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Dec 30, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
building only api pages when needed, based on SPHINX_PATTERN, and not…
… regex
  • Loading branch information
datapythonista committed Dec 14, 2018
commit 83c3b45be6c6914729d2860339f0fc4b97a41a1e
29 changes: 8 additions & 21 deletions 29 doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

import sys
import os
import re
import inspect
import importlib
import logging
Expand Down Expand Up @@ -100,14 +99,17 @@
exclude_patterns.append('**/*.ipynb')

# sphinx_pattern can be '-api' to exclude the API pages,
# or the path to a file (e.g. '10min.rst' or 'generated/pandas.DataFrame.head.rst')
# or the path to a file
# (e.g. '10min.rst' or 'generated/pandas.DataFrame.head.rst')
source_path = os.path.dirname(os.path.abspath(__file__))
pattern = os.environ.get('SPHINX_PATTERN')
autosummary_generate = pattern != '-api'
if pattern:
for dirname, dirs, fnames in os.walk(source_path):
for fname in fnames:
if os.path.splitext(fname)[-1] in ('.rst', '.ipynb'):
fname = os.path.relpath(os.path.join(dirname, fname), source_path)
fname = os.path.relpath(os.path.join(dirname, fname),
source_path)

if (fname == 'index.rst'
and os.path.abspath(dirname) == source_path):
Expand All @@ -118,33 +120,18 @@
elif fname != pattern:
exclude_patterns.append(fname)

print(exclude_patterns)

with open(os.path.join(source_path, 'index.rst.template')) as f:
t = jinja2.Template(f.read())

with open(os.path.join(source_path, 'index.rst'), 'w') as f:
f.write(t.render(include_api=pattern is None,
single_doc=os.path.splitext(pattern)[0]
if pattern is not None and pattern != '-api'
else None))
single_doc=(os.path.splitext(pattern)[0]
if pattern is not None and pattern != '-api'
else None)))


spelling_word_list_filename = ['spelling_wordlist.txt', 'names_wordlist.txt']
spelling_ignore_pypi_package_names = True

with open("index.rst") as f:
index_rst_lines = f.readlines()

# only include the slow autosummary feature if we're building the API section
# of the docs

# JP: added from sphinxdocs
autosummary_generate = False

if any(re.match(r"\s*api\s*", l) for l in index_rst_lines):
autosummary_generate = True

# numpydoc
# for now use old parameter listing (styling + **kwargs problem)
numpydoc_use_blockquotes = True
Expand Down
0