Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
14 changes: 14 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,26 @@
# Include notebooks at build time.
root_dir = Path(__file__).resolve().parents[1]
external_nb_dir = root_dir / "examples"
copied_files = []
for f in external_nb_dir.glob("*.ipynb"):
dest = Path(__file__).parent / "examples" / f.name
if dest.exists():
dest.unlink()
copied_files.append(dest)
shutil.copy(f, dest)


def post_build_hook(app, exception):
"""Remove copied files after building documentation."""
for f in copied_files:
if f.exists():
f.unlink()


def setup(app):
app.connect("build-finished", post_build_hook)


# -- General configuration ------------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
Expand Down
23 changes: 23 additions & 0 deletions news/rm-copied-notebook.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
**Added:**

* No news added: Remove the copied notebooks after building the documentation.

**Changed:**

* <news item>

**Deprecated:**

* <news item>

**Removed:**

* <news item>

**Fixed:**

* <news item>

**Security:**

* <news item>
Loading