From d2eb812385ee20eafd172152262f7c8d8b015008 Mon Sep 17 00:00:00 2001 From: Saransh Chopra Date: Thu, 18 Jan 2024 13:48:44 +0100 Subject: [PATCH] Add API docs of Histogram after the generation step --- noxfile.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/noxfile.py b/noxfile.py index 74c07079..81d896b9 100644 --- a/noxfile.py +++ b/noxfile.py @@ -2,6 +2,7 @@ import argparse import shutil +from pathlib import Path import nox @@ -99,6 +100,20 @@ def build_api_docs(session: nox.Session) -> None: "../src/boost_histogram", ) + # add API docs of boost_histogram._internal.hist.Histogram after + # the generation step + with Path("api/boost_histogram.rst").open("r+") as f: + lines = f.readlines() + for i in range(len(lines)): + if lines[i] == ".. automodule:: boost_histogram\n": + lines[i] = ".. automodule:: boost_histogram._internal.hist\n" + lines[i + 1] = " :members: Histogram\n" + break + + f.truncate(0) + f.seek(0) + f.writelines(lines) + @nox.session def lint(session: nox.Session) -> None: