diff --git a/doc/make.py b/doc/make.py index d90cd2428360d..a81ba7afd9f81 100755 --- a/doc/make.py +++ b/doc/make.py @@ -41,12 +41,14 @@ def __init__( self, num_jobs=0, include_api=True, + whatsnew=False, single_doc=None, verbosity=0, warnings_are_errors=False, ): self.num_jobs = num_jobs self.include_api = include_api + self.whatsnew = whatsnew self.verbosity = verbosity self.warnings_are_errors = warnings_are_errors @@ -56,6 +58,8 @@ def __init__( os.environ["SPHINX_PATTERN"] = single_doc elif not include_api: os.environ["SPHINX_PATTERN"] = "-api" + elif whatsnew: + os.environ["SPHINX_PATTERN"] = "whatsnew" self.single_doc_html = None if single_doc and single_doc.endswith(".rst"): @@ -235,6 +239,9 @@ def html(self): self._open_browser(self.single_doc_html) else: self._add_redirects() + if self.whatsnew: + self._open_browser(os.path.join("whatsnew", "index.html")) + return ret_code def latex(self, force=False): @@ -302,6 +309,12 @@ def main(): argparser.add_argument( "--no-api", default=False, help="omit api and autosummary", action="store_true" ) + argparser.add_argument( + "--whatsnew", + default=False, + help="only build whatsnew (and api for links)", + action="store_true", + ) argparser.add_argument( "--single", metavar="FILENAME", @@ -353,6 +366,7 @@ def main(): builder = DocBuilder( args.num_jobs, not args.no_api, + args.whatsnew, args.single, args.verbosity, args.warnings_are_errors, diff --git a/doc/source/conf.py b/doc/source/conf.py index 7f7ddd8209272..7cd9743e463d0 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -91,8 +91,8 @@ # (e.g. '10min.rst' or 'pandas.DataFrame.head') source_path = os.path.dirname(os.path.abspath(__file__)) pattern = os.environ.get("SPHINX_PATTERN") -single_doc = pattern is not None and pattern != "-api" -include_api = pattern != "-api" +single_doc = pattern is not None and pattern not in ("-api", "whatsnew") +include_api = pattern is None or pattern == "whatsnew" if pattern: for dirname, dirs, fnames in os.walk(source_path): reldir = os.path.relpath(dirname, source_path) @@ -104,7 +104,13 @@ continue elif pattern == "-api" and reldir.startswith("reference"): exclude_patterns.append(fname) - elif pattern != "-api" and fname != pattern: + elif ( + pattern == "whatsnew" + and not reldir.startswith("reference") + and reldir != "whatsnew" + ): + exclude_patterns.append(fname) + elif single_doc and fname != pattern: exclude_patterns.append(fname) with open(os.path.join(source_path, "index.rst.template")) as f: diff --git a/doc/source/development/contributing.rst b/doc/source/development/contributing.rst index bf1d7d5fce32a..f3630a44d29cd 100644 --- a/doc/source/development/contributing.rst +++ b/doc/source/development/contributing.rst @@ -604,6 +604,10 @@ reducing the turn-around time for checking your changes. python make.py clean python make.py --single pandas.DataFrame.join + # compile whatsnew and API section (to resolve links in the whatsnew) + python make.py clean + python make.py --whatsnew + For comparison, a full documentation build may take 15 minutes, but a single section may take 15 seconds. Subsequent builds, which only process portions you have changed, will be faster.